instances: alignement BR-013 de SODH, migration v1.1 terminee. 10 metriques meres, 132 data elements dont 95 computedBy et 37 represents, 15 concepts, 12 business objects. Grain sur les 4 dimensions seulement, celui des faits restant porte par references. Validation SHACL conforme, zero violation. Scripts rendus idempotents : des blocs dupliques sont invisibles a SHACL car les triplets identiques fusionnent

This commit is contained in:
Bastien Gourdon
2026-07-27 20:53:21 +02:00
parent c8693b63bb
commit 45ca9ffb68
4 changed files with 1662 additions and 355 deletions
+17 -6
View File
@@ -204,27 +204,38 @@ def main():
" renamed=%s" % newname if newname else ""))
# ---- 3. insert the missing concepts --------------------------------------
# idempotent: identical duplicated blocks merge in RDF, so SHACL would
# never flag them -- the file grows while the graph stays valid.
todo_c = [c for c in NEW_CONCEPTS
if not re.search(r'^%s a ' % re.escape(c[0]), text, re.M)]
anchor = re.search(r'\n(?=ex:BO_\w+ a pr:BusinessObject ;)', text)
if anchor:
blocks = "\n".join(concept_block(*c) for c in NEW_CONCEPTS)
if anchor and todo_c:
blocks = "\n".join(concept_block(*c) for c in todo_c)
text = (text[:anchor.start()] + "\n\n" +
"# --- concepts added in v1.1 migration -------------------------------\n" +
"# Six of these belong to other domains: DRAFT definitions proposed by the\n" +
"# DGO, flagged TO_ARBITRATE. OW-007 blocks publication until ratified.\n" +
blocks + "\n" + text[anchor.start():])
report.append("inserted %d Business Concepts (%d TO_ARBITRATE)"
% (len(NEW_CONCEPTS), sum(1 for c in NEW_CONCEPTS if c[6])))
% (len(todo_c), sum(1 for c in todo_c if c[6])))
elif not todo_c:
report.append("all %d Business Concepts already present, skipped"
% len(NEW_CONCEPTS))
# ---- 4. append the objects produced by the splits ------------------------
todo_o = [o for o in NEW_OBJECTS
if not re.search(r'^%s a ' % re.escape(o[0]), text, re.M)]
tail = re.search(r'\n(?=ex:M_\w+ a pr:Metric ;|ex:DO_\w+ a pr:DataObject ;)', text)
if tail:
blocks = "\n".join(object_block(*o) for o in NEW_OBJECTS)
if tail and todo_o:
blocks = "\n".join(object_block(*o) for o in todo_o)
text = (text[:tail.start()] + "\n\n" +
"# --- Business Objects from the v1.1 splits ---------------------------\n" +
"# 'Customer & Outlet' and 'Currency & Exchange Rates' had no single\n" +
"# subject. Split proposed to DD-04 and DD-16, hence TO_ARBITRATE.\n" +
blocks + "\n" + text[tail.start():])
report.append("inserted %d Business Objects from splits" % len(NEW_OBJECTS))
report.append("inserted %d Business Objects from splits" % len(todo_o))
elif not todo_o:
report.append("Business Objects from splits already present, skipped")
# ---- report --------------------------------------------------------------
print()