Create Graph selector

When you want to query data held in the graph, you need to create your graph selector, which means you need to “build” a graph URL or path to define the data that you’re accessing or posting.

The structure of a graph selector is as follows:

[/ObjectPart][/~RelationPart/ObjectPart]*[SelectorParametersPart]

This can be read as:

  1. First there’s an optional ObjectPart.

  2. Then there are 0-n times RelationPart followed by ObjectPart.

  3. Then there’s an optional parameter part.

Within ObjectPart, there’s the following substructure:

ObjectName[:CollectionName][FieldSelector]

RelationPart starts with a tilde but is otherwise identical to ObjectPart.

These parts can be chained infinitely, but note the following:

  • The first part must be an object part.

  • When chaining more parts, there must always be both a relation part and an object part. A graph selector can never end with a relation part.

As a special case, when ~OneToMany and ~ManyToOne are used, the relation part doesn’t have anything else within it, that is, there’s no CollectionName or FieldSelector.

SelectorParameterPart contains parameters for paging and sorting query results.

Here’s an example query where you can see its composition:

GET /graph/Organization[@name='ACME']/~OneToMany/ProfileGroup[@type='employees'][/ObjectPart][/~RelationPart/ObjectPart]*[SelectorParametersPart]

Key characters used

Note the use of:

  • {count} to request the total size of a result set instead of the objects

  • ~ in the field selector, to denote a “like” condition for field value matching

  • * (asterisk) in the field selector, specify value starts with matching

  • {i=0,r=5} to say offset 0, limit 5

  • / (forward slash) to denote the start of a type selector

  • [] brackets to enclose a field selector

  • @ to denote a field and a corresponding condition on value

  • ~ to denote a relation type