AddEntity

Add a new entity of a specified class, and properties associated with the new entity.

Parameters

Details

properties are key-value pairs associated with the entity. Check properties for more details.

if_not_found can be used to turn this command into “conditional add”. Check if_not_found for more details.

connect can be used to create a connection between the added object and other object(s). Check connect for more details.

Examples

Add a “Person” using AddEntity command:

[ {
    "AddEntity" : {
        "class" : "Person",
        "properties" : {
            "name" : "Jane Doe",
            "gender": "F",
            "email": "jane.doe@xyz.com"
        }
    }
} ]

Conditionally add a “Person” if the email is not already registered:

[ {
    "AddEntity" : {
        "class" : "Person",
        "if_not_found" : {
            "email": [ "==", "jane.doe@xyz.com" ],
        },
        "properties" : {
            "name" : "Jane Doe",
            "gender": "F",
            "email":  "jane.doe@xyz.com"
        }
    }
} ]

Conditionally add a “Person” if the email is not already registered, add a “Visit” event, and create a connection between the “Person” and the “Visit”:

[ {
    "AddEntity" : {
        "class" : "Person",
        "_ref": 1,
        "if_not_found" : {
            "email": [ "==", "jane.doe@xyz.com" ],
        },
        "properties" : {
            "name" : "Jane Doe",
            "gender": "F",
            "email":  "jane.doe@xyz.com"
        }
    }
}, {
    "AddEntity" : {
        "class" : "Visit",
        "properties" : {
            "start": {"_date": "Mon Aug 7 10:59:24 PDT 2017"}
            "end":   {"_date": "Mon Aug 7 12:59:24 PDT 2017"}
        },
        "connect": {
            "ref": 1,
            "class": "PersonMadeVisit",
        }
    }
} ]