is_connected_to

is_connected_to specifies connection(s)-based constraint that must be satisfied in a Find* command. It returns object(s) that are connected to the objects referenced by ref.

Parameters

  • [optional] ref: Reference to objects within the transaction.
  • [optional] connection_class: Indicates the class of the connection.
  • [optional] direction: Indicates direction of the connection (Default: any).
  • [optional] constraints Indicates constraints over the properties of the connection.

Details

is_connected_to can be used to filter objects based on their neighbors.

Examples

For instance, we can search for objects connected to another set of objects referenced by ref as follows:

[ {
    "FindEntity" : {
        "class" : "Person",
        "_ref": 1234,
        "constraints" : {
            "name" : ["==", "Jane Doe"]
        }
    }
},{
    "FindEntity" : {
        "class" : "Person",
        "constraints" : {
            "name" : ["==", "Jon Doe"]
        },
        "is_connected_to": {           # searching over just one connection.
            "ref": 1234,
            "connection_class": "BestFriendForever",
            "constraints": {
                "since_year": [">=", 2005]
            }
        }
    }
}]

In this case, the second FindEntity command aims to retrieve ONLY those entities of the class “Person” that have the name = “Jon Doe” AND are connected to the result of the first FindEntity, with that connection being of the class “BestFriendForever” and having a its “since_year” property greater than 2005.