Skip to content

Block link

Luis Remis edited this page Feb 9, 2018 · 2 revisions

link

There is often a need to indicate that an entity or image/video might be connected to another entity, either while adding or searching (or searching and adding). This block enables that.

This block has a dual meaning depending if used on a Add command or as part of a Find command.

When used as part of the Add command,

Parameters

  • [optional] class: class describing the relationship. If it is not specified, all relationships connected to the starting entity (entities) are explored.
  • [optional] ref: local id of an entity (or entities) returned by another query within the transaction, using the "FindEntity", "FindImage", "AddEntity", "AddImage" commands. It is the value of the "_ref" key and indicates where to start the search from.
  • [optional] direction: [in, out, any]. Default is "any. "in" indicates that the relationship actually ends at the starting entity (entities).

Example

// Isolated link block
"link": {
    "ref": 1234,
    "class": "Visit",
    "direction": "out",
}


// Used as part of a AddEntity command

"AddEntity" : {
    "class" : "Person",
    "_ref": 1234,                   // Declares a reference for future use
    "properties" : {
        "Name" : "Jane Doe",
        "Ethnicity" : "Jupeterian",
        "Gender": "F",
        "Email": "[email protected]"
    }
}
"AddEntity" : {
    "class" : "Person",
    "link": {                       // Indicates here a connection
        "ref": 1234,                // between Jon and Jane
        "direction": "in",          // (an edge in a graph)
        "class": "Friends"
    },

    "properties" : {
        "Name" : "Jon Doe",
        "Ethnicity" : "Martian",
        "Gender": "M",
        "Email": "[email protected]"
    }
}
Clone this wiki locally