graflo.architecture.evolution.ops.equivalence¶
Equivalence declarations that align left and right members in a merge.
Attributes¶
Classes¶
PropertyEquivalence
¶
Bases: ConfigBaseModel
Align a property from the left and/or right member(s) onto a canonical name.
At least one of left / right must be set. A bare string applies to
every member declared on that side of the owning
:class:VertexEquivalence; a {member: field} dict maps per member,
for when members are not aligned under the same source field name.
Exact-name matches do not need a :class:PropertyEquivalence: after
boundary rename, merge_vertex_models unions fields by spelling, so a
property present under the same name on every member fuses for free.
Declare an equivalence only to rename or to pick a different into; the
merged key is declared on the :class:VertexEquivalence, the merged type
in :attr:MergeManifestsOp.field_types.
Source code in graflo/architecture/evolution/ops/equivalence.py
Attributes¶
into = PydanticField(..., description='Canonical property name on the merged vertex.')
class-attribute
instance-attribute
¶
left = PydanticField(default=None, description='Field name on the left member(s): a bare string applies to every left member of the owning equivalence, a ``{member: field}`` dict maps per member.')
class-attribute
instance-attribute
¶
right = PydanticField(default=None, description='Same shape as ``left``, for the right member(s).')
class-attribute
instance-attribute
¶
RelationEquivalence
¶
Bases: ConfigBaseModel
Collapse one or more left relations and one or more right relations onto one name.
Shares the left / right n-ary shape and the naming rules of
:class:VertexEquivalence.
Source code in graflo/architecture/evolution/ops/equivalence.py
Attributes¶
into = PydanticField(default=None, description='Merged relation name, never translated by a vocabulary. Omitted, the name comes from the vocabulary, or from the one spelling every member shares.')
class-attribute
instance-attribute
¶
left = PydanticField(..., description='One or more left relation names.')
class-attribute
instance-attribute
¶
left_members
property
¶
right = PydanticField(..., description='One or more right relation names.')
class-attribute
instance-attribute
¶
right_members
property
¶
Methods:¶
VertexEquivalence
¶
Bases: ConfigBaseModel
Collapse one or more left classes and one or more right classes into one.
GraFlo applies this map deterministically; it does not infer semantic
matches. left / right accept a bare class name (a 1-1 equivalence)
or a list (an n-ary cluster): {Company, Shop} ~ {Org, Branch} ->
Company. A member may also be spelled by the canonical name a vocabulary
gives it, which stands for every class the vocabulary sends there.
The group is everything the equivalence links: its members, and every class a vocabulary merges with one of them. Per-member maps (property equivalences, member-keyed identity sources) may name any class of the group by its own name.
Properties with the same spelling on every member after alignment fuse by
exact name without an entry in properties — list only renames.
identity is the merged key, as ordered funnel branches in canonical
names. A branch is a property the members carry (a name, or a composite
[a, b]), a :class:DerivedBranch each source computes from its own
columns, or a :class:LocalKeyBranch (the tagged fallback, last). One
property branch keys the class on that natural key; anything else keys it
on a funnel, where a record keys on its first complete branch. A funnel's
digest is stored in digest_field (id by default).
derive declares attributes each source computes, without making each
one a branch: a name or composite branch in identity keys on them, so
[host_key, group_key] fires only when both are derived and the digest
joins them. A DerivedBranch {name, sources} is the same as
derive: {name: sources} with the branch name.
Source code in graflo/architecture/evolution/ops/equivalence.py
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 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 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 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |
Attributes¶
allow = PydanticField(default_factory=list, description='Consequences of this merge it accepts. `self_relations`: an edge between two members becomes an edge from the class to itself. `observation_fusion`: two members produced in one accumulator slot (same pipeline level and `role`, or both bare) fuse into one node.')
class-attribute
instance-attribute
¶
derive = PydanticField(default=None, description='Attributes each source derives from its own columns, keyed by attribute name; each entry has the shape of `DerivedBranch.sources`. Identity branches key on them by name: a composite ``[a, b]`` of derived attributes fires only when every part is derived. Requires `identity`.')
class-attribute
instance-attribute
¶
derive_at = PydanticField(default_factory=dict, description='Per-resource pipeline level the derived and local-key branches derive at, as ``descend`` step indices. Omitted resources resolve to the single level producing the class (for member-keyed sources: the level producing the member on its side); supply a path only when a resource produces it at more than one level.')
class-attribute
instance-attribute
¶
digest_field = PydanticField(default='id', min_length=1, description="Property the merged funnel's digest is stored in -- the class's identity field. Only for a funnel `identity`; it must not be a branch field. Set it when a member carries a real `id`.")
class-attribute
instance-attribute
¶
has_derivation
property
¶
Whether the key needs pipeline steps: derive, a derived or local-key branch.
identity = PydanticField(default=None, description='The merged key, as ordered funnel branches in canonical names: a property the members carry, a composite ``[a, b]``, a derived branch ``{name, sources}``, or ``{local_key: ...}`` (last). One property branch is a natural key; anything else is a funnel. When unset, identity is carried through only if every member agrees; disagreement raises `MergeIdentityError`.')
class-attribute
instance-attribute
¶
into = PydanticField(default=None, description="Merged vertex type name: any name, including one either side uses or vacates. Never translated by a vocabulary; when it differs from the vocabulary's name for the group it wins. Omitted, the name comes from the vocabulary, or from the one spelling every member shares.")
class-attribute
instance-attribute
¶
is_natural_key
property
¶
Whether identity is one property branch, kept as a natural key.
left = PydanticField(..., description='One or more left-manifest vertex type names.')
class-attribute
instance-attribute
¶
left_members
property
¶
properties = PydanticField(default_factory=list, description='Property alignment map applied before the vertex merge.')
class-attribute
instance-attribute
¶
retire = PydanticField(default='demote', description="What becomes of each member's pre-merge key once `identity` re-keys the merged class. `demote` keeps each as a lookup-only secondary identity on `into`, and points edge steps of resources that only reference a member at it; `keep` leaves the fields as plain properties. Unused while the merged class keeps its members' shared key.")
class-attribute
instance-attribute
¶
right = PydanticField(..., description='One or more right-manifest vertex type names.')
class-attribute
instance-attribute
¶
right_members
property
¶
Methods:¶
derivations()
¶
Every derived attribute: the derive entries, then derived branches.
derive_attributes()
¶
The derive entries, each as the derivation of one attribute.
Source code in graflo/architecture/evolution/ops/equivalence.py
derived_branches()
¶
The derived branches of identity, in priority order.
local_key_branch()
¶
The local_key branch of identity, if declared.
members(side)
¶
property_maps(side)
¶
{member: {old_field: into_field}} for side, bare strings expanded.
Source code in graflo/architecture/evolution/ops/equivalence.py
raw_branches()
¶
The property branches of identity, each as its field tuple.