Deterministic operators
← Relifold documentationRelate
Recover labeled relationships within one Space using deterministic code.
Relate evaluates pairs from one Space and emits declared relationship labels.
Worked example
Relate(
name="map-package-dependencies",
input_spaces=("packages",),
output_space="package-relations",
primary_key="package",
evidence=("dependencies", "conflicts"),
labels=("depends_on", "conflicts_with"),
fn=lambda left, right: (
"depends_on" if right["package"] in left["dependencies"]
else "conflicts_with" if right["package"] in left["conflicts"]
else None
),
)Callable contract
fn(left, right) -> label | labels | None. Every emitted label must be declared.
Rows available to the callable
Each row argument contains the declared primary-key fields and the declared evidence fields available for that input role. If the callable reads a field that is not part of the primary key, declare it as evidence.
| Parameter | Default | Meaning |
|---|---|---|
input_spaces | required | The Space or Spaces read by the task. |
output_space | required | The Space that receives the task output. |
name | required | A stable task name used in sessions, reviews, and metrics. |
primary_key | id | The field, or tuple of fields, that identifies one task input. Duplicate primary-key values are evaluated once. |
evidence | none | Optional fields made available to the callable in addition to the primary key. |
fn | required | A deterministic callable that completely defines the operation's decision. Use an importable named function from your package, or PythonFunction(name=..., source=...) when authoring through the hosted API or node editor. Pairwise endomorphic functions may declare an exact indexed candidate_gate. |
function_parameters | registered defaults | Typed values bound to parameters declared by the registered function. Finite candidate sets let reviewed evidence support parameter advice. |
| Parameter | Default | Meaning |
|---|---|---|
labels | required | The complete allowed relationship vocabulary. |
closure_rules | label defaults | Optional valid implications among labels. |
min_labels_per_pair | 0 | Require at least this many labels on every admitted pair after closure. |
max_labels_per_pair | unlimited | Require no pair to carry more than this many labels after closure. |
Output
Known labeled relationships among input values.
Design guidance
Cardinality fields validate authoritative function and closure truth. A violation fails the task; Relate never drops true labels or invents absent labels.