graflo.architecture.evolution.equivalence¶
The resolved shape of a merge's groups.
A :class:Cluster is one group as merge applies it: its members on each side
in the manifests' own names, closed over every class a vocabulary merges with
one of them, and the one name the group takes. A :class:ClusterIndex holds
every group of one merge op. Both are built by
:mod:~graflo.architecture.evolution.naming_graph, which also owns every rule
about which groups may exist; this module only carries the result.
Nodes are (side, name) pairs, so a class named Org on the left is never
confused with Org on the right, and :func:subject spells them as the ids
refusals and previews point at.
Attributes¶
DeclarationT = TypeVar('DeclarationT', VertexEquivalence, RelationEquivalence)
module-attribute
¶
Kind = Literal['vertex', 'relation']
module-attribute
¶
RelationCluster = Cluster[RelationEquivalence]
module-attribute
¶
Side = Literal['left', 'right']
module-attribute
¶
SubjectScope = Literal['left', 'right', 'merged', 'canonical', 'resource']
module-attribute
¶
Classes¶
Cluster
dataclass
¶
Bases: Generic[DeclarationT]
One group, over vertices or relations, in the sides' own names.
left / right are the closed member sets: every class the group's
equivalences name, and every class a vocabulary merges with one of them.
declared_left / declared_right are the ones the equivalences
name. declaration is one equivalence over the closed sets.
declarations are the positions, in the op's equivalence list, of the
equivalences folded into it; empty when merge synthesized it.
Source code in graflo/architecture/evolution/equivalence.py
Attributes¶
aliases = field(default_factory=dict)
class-attribute
instance-attribute
¶
declaration
instance-attribute
¶
declarations = ()
class-attribute
instance-attribute
¶
declared_into = None
class-attribute
instance-attribute
¶
declared_left = ()
class-attribute
instance-attribute
¶
declared_right = ()
class-attribute
instance-attribute
¶
into
instance-attribute
¶
left
instance-attribute
¶
right
instance-attribute
¶
synthesized = False
class-attribute
instance-attribute
¶
Methods:¶
__init__(left, right, into, declaration, aliases=dict(), declared_into=None, synthesized=False, declared_left=(), declared_right=(), declarations=())
¶
declared_members(side)
¶
The members the equivalences name on side, without the vocabulary-joined ones.
Source code in graflo/architecture/evolution/equivalence.py
members(side)
¶
property_maps(side)
¶
The declaration's per-member attribute maps, keyed by resolved member name.
Source code in graflo/architecture/evolution/equivalence.py
resolved(side, declared)
¶
The member a spelling names on side: its own name, or its canonical one.
ClusterIndex
dataclass
¶
Every group of one merge op, as merge applies them.
Source code in graflo/architecture/evolution/equivalence.py
Attributes¶
declared_intos
property
¶
Every into the equivalences of the groups spell.
labels
property
¶
The merged names of every vertex cluster.
relation_labels
property
¶
The merged names of every relation cluster.
relations
instance-attribute
¶
vertices
instance-attribute
¶
Methods:¶
__init__(vertices, relations)
¶
cluster_for_label(into)
¶
The vertex cluster collapsing onto into, or None.
relation_members(side)
¶
Functions:¶
did_you_mean(name, candidates)
¶
A suffix naming a candidate that denotes the same concept, if any.
Authoring an equivalence in the wrong convention is the likeliest mistake at this boundary, and "not in left manifest" alone is a dead end when the vertex is right there under another spelling.
Source code in graflo/architecture/evolution/equivalence.py
subject(scope, name, attr=None)
¶
A stable id for the class or attribute a refusal is about.
Every refusal at this boundary names the declarations it refuses, and a caller that wants to point at them — a preview, a diagram, an editor — needs those names as data rather than parsed back out of prose.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scope
|
SubjectScope
|
Which vocabulary the name lives in. |
required |
name
|
str
|
The class or relation name. |
required |
attr
|
str | None
|
An attribute of it, when the subject is narrower than a class. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
|