graph
node.add
Add or replace a graph node.
strata graph add-nodedb.graphs.add_node(graph: 'str', node_id: 'str', *, properties: 'Optional[dict]' = None, object_type: 'Optional[str]' = None, binding: 'Optional[dict]' = None) -> 'Any'wire graph_add_node
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 of the outcome: for a state-changing write, the affected target with the mutation effect and commit facts; for mutations that produce a domain result (such as a branch or a promotion outcome), that result object.
To see the complete help for this command, run:
strata graph add-node --helphelp(db.graphs.add_node)
Example
Add a node with an object type and properties.
strata graph create socialstrata graph add-node social alice --type person --properties {"age":30}strata graph get-node social alice
_ = db.graphs.create("social")_ = db.graphs.add_node("social", "alice", properties={"age": 30}, object_type="person")db.graphs.get_node("social", "alice").properties
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| graph | string | yes | Graph name. |
| node_id | string | yes | Node id. |
| binding | any | no | Optional entity binding. |
| branch | string or null | no | Target branch. Defaults to the executor handle branch. |
| object_type | string or null | no | Optional declared object type (validated once the ontology is frozen). |
| properties | any | no | Optional node properties. |
| space | string or null | no | Target product space. Defaults to `"default"`. |
Returns
MutationAck<GraphNodeWrite>
- dataobject
- typestring
Errors
Recover by code. Retry policy and commit outcome come from the shipped error registry.
| Code | Retry | Commit outcome |
|---|---|---|
| failed_precondition.engine.runtime_closed | never | not_started |
| not_found.engine.branch | never | not_applicable |
| invalid_argument.engine.product_space | never | not_started |
| invalid_argument.engine.graph_name | never | not_started |
| not_found.engine.graph | never | not_applicable |
| invalid_argument.engine.graph_node_id | never | not_started |
| invalid_argument.engine.graph_properties | never | not_started |
| invalid_argument.engine.graph_properties_too_large | never | not_started |
| invalid_argument.engine.graph_type_hint | never | not_started |
| invalid_argument.engine.graph_binding | never | not_started |
| unsupported.engine.graph_binding_cross_branch | after_state_change | not_applicable |
| failed_precondition.engine.graph_ontology_node_type | never | not_started |
| failed_precondition.engine.graph_ontology_required_property | never | not_started |