Translates named classes to equivalent class expressions.
The primary use case for this is rewiring ontologies that use upper ontologies such as BFO, preserving semantic entailment, and hiding upper ontology classes in an orthogonal hierarchy.
pipx install rdf-expressionizer
rdf-expressionizer --help
rdf-expressionizer replace -m bfo_xbfo_mappings ro.owl -o ro-rewired.owl
Note that the semantics of axioms are preserved, but structurally rewritten.
For example, the following axiom:
- occurs in Domain occurrent nature
Is rewritten to:
- occurs in Domain has characteristic some occurrent nature
TODO: decide on which ObjectProperty to use for bfo_xbfo_mappings
Note the resulting ontology has dangling flat label-less classes. These are semantically correct, but to give them labels and hierarchy, merge with XBFO.
robot merge -i ro-rewired.owl -i src/rdf-expressionizer/xbfo.owl -o ro-rewired-pretty.owl
rdf-expressionizer replace -x COB -m bfo_xbfo_mappings ro.owl -o ro-rewired.owl
This excludes (-x
or --exclude-subset
) the COB subset of BFO from the rewiring.
rdf-expressionizer augment -m bfo_xbfo_mappings cob.owl -o cob-augmented.owl
git clone <this repo>
poetry install
make test
This runs internal unit tests, and additional tests.
One of the tests does the following:
- injects an invalid axiom into RO
Cell occurs-in some 'Multi-cellular organism'
- this axiom is designed to cause incoherency when combined with upper level BFO disjointness axioms
- creates a rewired version of RO
- runs
robot explain
- checks the intended unsatisfiable axiom is detected
-
- cell SubClassOf anatomical structure
- anatomical structure SubClassOf material anatomical entity
- material anatomical entity SubClassOf anatomical entity
- anatomical entity SubClassOf has characteristic some independent continuant nature
- independent continuant nature SubClassOf continuant nature
- anatomical entity SubClassOf has characteristic some independent continuant nature
- material anatomical entity SubClassOf anatomical entity
- anatomical structure SubClassOf material anatomical entity
- cell SubClassOf occurs in some multicellular anatomical structure
- occurs in Domain has characteristic some occurrent nature
- has characteristic some continuant nature DisjointWith has characteristic some occurrent nature
- cell SubClassOf anatomical structure
- Ontology must be in RDF serialization
- TODO: add options for non RDF/XML serializations