Repository navigation
gen-owl rules: deactivated rules emitted; enum values, value_presence, cardinality and has_member mistranslated in rule GCIs #43
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What
owlgen translates each rule into a GCI, (pre and C) SubClassOf post (owlgen.py, add_class). On upstream main 5aa87ad it has five defects:
deactivated: trueis ignored: the output is isomorphic to that of the active rule.- Enum values become literals.
equals_string/equals_string_inon an enum-ranged slot becomes a literalDataOneOf, although the slot is anowl:ObjectPropertyand the permissible values are IRIs (meaning, or the enum IRI plus the PV text). This happens in the defaultowl:Classand inowl:NamedIndividualPV mode. The literal path dates from fix(owlgen): enum range slots with none_of/all_of/any_of - equals_string linkml/linkml#3468. value_presenceis ignored:ABSENTbecomessome, i.e. presence.- Cardinalities and
has_memberinside rule conditions are dropped. The filler falls back todefault_range(xsd:string), even on object properties. - Quantifiers are mixed: top-level conditions use
some, while nested boolean operands useonly, which holds vacuously when the slot is absent.
Reproduction
id: https://example.org/x
name: x
prefixes: {linkml: https://w3id.org/linkml/, ex: https://example.org/}
default_prefix: ex
default_range: string
imports: [linkml:types]
enums:
Color: {permissible_values: {Red: {meaning: ex:Red}, Blue: {meaning: ex:Blue}}}
classes:
T:
attributes: {guard: {}, color: {range: Color}, tags: {multivalued: true}}
rules:
- preconditions: {slot_conditions: {guard: {value_presence: PRESENT}}} # add deactivated: true -> same output
postconditions: {slot_conditions: {color: {equals_string: Red}}}
- preconditions: {slot_conditions: {guard: {value_presence: ABSENT}}}
postconditions: {slot_conditions: {tags: {maximum_cardinality: 1}}}gen-owl --no-metaclasses --no-type-objects schema.yaml gives:
- First rule:
(guard some xsd:string) and T SubClassOf color some DataOneOf("Red"). Hereex:coloris anowl:ObjectPropertyandex:ColorisunionOf(ex:Red ex:Blue). - Second rule:
(guard some xsd:string) and T SubClassOf tags some xsd:string. The ABSENT precondition reads as presence, and the cardinality is gone. - Nested operands: with
any_of: [{slot_conditions: {a: {equals_string_in: [x]}}}, ...]in the precondition, the operands becomea only DataOneOf("x").
References
- OWL 2 Structural Specification §8.2.1:
ObjectSomeValuesFrom( ObjectPropertyExpression ClassExpression ). A data range (§7.4DataOneOf) is not a class expression. - OWL 2 Direct Semantics §2.2: "ΔD is a nonempty set disjoint with ΔI".
- Metamodel
deactivated: "a deactivated rule is not executed by the rules engine".
Proposed fix
- Skip deactivated rules.
- Render enum values with
_permissible_value_uri:- as the class in
owl:Classmode; - as
{ex:Red}/hasValuein individual mode; - as the literal in
rdfs:Literalmode.
- as the class in
- Translate
value_presenceasp some Thing/p max 0. - Translate cardinalities and
has_memberinside rule conditions. - Use one quantifier convention throughout, following Rules: value operators on a multivalued slot in rule conditions mean "every value" in some generators and "some value" in others #41.
Acceptance criteria
- Tests on the generated GCIs for each item, including both PV modes and nested operands.
- A satisfiability check, where an OWL reasoner is available in CI.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
[-]gen-owl rules: deactivated rules emitted; equals_string on an enum with meaning rendered as a literal in the rule GCI[/-][+]gen-owl rules: deactivated rules emitted; enum values, value_presence, cardinality and has_member mistranslated in rule GCIs[/+]