governance: rulebook v1.2 - TN-022 restreint le shortLabel aux cas ou il differe du label, annexe Display exhaustive sur 44 classes ; retrait de la copie dupliquee des shapes
This commit is contained in:
@@ -238,16 +238,22 @@ def migrate(onto, others, spec, rules, report):
|
||||
report.add("isAbstract_declared", 1)
|
||||
|
||||
# 10 — display annotations, from the rulebook annex (TN-022)
|
||||
# The annex is authoritative AND exhaustive: a null value means any existing
|
||||
# annotation is removed. A short label identical to the label carries no
|
||||
# information and is one more thing to keep in step.
|
||||
for d in rules["display"]:
|
||||
term = pr[d["iri"]]
|
||||
for prop, value in ((pr.shortLabel, d.get("short_label")),
|
||||
(pr.acronym, d.get("acronym"))):
|
||||
if not value:
|
||||
continue
|
||||
if (term, prop, Literal(value)) not in onto:
|
||||
current = list(onto.objects(term, prop))
|
||||
if value:
|
||||
if (term, prop, Literal(value)) not in onto:
|
||||
onto.remove((term, prop, None))
|
||||
onto.add((term, prop, Literal(value)))
|
||||
report.add("display_set", 1)
|
||||
elif current:
|
||||
onto.remove((term, prop, None))
|
||||
onto.add((term, prop, Literal(value)))
|
||||
report.add("display_set", 1)
|
||||
report.add("display_removed", len(current))
|
||||
|
||||
# 11 — regenerate every label by derivation (TN-018, TN-023)
|
||||
kinds = (OWL.Class, OWL.ObjectProperty, OWL.DatatypeProperty, OWL.AnnotationProperty)
|
||||
|
||||
Reference in New Issue
Block a user