graflo.architecture.graph_types.edge_derivation¶
Edge-derivation wiring shared by contract (authoring) and pipeline (runtime).
:class:EdgeDerivation is the declarative model set on edge pipeline steps
(:class:~graflo.architecture.contract.ingestion.steps.models.EdgeActorConfig):
how an edge step binds to extracted locations and documents. These fields do
not belong in schema edge_config / :class:~graflo.architecture.schema.edge.Edge.
:class:EdgeDerivationRegistry is the mutable runtime store for ingestion-time
edge behavior keyed by :class:~graflo.architecture.graph_types.identifiers.EdgeId
(typically one instance per :class:~graflo.architecture.pipeline.runtime.resource.ResourceRuntime).
When :attr:EdgeDerivation.relation_from_key is true, the registry records the
edge id so :class:~graflo.architecture.schema.db_aware.EdgeConfigDBAware (with
overlay) can align TigerGraph DDL with runtime.
An endpoint selector names the identity an edge endpoint is matched on. It is
plain -- None / "identity" for the primary, a secondary identity's
name, or a field list -- or per class: {Class: plain}, for an endpoint a
vertex_router fills with rows of several classes. A class the mapping does
not name is matched on its primary identity. :func:selector_for reduces
either form to the plain selector one concrete class uses.
Attributes¶
EndpointSelector = PlainSelector | dict[str, PlainSelector]
module-attribute
¶
A plain selector, or one per endpoint class ({Class: plain}).
PlainSelector = str | list[str]
module-attribute
¶
A secondary identity's name, a field list, "identity" or "secondary".
Classes¶
EdgeDerivation
¶
Bases: ConfigBaseModel
How this edge step selects vertex locations and reads per-document relation from data.
Source code in graflo/architecture/graph_types/edge_derivation.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
Attributes¶
emit_inverse = Field(default=False, description='If True, assembly also writes the declared inverse of every edge this step writes, when that inverse edge is declared.')
class-attribute
instance-attribute
¶
exclude_source = Field(default=None, description='Exclude source locations containing this path segment.')
class-attribute
instance-attribute
¶
exclude_target = Field(default=None, description='Exclude target locations containing this path segment.')
class-attribute
instance-attribute
¶
match = Field(default=None, description='Require this segment in both source and target locations.')
class-attribute
instance-attribute
¶
match_source = Field(default=None, description='Require this path segment in source vertex locations.')
class-attribute
instance-attribute
¶
match_target = Field(default=None, description='Require this path segment in target vertex locations.')
class-attribute
instance-attribute
¶
on_ambiguous = Field(default=None, description='Per-step override of ingestion_model.endpoints_on_ambiguous when a secondary identity matches several vertices.')
class-attribute
instance-attribute
¶
relation_field = Field(default=None, description='Document/ctx field name for per-document relationship label when schema relation is unset.')
class-attribute
instance-attribute
¶
relation_from_key = Field(default=False, description='If True, derive the per-document relation label from the location key during assembly.')
class-attribute
instance-attribute
¶
relation_map = Field(default=None, description='Raw ``relation_field`` values -> relation names.')
class-attribute
instance-attribute
¶
relation_map_only = Field(default=False, description='If True, a ``relation_field`` value absent from ``relation_map`` writes no edge.')
class-attribute
instance-attribute
¶
source_match = Field(default=None, description="Identity selector for the source endpoint: None/'identity' for the primary identity, a secondary identity name / field list, or a mapping of endpoint class to one of those.")
class-attribute
instance-attribute
¶
target_match = Field(default=None, description='Identity selector for the target endpoint; see source_match.')
class-attribute
instance-attribute
¶
Methods:¶
is_empty()
¶
Source code in graflo/architecture/graph_types/edge_derivation.py
map_relation(raw)
¶
Apply relation_map to a value read from relation_field.
Returns:
| Type | Description |
|---|---|
bool
|
|
Any
|
drops the value. |
Source code in graflo/architecture/graph_types/edge_derivation.py
uses_secondary_identity()
¶
True when either endpoint is matched on something other than the primary identity.
EdgeDerivationRegistry
¶
Mutable store for ingestion-time edge behavior keyed by :class:EdgeId.
Lives under the ingestion layer (typically one instance per :class:ResourceRuntime),
not on :class:~graflo.architecture.schema.core.CoreSchema.
Source code in graflo/architecture/graph_types/edge_derivation.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | |
Methods:¶
__init__()
¶
Source code in graflo/architecture/graph_types/edge_derivation.py
add_endpoint_rule(rule)
¶
Record selectors for the edges a data-driven edge step can write.
A later rule covering the same edge wins, as a later
:meth:set_endpoint_match does.
Source code in graflo/architecture/graph_types/edge_derivation.py
attach(vertex, selector)
¶
Record that this resource finds vertex by selector.
Every edge endpoint of that class is then matched on it, unless an edge step states a selector for that endpoint.
Source code in graflo/architecture/graph_types/edge_derivation.py
attached_selector(vertex)
¶
The selector vertex is found by, or None when it is not attached.
copy()
¶
Source code in graflo/architecture/graph_types/edge_derivation.py
endpoint_match_for(edge_id)
¶
How edge_id locates its endpoints, or None for the primary identity.
An edge registered by id wins; otherwise the last rule covering it decides, reduced to the edge's concrete classes. Per endpoint, one still on the primary identity whose class is attached takes the attached selector.
Source code in graflo/architecture/graph_types/edge_derivation.py
has_endpoint_matches()
¶
Whether any edge locates its endpoints by a secondary identity.
Such edges -- and attached vertices -- are resolved against database state at write time, which makes cross-batch write ordering semantic for the resource.
Source code in graflo/architecture/graph_types/edge_derivation.py
mark_relation_from_key(edge_id)
¶
merge_from(other)
¶
Source code in graflo/architecture/graph_types/edge_derivation.py
merge_vertex_weights(edge_id, rules)
¶
Append vertex weight rules for edge_id, deduplicating by stable fingerprint.
Source code in graflo/architecture/graph_types/edge_derivation.py
set_endpoint_match(edge_id, match)
¶
Record how edge_id locates its endpoints, for the write stage.
Only non-default selections are stored, so an edge matching on primary identity — the overwhelming majority — leaves no entry and costs nothing.
Source code in graflo/architecture/graph_types/edge_derivation.py
uses_relation_from_key(edge_id)
¶
EndpointMatch
dataclass
¶
Which identity each endpoint of an edge is matched on at write time.
None selectors mean the vertex's primary identity, which is the default
and leaves the write path exactly as it has always been.
Source code in graflo/architecture/graph_types/edge_derivation.py
EndpointRule
dataclass
¶
Endpoint selectors for edges an edge step names only per document.
A step whose endpoint comes from a router role, or whose relation comes
from the data, has no single edge id to register at load time. The rule
stands for every edge it can write: None in :attr:source,
:attr:target or :attr:relation is whatever the document resolves, and
a per-class selector is reduced to the concrete class when the rule is
applied.
Source code in graflo/architecture/graph_types/edge_derivation.py
Attributes¶
on_ambiguous = None
class-attribute
instance-attribute
¶
relation
instance-attribute
¶
source
instance-attribute
¶
source_match = None
class-attribute
instance-attribute
¶
target
instance-attribute
¶
target_match = None
class-attribute
instance-attribute
¶
Methods:¶
__init__(source, target, relation, source_match=None, target_match=None, on_ambiguous=None)
¶
applies_to(edge_id)
¶
resolve(edge_id)
¶
Source code in graflo/architecture/graph_types/edge_derivation.py
Functions:¶
selector_for(selector, vertex)
¶
The plain selector selector applies to endpoint class vertex.
A per-class mapping that does not name vertex leaves it on its primary
identity (None).