Skip to content

graflo.architecture.evolution.preview_declared

A merge preview of what an op declares, built without the manifests.

:func:declared_preview reads only the equivalences: each member is a class node whose rows are the properties the declaration names, the merged class carries the into names, branch attributes and digest, and each identity source is a resource node with the raw fields it reads. Nothing the manifests settle is shown -- no other attributes, no resource sides, no vocabulary, no demoted keys, no findings -- so the outcome stays not_attempted.

The result is an ordinary :class:~graflo.architecture.evolution.preview.MergePreview, so :meth:~graflo.architecture.evolution.preview.MergePreview.focus and the plots take it as they take a full one.

Attributes

__all__ = ['declared_preview'] module-attribute

Classes

Functions:

declared_preview(op)

The declaration graph of op alone.

Parameters:

Name Type Description Default
op MergeManifestsOp | VertexEquivalence | RelationEquivalence

A merge op, or one equivalence (treated as position 0 of an op).

required

Returns:

Type Description
MergePreview

A preview with one cluster per equivalence, ids and positions as

MergePreview
MergePreview

them for an op whose every declaration forms its own group.

Source code in graflo/architecture/evolution/preview_declared.py
def declared_preview(
    op: MergeManifestsOp | VertexEquivalence | RelationEquivalence,
) -> MergePreview:
    """The declaration graph of *op* alone.

    Args:
        op: A merge op, or one equivalence (treated as position 0 of an op).

    Returns:
        A preview with one cluster per equivalence, ids and positions as
        :func:`~graflo.architecture.evolution.preview.preview_merge` numbers
        them for an op whose every declaration forms its own group.
    """
    if isinstance(op, VertexEquivalence):
        op = MergeManifestsOp(vertex_equivalences=[op])
    elif isinstance(op, RelationEquivalence):
        op = MergeManifestsOp(relation_equivalences=[op])
    graph = _Graph()
    clusters = [
        _vertex(graph, op, position, declaration)
        for position, declaration in enumerate(op.vertex_equivalences)
    ]
    clusters += [
        _relation(graph, op, position, declaration)
        for position, declaration in enumerate(op.relation_equivalences)
    ]
    return MergePreview(
        name_conflict=op.name_conflict,
        nodes=list(graph.nodes.values()),
        edges=list(graph.edges.values()),
        clusters=clusters,
    )