graflo.architecture.evolution.merge¶
Binary merge of two :class:~graflo.architecture.contract.manifest.GraphManifests.
Attributes¶
logger = logging.getLogger(__name__)
module-attribute
¶
Classes¶
MergeIdentityError
¶
Bases: Refusal
A merged vertex's identity is ambiguous and nothing resolves it.
Two or more cluster members disagree on their (canonical-name) identity
field-set and none of the three ways to resolve it were declared: an
explicit identity on the VertexEquivalence, a
PropertyEquivalence(identity=True) flag, or an identity_alignments
entry for the merged class. The alternative -- silently taking the
union of both field-sets as the new identity -- produces a natural key no
record fully carries.
subjects names the merged class and its disagreeing members, as
:func:~graflo.architecture.evolution.equivalence.subject ids; it does not
appear in the message.
Source code in graflo/architecture/evolution/merge.py
Methods:¶
__init__(message, *, check='', subjects=())
¶
Source code in graflo/architecture/evolution/merge.py
MergeNameConflictError
¶
Bases: Refusal
Two names denote one concept under different naming conventions.
Distinct from MergeCanonicalConflictError in canonical.py, which
reports a declared CanonicalMap contradicting the op. This one fires on
the residue neither side declared -- the undeclared path, where merge
would otherwise produce two unrelated types with the data split between
them and nothing raising.
check names the rule that refused and subjects the names it is
about, as :func:~graflo.architecture.evolution.equivalence.subject ids;
see :class:.Refusal.
Source code in graflo/architecture/evolution/merge.py
Functions:¶
merge_manifests(left, right, op, *, bump_version='minor', finish_init=True, strict_references=False, dynamic_edge_feedback=False, canonical_maps=())
¶
Return a new manifest that is the deterministic merge of left and right.
The declared clusters (each a :class:~graflo.architecture.evolution.ops.VertexEquivalence
or :class:~graflo.architecture.evolution.ops.RelationEquivalence, possibly
n-ary) and op.canonical_maps are resolved together into one composite
:class:~graflo.architecture.evolution.ops.CanonicalizeOp per side
(see :func:~graflo.architecture.evolution.canonical.resolve_clusters),
applied to that side in one step, before the two sides are unioned by
name. Does not invent semantic matches: a name both sides carry and no
cluster merges is refused under name_conflict="error" (naming the
equivalences to declare), synthesized into a 1-1 cluster under
union_right so it reconciles exactly as a declared one, and kept apart
under prefix_right.
When op.identity_alignments is non-empty, the merged union is further
rewritten by the fundamental ops emitted from each alignment (see
:func:~graflo.architecture.evolution.alignment.alignment_to_ops);
member-keyed sources are resolved against the sides as handed in.
canonical_maps — (side, CanonicalMap) pairs — are folded into
op.canonical_maps; putting the maps on the op itself keeps the whole
recipe in one document.
Source code in graflo/architecture/evolution/merge.py
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 1259 1260 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 | |
side_identity_to_funnel(cluster, member_property_names)
¶
Lower a :class:~graflo.architecture.evolution.ops.SideIdentity shorthand.
Each member supplies an ordered branch chain (its own override, or the
side default); the chains are merged into one global branch order by
topological sort over the "comes before" relation each chain implies,
breaking ties by first appearance across members (in declaration order:
every left member, then every right member). Two members that disagree on
the relative order of two branches have no consistent global order and
raise :class:MergeIdentityError.
Source code in graflo/architecture/evolution/merge.py
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 | |