Create relation
create_relationCreate a directed relation between two existing entities in the world
model. Both entities are referenced by UUID; to relate entities by name
use relate_entities.
Behavior:
- `relation_type` must be a type from the closed ontology. When none fits,
use 'related_to' and record the nuance with `store_fact`.
- 'same_as' does not create a relation: it opens a merge proposal for the
two entities, pending review, and returns its id.
- Rejected with an error: a source or target that does not exist; a
duplicate (a current relation of the same type between the same two
entities); a relation from an entity to itself, or one that would close
a cycle of current relations of the same type (the last two do not
apply to 'related_to').
- For single-valued relation types, if the source already has a current
relation of that type to a different target, the new relation is stored
and a contradiction is opened (see `resolve_contradiction`).
Args:
source_entity_id: UUID of the source entity.
target_entity_id: UUID of the target entity.
relation_type: Relation type from the closed ontology (enum in the
schema).
weight: Strength of the relation. Default 1.0.
causal_probability: Probability (0-1) that the source causes the
target. Default 0.0.
properties: Accepts only the keys 'weight' and 'causal_probability'.
Any other key returns an error and no relation is created;
store descriptive metadata as a fact with `store_fact`.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| weight | No | ||
| properties | No | ||
| relation_type | Yes | ||
| source_entity_id | Yes | ||
| target_entity_id | Yes | ||
| causal_probability | No |