Adds a node to a graph or replaces it if the node id already exists. A node carries optional JSON properties, an optional declared object type (validated once the graph’s ontology is frozen), and an optional entity binding that links the node to a row in another primitive. Cross-branch bindings are rejected.
Successful mutations return an acknowledgement that identifies the affected target, the mutation effect, and commit facts when the operation changed stored state.
Examples
Add a node with an object type and properties.
CLI
$ strata graph create social
$ strata graph add-node social alice --object-type person --properties {"age":30}
$ strata graph get-node social alice
Wire
{"graph":"social","type":"graph_create"}
{"graph":"social","node_id":"alice","object_type":"person","properties":{"age":30},"type":"graph_add_node"}
{"graph":"social","node_id":"alice","type":"graph_get_node"}
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
binding | GraphEntityBinding | no | Optional entity binding. |
graph | string | yes | Graph name. |
node_id | string | yes | Node id. |
object_type | string | no | Optional declared object type (validated once the ontology is frozen). |
properties | any | no | Optional node properties. |
Plus the optional scope: branch and space (default to the session branch and the "default" space).
Returns
MutationAck<GraphNodeWrite>.
Errors
failed_precondition.engine.runtime_closednot_found.engine.branchinvalid_argument.engine.product_spaceinvalid_argument.engine.graph_namenot_found.engine.graphinvalid_argument.engine.graph_node_idinvalid_argument.engine.graph_propertiesinvalid_argument.engine.graph_properties_too_largeinvalid_argument.engine.graph_type_hintinvalid_argument.engine.graph_bindingunsupported.engine.graph_binding_cross_branchfailed_precondition.engine.graph_ontology_node_typefailed_precondition.engine.graph_ontology_required_property
Invocation
- CLI:
strata graph add-node - Wire type:
graph_add_node