graflo.architecture.evolution.apply¶
Apply manifest evolution operations to a copy of a :class:~graflo.architecture.contract.manifest.GraphManifest.
Attributes¶
logger = logging.getLogger(__name__)
module-attribute
¶
Classes¶
Functions:¶
apply_add_edge_properties(manifest, op)
¶
Append new edge properties to existing relations or edge triples.
Source code in graflo/architecture/evolution/apply.py
apply_add_inverse_edges(manifest, op)
¶
Realize declared inverses as explicit edges across schema, profile and ingestion.
Source code in graflo/architecture/evolution/apply.py
apply_add_vertex_properties(manifest, op)
¶
Append new vertex properties to existing vertices.
Source code in graflo/architecture/evolution/apply.py
apply_canonicalize(manifest, op)
¶
Mutate manifest in place: relabel by op's vocabulary map in one step.
Every refusal — unknown names, an undeclared occupied target, an attribute collision, an unacknowledged self-relation or observation fusion — leaves manifest untouched: the work happens on a copy that is swapped in only once it is accepted.
Source code in graflo/architecture/evolution/apply.py
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 | |
apply_declare_edge_inverses(manifest, op)
¶
Record inverse pairs and symmetric relations; creates no edge.
Restating a declaration, in either order, is a no-op; giving a relation a second inverse is refused by the one table rule.
Source code in graflo/architecture/evolution/apply.py
apply_evolution(manifest, ops, *, bump_version='minor', finish_init=True, strict_references=False, dynamic_edge_feedback=False)
¶
Return a deep copy of manifest with ops applied and optionally re-initialized.
Compare before/after contract identity with :func:graflo.migrate.io.manifest_hash
(stable hash over schema, ingestion_model, and bindings blocks).
MergeManifestsOp is rejected at dispatch — use
:func:~graflo.architecture.evolution.merge.merge_manifests instead.
Source code in graflo/architecture/evolution/apply.py
apply_manifest_ops_inplace(manifest, ops)
¶
Apply each evolution op to manifest in place.
Does not copy the manifest, bump schema version, or call :meth:GraphManifest.finish_init.
Callers that need re-validation after mutation should invoke finish_init themselves.
MergeManifestsOp is rejected at dispatch — use
:func:~graflo.architecture.evolution.merge.merge_manifests instead.
Source code in graflo/architecture/evolution/apply.py
apply_merge_edges(manifest, op)
¶
Merge edge relation names into one canonical relation.
Source code in graflo/architecture/evolution/apply.py
apply_merge_vertices(manifest, op)
¶
Mutate manifest in place: merge source vertices into into.
Source code in graflo/architecture/evolution/apply.py
apply_project_manifest(manifest, op)
¶
Project manifest to surviving vertices/edges with consistent cascade.
A resource the cascade shortened is kept trimmed, with a warning naming it,
or dropped under partial_resources="drop".
Source code in graflo/architecture/evolution/apply.py
apply_remove_edge_ids(manifest, removed_edge_ids)
¶
Remove edges by logical triple and prune related references.
Source code in graflo/architecture/evolution/apply.py
1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 | |
apply_remove_edge_properties(manifest, op)
¶
Remove edge properties by relation or by triple and clean references.
Source code in graflo/architecture/evolution/apply.py
apply_remove_edges(manifest, op)
¶
Remove edges by relation name and/or by triple, pruning related references.
Source code in graflo/architecture/evolution/apply.py
1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 | |
apply_remove_vertex_properties(manifest, op)
¶
Remove vertex properties and clean up ingestion/db profile references.
Source code in graflo/architecture/evolution/apply.py
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 | |
apply_remove_vertices(manifest, op)
¶
Mutate manifest in place: cascade-remove vertices (schema, ingestion, bindings).
Source code in graflo/architecture/evolution/apply.py
apply_rename_edge_properties(manifest, op)
¶
Rename edge properties by relation or by triple and propagate references.
Source code in graflo/architecture/evolution/apply.py
apply_rename_relations(manifest, op)
¶
Rename logical relation names across schema/ingestion/db profile.
Source code in graflo/architecture/evolution/apply.py
apply_rename_resources(manifest, op)
¶
Rename ingestion resources and bindings references.
Source code in graflo/architecture/evolution/apply.py
apply_rename_vertex_properties(manifest, op)
¶
Rename vertex properties (and their references) across the manifest.
Mutates manifest in place:
- Rewrites schema
Field.nameandvertex.identity. - Rewrites :class:
DatabaseProfilefield references (vertex_indexes, edge_specs.indexes, default_property_values). - Rewrites resource pipelines so that
VertexActor.fromcovers the rename andTransformActor.renameproduces the renamed property (see :func:rewrite_vertex_field_names_in_pipeline). - Rewrites
Resource.extra_weights/vertex_weights(and anyvertex_weightsembedded inedgepipeline steps).
Source code in graflo/architecture/evolution/apply.py
apply_rename_vertices(manifest, op)
¶
Rename logical vertex names across schema/ingestion/bindings.
Source code in graflo/architecture/evolution/apply.py
apply_retract_edge_inverses(manifest, op)
¶
Withdraw declarations by relation name; refused while a native inverse realizes one.
Source code in graflo/architecture/evolution/apply.py
apply_sanitize(manifest, op)
¶
Record the target flavor's physical names in the profile, in place.
Only schema.db_profile changes: vertex storage names, relation names
and vertex/edge property names the flavor cannot store get a stored name
there (see :func:~graflo.architecture.evolution.sanitize.assign_physical_names).
The logical schema and the ingestion model are untouched, so documents keep
their logical keys and the writer translates them at the database call.
Source code in graflo/architecture/evolution/apply.py
merge_fused_slots(resources, *, merged, mapping)
¶
Accumulator slots of the pre-merge resources where merged would fuse two members.
One source document then yields two members that land in one slot, and assembly folds them into a single node.
Source code in graflo/architecture/evolution/apply.py
merge_self_relations(edges, mapping)
¶
Edges between two distinct vertices that mapping sends to one name.
edges are the pre-merge schema edges. Each such edge becomes an edge from the merged vertex to itself.
Source code in graflo/architecture/evolution/apply.py
prune_bindings_for_resources(manifest, surviving)
¶
Drop the bindings that served only resources outside surviving, in place.
resource_connector rows keep only surviving resources. A connector bound
to resources (by resource_name or by a row) and to none that survives is
dropped with its connector_connection rows; a connector shared with a
surviving resource, or bound to no resource at all, stays.
Source code in graflo/architecture/evolution/apply.py
prune_connectors_for_removed_vertices(manifest, removed, *, declared)
¶
Drop what the bindings fetch only for classes in removed, in place.
Runs before the resources are trimmed. Each request a connector makes puts
constants on its rows (:meth:ResourceConnector.row_constants); routed
through the pipeline of every resource the connector is bound to, they
reach some classes of declared. A request is dead when it reached some
class and every class it reached, in every bound resource, is removed. An
enumerated connector loses each value all of whose requests are dead, and
is dropped when a variable has no value left; any other connector is
dropped when its request is dead. A connector bound to no resource, or
named as another connector's parent, is left alone.
Source code in graflo/architecture/evolution/apply.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 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 | |
relabel_vertex_fields(vertex, renames)
¶
One vertex with its attribute names rewritten, as a new validated model.
Every field-set that names a property follows the rename: properties,
identity, hash_identity_properties, each funnel branch's fields
and when_all_present, each secondary identity's fields, and the
leaf fields of filters.
A property whose new name is already taken is dropped, not appended.
That is not a shortcut -- _check_property_renames has already refused a
genuine rename collision by then, naming it as one. Appending instead would
hand :meth:Vertex.set_identity two fields of one name, and the
union_field_lists it runs would report a type conflict for what is
really a collision, misclassified and wrapped by pydantic besides.
Pure: the argument is untouched, and the result is built in one
model_validate rather than by assignment, so there is no intermediate
state in which validate_assignment can re-add a stale pre-rename name
as an untyped ghost property.
Source code in graflo/architecture/evolution/apply.py
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 | |