reference¶
Canonical path: o6.reference
reference
¶
Describe a declarative linkage or add a reference between live nodes.
Two forms exist. o6.reference(instance, referenceType) attaches a node
declaration to the type or Object that contains it through an arbitrary
ReferenceType, and returns the same declaration so it can be assigned to a
class attribute. o6.reference(source, referenceType, target) adds a
reference between two live nodes immediately.
The named helpers -- o6.hasComponent, o6.hasProperty, o6.organizes
and their inverses -- are this function bound to a standard ReferenceType.
Reach for o6.reference for a custom or non-standard ReferenceType.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subject
|
_T | None
|
The node declaration to attach, the live source node of a
two-ended reference, or |
required |
referenceType
|
Any
|
Any NodeId-like value or generated ReferenceType class. |
required |
object
|
Any
|
The target of a two-ended reference. Live nodes are linked at once; a declaration becomes a child of the declaring type. |
UNSET
|
inverse
|
bool
|
Point the reference at the subject instead of away from it. |
False
|
server
|
Any
|
The server that owns a live reference. Only needed when neither endpoint is a live node and more than one server is running. |
UNSET
|
Raises:
| Type | Description |
|---|---|
TypeError
|
The subject is neither a node declaration nor a live node,
the endpoints belong to different servers, |
See Type child relationships for how declared children, optionality, and ownership fit together.