graflo.architecture.evolution.preview_focus¶
One merge preview, narrowed to what a single equivalence or attribute is about.
A :class:~graflo.architecture.evolution.preview.MergePreview describes the
whole merge; on a real schema that is too much to read at once. A focus
target names one part of it, and :func:focus returns the preview of that
part alone, every edge closed over the nodes it keeps:
- a cluster id (
vertex-cluster-0): the merged class, its members, their attributes, the resources its identity reads and the findings on any of them; - a merged attribute (
merged:Machine.match_key): every edge into it, with the rows and classes those edges leave from; rest: the findings no other target holds, with the classes they name.
Selection is by node id, never by declared_by: that field is a cluster id
for some edge kinds, a merged name, a side or a key space for others.
Attributes¶
AttributeScope = Literal['nontrivial', 'all']
module-attribute
¶
REST = 'rest'
module-attribute
¶
__all__ = ['REST', 'AttributeScope', 'finding_positions', 'focus', 'focus_targets', 'resolve_target']
module-attribute
¶
Classes¶
Functions:¶
finding_positions(preview, target)
¶
Positions in preview.findings of the findings target holds.
Source code in graflo/architecture/evolution/preview_focus.py
focus(preview, target)
¶
The part of preview that target is about.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
preview
|
MergePreview
|
The whole preview. |
required |
target
|
str | int
|
A cluster id, a merged attribute node id, |
required |
Returns:
| Type | Description |
|---|---|
MergePreview
|
A preview holding only the target's nodes, the edges between them, |
MergePreview
|
their findings in the original order, and the cluster they belong to. |
Raises:
| Type | Description |
|---|---|
KeyError
|
target is none of these; the message lists the valid ones. |
Source code in graflo/architecture/evolution/preview_focus.py
focus_targets(preview, attributes='nontrivial')
¶
Every target of preview, in the order a reader should take them.
Each vertex cluster is followed by its merged attributes, then come the
relation clusters, then rest when some finding is held by no other
target. Every finding lands in at least one target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
preview
|
MergePreview
|
The whole preview. |
required |
attributes
|
AttributeScope
|
Which merged attributes become targets of their own. |
'nontrivial'
|
Source code in graflo/architecture/evolution/preview_focus.py
resolve_target(preview, target)
¶
The target id target names, or None.
An integer, or a string of digits, is a position in the op's
vertex_equivalences: it names the cluster that declaration folded into.