graflo.architecture.schema.context.element_text¶
One text rendering per schema element, for lexical and dense retrieval alike.
Every index over schema elements — a search index, an embedding table, an in-process lexical lane — must render an element the same way, or a query built for one misses in another. This module is that rendering: one row per vertex, per edge, and per property, each with its surface forms split out for lexical matching and its text ready to embed.
Attributes¶
ELEMENT_TEXT_VERSION = 1
module-attribute
¶
ElementKind = Literal['vertex', 'edge', 'property']
module-attribute
¶
Classes¶
ElementText
¶
Bases: ConfigBaseModel
One schema element, rendered for retrieval.
Source code in graflo/architecture/schema/context/element_text.py
Attributes¶
anchors = PydanticField(default_factory=list, description='``iri`` then ``exact_match`` IRIs.')
class-attribute
instance-attribute
¶
edge_id = PydanticField(default=None, description='The edge, or the owning edge of an edge property.')
class-attribute
instance-attribute
¶
kind = PydanticField(..., description='Element kind.')
class-attribute
instance-attribute
¶
name = PydanticField(..., description='Vertex name, edge relation (``source_target`` when relation-less), or property name.')
class-attribute
instance-attribute
¶
terms = PydanticField(default_factory=list, description='Surface forms a text may use: the name, then synonyms.')
class-attribute
instance-attribute
¶
text = PydanticField(..., description='Rendered text.')
class-attribute
instance-attribute
¶
unit = PydanticField(default=None, description='Declared unit.')
class-attribute
instance-attribute
¶
vertex = PydanticField(default=None, description='Owning vertex of a vertex property.')
class-attribute
instance-attribute
¶
Functions:¶
edge_name(edge)
¶
edge_pattern(edge)
¶
(Source)-[RELATION]->(Target); -[R]- when undirected, [] when relation-less.
Source code in graflo/architecture/schema/context/element_text.py
edge_text(edge)
¶
Render an edge: relation, endpoints, direction, description, anchors, properties.
Source code in graflo/architecture/schema/context/element_text.py
extractable_edge_properties(edge)
¶
The edge's properties a document can supply: all but reserved fields.
extractable_properties(vertex)
¶
The vertex's properties a document can supply, in declared order.
Minted key fields, derived fields and reserved fields are left out: no text supplies them, and core overwrites a stated derived value.
Source code in graflo/architecture/schema/context/element_text.py
field_label(field)
¶
name (TYPE, unit) "description", parts omitted when absent.
Source code in graflo/architecture/schema/context/element_text.py
field_text(field, owner)
¶
Render a property of owner (a vertex name, or an edge pattern).
Source code in graflo/architecture/schema/context/element_text.py
field_unit(field)
¶
identity_label(vertex)
¶
How the vertex is keyed: a, b · hash(a, b) · hash(first of: a | b, c) · assigned · none.
Source code in graflo/architecture/schema/context/element_text.py
iter_elements(schema, *, properties=True)
¶
Yield every element of schema in a deterministic order.
Vertices by name, then edges by (source, target, relation); with
properties, each owner's property rows follow it in declared order.
Minted key properties (:func:minted_key_fields) are left out throughout.
Source code in graflo/architecture/schema/context/element_text.py
minted_key_fields(vertex)
¶
Key properties minted or derived by graflo, never read from a document.
Empty for natural identity; the synthetic key of an assigned,
blank, hash or funnel vertex otherwise.
Source code in graflo/architecture/schema/context/element_text.py
vertex_text(vertex)
¶
Render a vertex: name, description, anchors, typed fields, identity.