graflo.architecture.evolution.ops.validation¶
Checks shared by rename, merge, and vocabulary maps.
Functions:¶
validate_merge_sources(sources, into, *, kind)
¶
Reject a merge whose sources repeat or include the target.
The docstrings promise both; enforcing them at parse time means a serialized change set fails where it is read rather than where it is replayed, after the ops before it have already been applied.
Source code in graflo/architecture/evolution/ops/validation.py
validate_rename_map_is_injective(renames, *, kind, merge_hint)
¶
Reject a rename map that would collapse two names onto one.
A rename is a relabelling: it must not change how many types exist. Two sources
sharing a target is a merge, and the merge ops exist precisely because merging
needs decisions a rename cannot express — which properties survive, how identity
combines, what happens to edges that become self-loops. Left unchecked the
collapse is silent: the name-keyed lookup maps in VertexConfig / EdgeConfig
keep the last definition and the earlier one is shadowed but still serialized.
Source code in graflo/architecture/evolution/ops/validation.py
validate_vocabulary_is_idempotent(mapping, *, kind)
¶
Reject a chain or a swap: a canonical vocabulary has fixed points.
A name that is both a source that moves and a target of another entry
({X: Z, Z: Q}, {A: B, B: A}) makes the map non-idempotent — applying
it twice is not applying it once — so it cannot be read as a vocabulary,
where a canonical name is by definition one nothing maps away from. Such a
map is a relabel, which :class:CanonicalizeOp expresses (simultaneous
application over the original schema).
Source code in graflo/architecture/evolution/ops/validation.py
validate_vocabulary_map(vertices, relations, properties, *, allow_merges, kind, merge_hint)
¶
Reject an unacknowledged collapse in a vocabulary map.
A vocabulary map is a function on names, so its groups are its fibers:
every source of one target, including a self entry t: t that
declares an existing t a member of its own group. A group of more than
one name is a merge — it fuses entities and can create self-relations — so
it must be acknowledged rather than inferred from the map. Per-class
attribute maps are plain renames and must be injective outright.
Source code in graflo/architecture/evolution/ops/validation.py
vocabulary_groups(mapping)
¶
{target: [sources]} — the fibers of a vocabulary map, self entries included.