Skip to main content

is_endpoint_of

is_endpoint_of restricts a Find* command to endpoints of connections referenced earlier in the same transaction. Unlike is_connected_to, its ref identifies connections, not objects.

Parameters

Each referenced-connection object supports:

  • ref: A reference to connections created or found earlier in the transaction.
  • direction: Which endpoint to select. out selects the source, in selects the destination, and any selects both. The default is any.
  • connection_class: Optionally restrict the referenced connections by class.
  • constraints: Optionally restrict the referenced connections by their properties.

The constraint accepts the same single, any, and all forms as is_connected_to. For multiple specifications, put the referenced-connection objects in an any or all array. Each entry accepts the fields listed above.

For any, the endpoint sets produced by the entries are combined. For all, they are intersected. The resulting set is then intersected with the Find command's class, property, and is_connected_to constraints.

When group_by_source is enabled together with is_connected_to, endpoint constraints filter the matched objects while the groups continue to come from the object references in is_connected_to. is_endpoint_of alone does not define source groups.

Example

The following returns Jane, who is both the source endpoint of the Knows connection and the destination endpoint of the connection created in 2021:

[{
"AddEntity": {
"_ref": 1,
"class": "Person",
"properties": {
"name": "Jane"
}
}
}, {
"AddEntity": {
"_ref": 2,
"class": "Person",
"properties": {
"name": "John"
}
}
}, {
"AddEntity": {
"_ref": 5,
"class": "Person",
"properties": {
"name": "Alice"
}
}
}, {
"AddConnection": {
"_ref": 3,
"class": "Knows",
"src": 1,
"dst": 2
}
}, {
"AddConnection": {
"_ref": 4,
"class": "Knows",
"src": 5,
"dst": 1,
"properties": {
"since_year": 2021
}
}
}, {
"FindEntity": {
"with_class": "Person",
"is_endpoint_of": {
"all": [{
"ref": 3,
"direction": "out",
"connection_class": "Knows"
}, {
"ref": 4,
"direction": "in",
"constraints": {
"since_year": [">=", 2020]
}
}]
},
"results": {
"list": ["name"]
}
}
}]

Result from the query:

[{
"AddEntity": {
"status": 0
}
}, {
"AddEntity": {
"status": 0
}
}, {
"AddEntity": {
"status": 0
}
}, {
"AddConnection": {
"status": 0
}
}, {
"AddConnection": {
"status": 0
}
}, {
"FindEntity": {
"entities": [{
"name": "Jane"
}],
"returned": 1,
"status": 0
}
}]