graflo.architecture.schema.projection¶
Pure schema-slicing kernel: induced selection and standalone slice assembly.
This is the layer-2 half of manifest projection. It knows how to answer which
vertices and edges survive a selection and how to assemble the survivors into a
valid standalone :class:~graflo.architecture.schema.document.Schema, without
knowing anything about manifests, ingestion, bindings or ops.
:mod:graflo.architecture.evolution.project (L4) calls down into
:func:select_induced so manifest projection and schema-context projection
share one definition of induced connectivity rather than two.
SubschemaSelection
¶
Bases: ConfigBaseModel
Survivor and removal sets computed from a selection over a core schema.
Source code in graflo/architecture/schema/projection.py
build_subschema(schema, selection, *, drop_properties=None)
¶
Assemble a valid standalone Schema from selection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema
|
Schema
|
Source schema. Not mutated — every surviving element is deep-copied. |
required |
selection
|
SubschemaSelection
|
Survivors, as produced by :func: |
required |
drop_properties
|
Mapping[str, set[str]] | None
|
Vertex name -> property names to omit. Callers are responsible for never listing an identity-bearing field; dropping one yields a schema that validates and is semantically a lie. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Schema |
Schema
|
a slice that round-trips through |
Source code in graflo/architecture/schema/projection.py
project_db_profile(profile, selection)
¶
Return a copy of profile pruned to selection.
Mandatory before assembling a slice: :meth:Schema.finish_init calls
:meth:DatabaseProfile.validate_against_schema, which raises when an
EdgePhysicalSpec outlives the edge it references. Every physical entry
keyed by a logical vertex or edge is pruned here.
Source code in graflo/architecture/schema/projection.py
select_induced(core, *, keep_vertices=None, keep_edge_ids=None, connectivity='induced')
¶
Compute survivors for a vertex/edge selection over core.
An edge survives only when both endpoints survive, so the result is always
endpoint-closed and therefore constructible as a standalone CoreSchema
(see :meth:CoreSchema._validate_edge_vertices_defined).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
core
|
CoreSchema
|
Logical model to slice. Not mutated. |
required |
keep_vertices
|
Iterable[str] | None
|
Vertex names to retain, or None for all. |
None
|
keep_edge_ids
|
Iterable[EdgeId] | None
|
Edge ids to retain, or None for all. |
None
|
connectivity
|
Connectivity
|
|
'induced'
|
Returns:
| Name | Type | Description |
|---|---|---|
SubschemaSelection |
SubschemaSelection
|
surviving and removed vertices/edges. |