GraphQL: query for data containing a specific substring

Hello,
I am trying to perform a query in GraphQL that selects only data containing a specific substring.
For instance, I execute the following query:

query
{ 
 stream(id:"a18f8c8569")
  {
    id
    name  
    object(id:"d872a56457fee3e627590d9e44db8b2d")
    {      
          id
          totalChildrenCount
     	  data 
         children     
         {        
          objects {
          totalChildrenCount
          __typename
          id 
          data
          speckleType       
        }
      }
    }
    commit(id:"c34a126754")
    {
      referencedObject     
    }
  }
}

and what I’m trying to do is to have in the response only “@SITE::ROAD”, “@SITE::BUILDINGS” (in this case). Is it feasible to somehow select only the data that contain the substring “::” using a GraphQL query?

Thank you in advance!

Hi @Maria_Rousi! Given how the names are, it sounds like you’re trying to receive only a specific rhino layer.

I’m afraid this is a bit difficult at the moment via direct graphql query - for DX ease, I’d suggest client side filtering (e.g: https://speckle.guide/dev/FilteringData.html; if you’re using a different sdk, ie, python, let us know and someone else from the team can jump in to help).

There are some team thoughts vibing around to make collections first class citizens, so you could reference a set of objects via a single id. We’d need to implement this across connectors, which might take some time - do let us know if this will help your usecase.

Hello @dimitrie!
In fact, we want to receive all rhino layers of a specific commit (in case this is possible) via GraphQL and not just a specific one.

By using client side filtering we need to download the whole commit first, which is something we would like to avoid as our commits tend to be very big in size. Using GraphQL would return results immediately, without having to download and parse the commit via custom code.

2 Likes