Docs menu · Reference

Declares a link type in the graph’s ontology: a name, its source and target object types, an optional cardinality hint (for example many-to-one), and property definitions. Source and target must name declared object types by the time the ontology is frozen. After freezing, this command fails with failed_precondition.engine.graph_ontology_frozen.

Successful mutations return an acknowledgement that identifies the affected target, the mutation effect, and commit facts when the operation changed stored state.

Examples

Define a link (edge) type between two object types.

CLI

$ strata graph create g
$ strata graph ontology define-object-type g person
$ strata graph ontology define-link-type g knows person person
$ strata graph ontology get g

Wire

{"graph":"g","type":"graph_create"}
{"graph":"g","name":"person","type":"graph_define_object_type"}
{"graph":"g","name":"knows","source":"person","target":"person","type":"graph_define_link_type"}
{"graph":"g","type":"graph_get_ontology"}

Parameters

NameTypeRequiredDescription
cardinalitystringnoOptional cardinality hint (e.g. one-to-many).
graphstringyesGraph name.
namestringyesLink type name.
propertiesobjectnoDeclared properties by name.
sourcestringyesDeclared source object type.
targetstringyesDeclared target object type.

Plus the optional scope: branch and space (default to the session branch and the "default" space).

Returns

MutationAck<GraphOntologyWrite>.

Errors

Invocation

  • CLI: strata graph ontology define-link-type
  • Wire type: graph_define_link_type

agents: this page as markdown → /docs/reference/graph/ontology/define_link_type.md