rdf-expressionizer
Project description
rdf-expressionizer
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.
Installation
pipx install rdf-expressionizer
rdf-expressionizer --help
Example Workflows
Rewiring an ontology that uses BFO
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
Rewiring an ontology preserving COB subset
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.
Augmenting COB with equivalence axioms
rdf-expressionizer augment -m bfo_xbfo_mappings cob.owl -o cob-augmented.owl
Testing
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
Limitations
- Ontology must be in RDF serialization
- TODO: add options for non RDF/XML serializations
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for rdf_expressionizer-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 276921f9f5a55d9164adae7416f1c00f8f99d79306753d88fb8652663df5522d |
|
MD5 | ca18d1363165065400f3805a074e787a |
|
BLAKE2b-256 | 98048f16faccec119e0f50a86026fa535529827182d26d033403116f8d52fe42 |