UpdateConnection

Updates existing Connection objects that satisfy the specified constraints.

Parameters

  • [optional] class: name of entity class.
  • [optional] _ref: Reference to other connections within the transaction.
  • [optional] ref1: Reference to the object that is the source of the connection.
  • [optional] ref2: Reference to the object that is the destination of the connection.

Blocks

Details

Either one of the ref parameters OR [class and/or constraints] must be specified.

If the _ref parameter is specified, it must refers to the search results of a previous FindConnection or AddConnection.

The remove_props parameter is an array of strings specifying the properties to be deleted (if any).

If search results are empty, this will cause an exception.

Examples

Find the connection of class “FriendWith” with a particular “since” property, and remove the “last_connected” property:

[ {
    "UpdateConnection" : {
        "class" : "FriendWith",
        "constraints" : {
            "since": [ "==", 1998 ],
        },
        "remove_props" : [ "last_seen_together" ]
    }
}]

Find the connection of class “HasBeen” with a particular “year” property, and change/add two new properties:

[ {
    "UpdateConnection" : {
        "class" : "HasBeen",
        "constraints" : {
            "year": [ "==", 2002 ],
        },
        "properties" : {
            "year":  2001,
            "month": "June"
        }
    }
}]