graflo.architecture.schema.vertex¶
Vertex configuration and management for graph databases.
This module provides classes and utilities for managing vertices in graph databases. It handles vertex configuration, property management, identity, and filtering operations. The module supports both ArangoDB and Neo4j through the DBType enum.
Key Components
- Vertex: Represents a vertex with its properties and identity
- VertexConfig: Manages vertices and their configurations
Example
vertex = Vertex(name="user", properties=["id", "name"]) config = VertexConfig(vertices=[vertex]) props = config.properties("user") # Returns list[Field] prop_names = config.property_names("user") # Returns list[str]
Attributes¶
DerivedForm = Literal['normal', 'keys']
module-attribute
¶
FieldMerge = Literal['replace', 'union']
module-attribute
¶
FieldSetBy = Literal['stamp', 'sync']
module-attribute
¶
IdentityMode = Literal['natural', 'hash', 'blank', 'assigned']
module-attribute
¶
PartsOrder = Literal['general_first', 'specific_first', 'unordered']
module-attribute
¶
PropertiesInputType = list[str] | list['Field'] | list[dict[str, Any]]
module-attribute
¶
RELOCATED_VERTEX_KEYS = {'dbname': 'db_profile.vertex_storage_names', 'indexes': 'db_profile.vertex_indexes', 'transforms': 'the ingestion model, as resource pipeline steps'}
module-attribute
¶
SCALAR_FIELD_TYPES = frozenset({FieldType.INT, FieldType.UINT, FieldType.FLOAT, FieldType.DOUBLE, FieldType.BOOL, FieldType.STRING, FieldType.DATETIME, FieldType.UUID})
module-attribute
¶
SCALAR_FIELD_TYPE_VALUES = frozenset(ft.value for ft in SCALAR_FIELD_TYPES)
module-attribute
¶
VertexName = str
module-attribute
¶
logger = logging.getLogger(__name__)
module-attribute
¶
Classes¶
Field
¶
Bases: ConfigBaseModel
Represents a typed field in a vertex.
Field objects behave like strings for backward compatibility. They can be used in sets, as dictionary keys, and in string comparisons. The type information is preserved for databases that need it (like TigerGraph).
Attributes:
| Name | Type | Description |
|---|---|---|
name |
VertexName
|
Name of the field |
type |
FieldType | None
|
Optional type of the field. Can be FieldType enum, str, or None at construction. Strings are converted to FieldType enum by the validator. None is allowed (most databases like ArangoDB don't require types). Defaults to None. |
item_type |
FieldType | None
|
Required when |
Source code in graflo/architecture/schema/vertex.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | |
Attributes¶
derived = PydanticField(default=None, exclude_if=lambda value: value is None, description='Computed by core from another field of the vertex, before every write and digest; never supplied by a document.')
class-attribute
instance-attribute
¶
description = PydanticField(default=None, description='Optional semantic description of the field for schema inference and downstream reasoning.')
class-attribute
instance-attribute
¶
item_type = PydanticField(default=None, description='Element type when ``type`` is LIST. Must be a scalar (INT, UINT, FLOAT, DOUBLE, BOOL, STRING, DATETIME, UUID).')
class-attribute
instance-attribute
¶
match = PydanticField(default=None, exclude_if=lambda value: value is None, description='How a stated value is compared with a stored one.')
class-attribute
instance-attribute
¶
merge = PydanticField(default='replace', exclude_if=lambda value: value == 'replace', description='How an upsert combines a value with the stored one: ``replace`` overwrites it; ``union`` keeps every member of both lists (LIST fields only).')
class-attribute
instance-attribute
¶
model_config = ConfigDict(extra='forbid')
class-attribute
instance-attribute
¶
name = PydanticField(..., description='Name of the field (e.g. column or attribute name).')
class-attribute
instance-attribute
¶
reserved = PydanticField(default=False, exclude_if=lambda value: value is False, description="Set only by the writer, from the caller's stamp. A reserved field is left out of type sheets, element text and instance schemas, and a query that names it in a projection, filter or aggregate is refused.")
class-attribute
instance-attribute
¶
semantics = PydanticField(default=None, description='Optional external-vocabulary anchors and unit for this field.')
class-attribute
instance-attribute
¶
set_by = PydanticField(default='stamp', exclude_if=lambda value: value == 'stamp', description="Who writes a reserved field: ``stamp``, the writer from the caller's stamp; or ``sync``, the bulk and sync writers from the record's sync hash, which an upsert sets to null.")
class-attribute
instance-attribute
¶
type = PydanticField(default=None, description='Optional field type for databases that require it (e.g. TigerGraph: INT, STRING). None for schema-agnostic backends.')
class-attribute
instance-attribute
¶
Methods:¶
__eq__(other)
¶
Compare equal to strings with same name, or other Field objects with same name.
Source code in graflo/architecture/schema/vertex.py
__hash__()
¶
__ne__(other)
¶
__repr__()
¶
Return representation including type information.
Source code in graflo/architecture/schema/vertex.py
__str__()
¶
normalize_item_type(v)
classmethod
¶
normalize_type(v)
classmethod
¶
validate_list_item_type()
¶
Source code in graflo/architecture/schema/vertex.py
FieldDerived
¶
Bases: ConfigBaseModel
A field core computes from another field of the same vertex.
Stored, never supplied: core overwrites a stated value, and a type sheet never shows the field.
Source code in graflo/architecture/schema/vertex.py
Attributes¶
form = PydanticField(..., description="``normal``: the source's normal form under its ``match.normalizer``. ``keys``: every less specific form of the source under its ``match.parts`` (a LIST of strings).")
class-attribute
instance-attribute
¶
source = PydanticField(..., description='The field it is computed from.')
class-attribute
instance-attribute
¶
FieldMatch
¶
Bases: ConfigBaseModel
How a stated value of the field is compared with a stored one.
It declares the value's structure, never its meaning. See
:mod:graflo.architecture.schema.compare for the levels it yields.
Source code in graflo/architecture/schema/vertex.py
Attributes¶
exclusive = PydanticField(default=None, exclude_if=lambda value: value is None, description='Whether two different values are evidence against a match (``conflict``) rather than ``differs``. Unset: true on a key or alternate-key field, false otherwise.')
class-attribute
instance-attribute
¶
normalizer = PydanticField(default=None, exclude_if=lambda value: value is None, description='A registered scalar normalizer (``graflo.util.transform.NORMALIZERS``), applied to the whole value and to each part. Without one, values compare after ``coerce_value`` alone.')
class-attribute
instance-attribute
¶
parts = PydanticField(default=None, exclude_if=lambda value: value is None, description='How the value splits into parts; makes ``compatible`` possible.')
class-attribute
instance-attribute
¶
FieldMergeConflict
¶
Bases: Refusal
One property that two declarations describe incompatibly.
The per-property clause and the remedy are kept apart from the rendered
message so :func:union_field_lists can report every conflicting property
under one owner heading instead of one error per run.
field and conflict are the same two facts in structured form: which
property, and whether the disagreement is about types or about units. A
caller classifying the refusal reads those rather than the prose.
origins maps each type label to the declarations that carry it, when
the caller knows them (a merge does; a single model validator does not).
Source code in graflo/architecture/schema/vertex.py
Attributes¶
conflict = _conflict_kind([reason])
instance-attribute
¶
field = field
instance-attribute
¶
origins = {label: tuple(o) for label, o in (origins or {}).items()}
instance-attribute
¶
owner = owner
instance-attribute
¶
reason = reason
instance-attribute
¶
remedy = remedy
instance-attribute
¶
Methods:¶
__init__(owner, reason, remedy, *, field, origins=None)
¶
Source code in graflo/architecture/schema/vertex.py
FieldMergeError
¶
Bases: Refusal
Every property two declarations describe incompatibly, in one refusal.
:func:union_field_lists collects rather than raising on the first clash,
so an author fixing a large merge sees all of them at once. The
individual :class:FieldMergeConflict objects stay on conflicts and
their property names on fields, so a caller can point at what is
wrong without parsing the rendered message.
check follows :func:_conflict_kind over the whole set, which is what
the heading already says -- so a reader of the message and a caller keying
on check are told the same thing, and a mixed set reports as a type
conflict on both.
Source code in graflo/architecture/schema/vertex.py
Attributes¶
conflict = _conflict_kind([c.reason for c in conflicts])
instance-attribute
¶
conflicts = conflicts
instance-attribute
¶
fields = tuple(dict.fromkeys(c.field for c in conflicts))
instance-attribute
¶
owner = owner
instance-attribute
¶
Methods:¶
__init__(message, *, owner, conflicts)
¶
Source code in graflo/architecture/schema/vertex.py
FieldParts
¶
Bases: ConfigBaseModel
How a value splits into parts, and which end of it is the general one.
A less specific form of a value is a run of its parts that keeps the general
end: "Berlin" of "Berlin, pump hall 2" (general_first), "example.com" of
"eu.example.com" (specific_first). unordered parts have no such run:
one value is less specific when its parts are a subset of the other's.
Source code in graflo/architecture/schema/vertex.py
Attributes¶
order = PydanticField(..., description='Which end is the general one: ``general_first``, ``specific_first`` or ``unordered``. Required: no order is assumed.')
class-attribute
instance-attribute
¶
split = PydanticField(..., description='``words`` (whitespace, after the normalizer) or the separators between parts. Required: no separator is assumed.')
class-attribute
instance-attribute
¶
FieldType
¶
Bases: BaseEnum
Supported field types for graph databases.
These types are primarily used for TigerGraph, which requires explicit field types. Other databases (ArangoDB, Neo4j) may use different type systems or not require types.
Attributes:
| Name | Type | Description |
|---|---|---|
INT |
Integer type |
|
UINT |
Unsigned integer type |
|
FLOAT |
Floating point type |
|
DOUBLE |
Double precision floating point type |
|
BOOL |
Boolean type |
|
STRING |
String type |
|
DATETIME |
DateTime type |
|
UUID |
Logical UUID scalar (backends store as STRING/TEXT) |
|
LIST |
Homogeneous list of scalars (requires |
Source code in graflo/architecture/schema/vertex.py
Attributes¶
BOOL = 'BOOL'
class-attribute
instance-attribute
¶
DATETIME = 'DATETIME'
class-attribute
instance-attribute
¶
DOUBLE = 'DOUBLE'
class-attribute
instance-attribute
¶
FLOAT = 'FLOAT'
class-attribute
instance-attribute
¶
INT = 'INT'
class-attribute
instance-attribute
¶
LIST = 'LIST'
class-attribute
instance-attribute
¶
STRING = 'STRING'
class-attribute
instance-attribute
¶
UINT = 'UINT'
class-attribute
instance-attribute
¶
UUID = 'UUID'
class-attribute
instance-attribute
¶
SecondaryIdentity
¶
Bases: ConfigBaseModel
An alternate field-set that identifies a vertex without upserting it.
Vertices upsert on their primary identity. Edge-only sources often
reference endpoints by another field-set — a business key, an ISIN, a
source-local code — which is what a secondary identity names.
Uniqueness is soft: it is not enforced by a database constraint, so a lookup may match several vertices and the ingestion-level ambiguity policy decides what happens.
Examples:
>>> SecondaryIdentity(name="by_isin", fields=["isin"])
>>> SecondaryIdentity.model_validate(["org", "local_code"]) # auto-named
Source code in graflo/architecture/schema/vertex.py
Attributes¶
field_set
property
¶
fields = PydanticField(..., min_length=1, description='Property names forming this alternate key.')
class-attribute
instance-attribute
¶
name = PydanticField(default=None, description='Optional handle used by an edge step to select this field-set (e.g. source_match: by_isin).')
class-attribute
instance-attribute
¶
Methods:¶
dedupe_fields(v)
classmethod
¶
SuperClass
¶
Bases: ConfigBaseModel
A class a vertex type is a subclass of (rdfs:subClassOf).
Either a vertex of the same schema, by name, or a class outside it, by IRI.
A logical assertion: every instance of the subclass is an instance of the
parent. Core checks the hierarchy and computes what it entails
(:mod:graflo.architecture.schema.hierarchy); a subclass inherits no
property, identity or storage from its parent.
Examples:
Source code in graflo/architecture/schema/vertex.py
Vertex
¶
Bases: ConfigBaseModel
Represents a vertex in the graph database.
A vertex is a fundamental unit in the graph that can have properties, identity, and filters. Properties can be specified as strings, Field objects, or dicts. Internally, properties are stored as Field objects but behave like strings where a string-like Field is needed.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Name of the vertex |
properties |
list[Field]
|
List of field names (str), Field objects, or dicts. Will be normalized to Field objects by the validator. |
identity |
list[str]
|
List of property names forming logical primary identity |
filters |
list[FilterExpression]
|
List of filter expressions |
Examples:
>>> # Typed properties: list of Field objects
>>> v2 = Vertex(name="user", properties=[
... Field(name="id", type="INT"),
... Field(name="name", type="STRING")
... ])
>>> # From dicts (e.g., from YAML/JSON)
>>> v3 = Vertex(name="user", properties=[
... {"name": "id", "type": "INT"},
... {"name": "name"} # defaults to None type
... ])
Source code in graflo/architecture/schema/vertex.py
814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 | |
Attributes¶
assigned = PydanticField(default=False, description='True when this vertex uses an intentional UUID primary key: empty identity is filled with uuid4 at assemble time; not a blank-node placeholder.')
class-attribute
instance-attribute
¶
blank = PydanticField(default=False, description='True when this vertex has no natural identity and gets an auto-generated ID.')
class-attribute
instance-attribute
¶
derived_fields
property
¶
Fields core computes from another field, in declared order.
description = PydanticField(default=None, description='Optional semantic description of the vertex meaning, role, and intended interpretation.')
class-attribute
instance-attribute
¶
digest_source_fields
property
¶
Fields feeding the synthetic digest, flat or funnel; empty otherwise.
filters = PydanticField(default_factory=list, description='Filter expressions (logical formulae) applied when querying this vertex.')
class-attribute
instance-attribute
¶
has_identity_funnel
property
¶
True when identity is derived from ordered funnel branches.
hash_identity_properties = PydanticField(default_factory=list, description="Source field names whose combined values are SHA256-hashed to produce a deterministic synthetic 'id'. Non-empty only when no natural key is narrow enough to store directly. Distinct from blank (random UUID).")
class-attribute
instance-attribute
¶
identity = PydanticField(default_factory=list, description='Logical identity property names (primary key semantics for matching/upserts).')
class-attribute
instance-attribute
¶
identity_funnel = PydanticField(default=None, description="Ordered fallback branches deriving a deterministic synthetic 'id'. The first branch whose fields are all present wins. Generalizes hash_identity_properties (the single-branch case); the two are mutually exclusive.")
class-attribute
instance-attribute
¶
identity_mode
property
¶
Runtime identity mode: natural, hash, blank, or assigned UUID PK.
A funnel resolves to hash: both derive a deterministic synthetic key
from source fields and share one writer family. Use
:attr:has_identity_funnel to tell them apart.
model_config = ConfigDict(extra='forbid')
class-attribute
instance-attribute
¶
name = PydanticField(..., description='Name of the vertex type (e.g. user, post, company).')
class-attribute
instance-attribute
¶
properties = PydanticField(default_factory=list, description='List of fields (names, Field objects, or dicts). Normalized to Field objects.')
class-attribute
instance-attribute
¶
property_names
property
¶
Property names as strings (Field.name for each entry).
secondary_identities = PydanticField(default_factory=list, description='Alternate field-sets that identify this vertex for lookup only. Edge endpoints may be matched on one of these instead of the primary identity; upserts always use identity. Soft uniqueness.')
class-attribute
instance-attribute
¶
secondary_identity_names
property
¶
Names of declared secondary identities, in declaration order.
semantics = PydanticField(default=None, description='Optional external-vocabulary anchors for this vertex type.')
class-attribute
instance-attribute
¶
subclass_of = PydanticField(default_factory=list, description='Classes this vertex type is a subclass of (``rdfs:subClassOf``): a vertex of this schema by name, or an external class by IRI. A logical assertion, checked and entailed; nothing is inherited.')
class-attribute
instance-attribute
¶
Methods:¶
convert_hash_identity_properties(v)
classmethod
¶
Source code in graflo/architecture/schema/vertex.py
convert_identity(v)
classmethod
¶
Source code in graflo/architecture/schema/vertex.py
convert_to_expressions(v)
classmethod
¶
Source code in graflo/architecture/schema/vertex.py
convert_to_properties(v)
classmethod
¶
Source code in graflo/architecture/schema/vertex.py
finish_init()
¶
get_properties()
¶
secondary_identity(selector)
¶
Resolve selector to a declared secondary identity.
Accepts a declared name, an explicit field list equal to a declared
field-set, or the literal "secondary" when exactly one is declared.
Source code in graflo/architecture/schema/vertex.py
set_identity()
¶
Source code in graflo/architecture/schema/vertex.py
992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 | |
VertexConfig
¶
Bases: ConfigBaseModel
Configuration for managing vertices.
This class manages vertices, providing methods for accessing and manipulating vertex configurations.
Attributes:
| Name | Type | Description |
|---|---|---|
vertices |
list[Vertex]
|
List of vertex configurations |
force_types |
dict[str, list]
|
Dictionary mapping vertex names to type lists |
Source code in graflo/architecture/schema/vertex.py
1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 | |
Attributes¶
assigned_vertices
property
¶
Vertex names with intentional UUID primary keys (assigned: true).
blank_vertices
property
¶
Vertex names marked blank (no natural identity; auto-generated ID).
force_types = PydanticField(default_factory=dict, description='Override mapping: vertex name -> list of field type names for type inference.')
class-attribute
instance-attribute
¶
hash_identity_vertices
property
¶
Vertex names using digest-derived synthetic identity (flat or funnel).
identity_from_all_properties = PydanticField(default=True, description='When true, vertices without explicit identity fall back to all property names. When false, explicit identity is required except for blank or assigned vertices.')
class-attribute
instance-attribute
¶
identity_funnel_vertices
property
¶
Vertex names whose synthetic identity comes from a funnel.
model_config = ConfigDict(extra='forbid')
class-attribute
instance-attribute
¶
vertex_list
property
¶
Get list of vertex configurations.
Returns:
| Type | Description |
|---|---|
|
list[Vertex]: List of vertex configurations |
vertex_set
property
¶
Get set of vertex names.
Returns:
| Type | Description |
|---|---|
|
set[str]: Set of vertex names |
vertices = PydanticField(..., description='List of vertex type definitions (name, properties, identity, filters).')
class-attribute
instance-attribute
¶
Methods:¶
__getitem__(key)
¶
Get vertex configuration by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
Vertex name |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Vertex |
Vertex configuration |
Raises:
| Type | Description |
|---|---|
KeyError
|
If vertex is not found |
Source code in graflo/architecture/schema/vertex.py
__setitem__(key, value)
¶
Set vertex configuration by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
Vertex name |
required |
value
|
Vertex
|
Vertex configuration |
required |
build_vertices_map()
¶
Source code in graflo/architecture/schema/vertex.py
filters(vertex_name)
¶
Get filter clauses for a vertex.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vertex_name
|
Name of the vertex |
required |
Returns:
| Type | Description |
|---|---|
list[FilterExpression]
|
list[FilterExpression]: List of filter expressions |
Source code in graflo/architecture/schema/vertex.py
finish_init()
¶
has_vertex(name)
¶
identity_fields(vertex_name)
¶
is_assigned(name)
¶
Whether name is in :attr:assigned_vertices, without building the list.
is_blank(name)
¶
Whether name is in :attr:blank_vertices, without building the list.
is_hash_identity(name)
¶
Whether name is in :attr:hash_identity_vertices, without building it.
Source code in graflo/architecture/schema/vertex.py
match_fields(vertex_name, selector)
¶
Fields an edge endpoint is matched on for selector.
None or "identity" selects the primary identity, which keeps
every existing edge step on exactly the path it uses today.
Raises:
| Type | Description |
|---|---|
ValueError
|
if selector names no declared secondary identity. |
Source code in graflo/architecture/schema/vertex.py
numeric_fields_list(vertex_name)
¶
Get list of numeric fields for a vertex.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vertex_name
|
Name of the vertex |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
Tuple of numeric field names |
Raises:
| Type | Description |
|---|---|
ValueError
|
If vertex is not defined in config |
Source code in graflo/architecture/schema/vertex.py
properties(vertex_name)
¶
property_names(vertex_name)
¶
Vertex property names as strings.
remove_vertices(names)
¶
Remove vertices by name.
Removes vertices from the configuration. Mutates the instance in place.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
names
|
set[str]
|
Set of vertex names to remove |
required |
Source code in graflo/architecture/schema/vertex.py
secondary_identities(vertex_name)
¶
Declared secondary identities for a vertex.
secondary_identity_fields(vertex_name, selector)
¶
Resolve an edge-step selector to a secondary identity field-set.
Returns None when selector names no declared secondary identity,
letting callers raise with their own context.
Source code in graflo/architecture/schema/vertex.py
update_vertex(v)
¶
Update vertex configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Vertex
|
Vertex configuration to update |
required |
vertices_by_identity_mode(mode)
¶
Vertex names whose resolved identity mode matches mode.
Functions:¶
field_type_value(ft)
¶
Normalize a FieldType / string / None to an uppercase type string.
Source code in graflo/architecture/schema/vertex.py
format_field_type_label(field)
¶
Human-readable type label, e.g. LIST<STRING>, INT or untyped.
Source code in graflo/architecture/schema/vertex.py
is_list_field_type(ft)
¶
merge_fields(a, b, *, owner, retype_remedy=None)
¶
Merge two same-named fields, refusing a genuine disagreement.
type and item_type are compared and carried as a unit: LIST
is only half a type, so electing a type without the item_type that
came with it yields a field that cannot be constructed. One untyped side
gives way to the other's pair whole; two typed sides that disagree raise,
because widening (INT + FLOAT -> DOUBLE) would elect a type
neither author wrote.
Descriptions from both sides survive and grounding folds through
:func:~graflo.architecture.schema.semantics.merge_field_semantics. Nothing
here is decided by which side was seen first.
owner is a rendered label -- vertex 'party', edge ('order',
'invoice', 'places') -- so a merge kernel keyed by into name and a
model validator keyed by self.name raise the same sentence.
retype_remedy is the fix a type clash suggests; a merge passes its own.
Source code in graflo/architecture/schema/vertex.py
673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 | |
union_field_lists(fields, *, owner, retype_remedy=None)
¶
Fold same-named fields into one, preserving first-declaration order.
Every conflicting property is reported together: merging two large schemas one error per run makes the author re-run the merge to discover the next disagreement, when the merge already knows all of them.