You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's the code; mOWL is used for loading the ontology small_ontology.owl containing the axiom, the code is written in Python and utilizes JPype to access Java:
from de.tudresden.inf.lat.jcel.ontology.normalization import OntologyNormalizer, SimpleNormalizer
from de.tudresden.inf.lat.jcel.ontology.axiom.extension import IntegerOntologyObjectFactoryImpl
from de.tudresden.inf.lat.jcel.owlapi.translator import ReverseAxiomTranslator, Translator
from de.tudresden.inf.lat.jcel.ontology.axiom.complex import IntegerInverseObjectPropertiesAxiom
from de.tudresden.inf.lat.jcel.coreontology.axiom import NormalizedIntegerAxiom
from org.semanticweb.owlapi.model.parameters import Imports
from java.util import HashSet
import logging
logging.basicConfig(level=logging.INFO)
from mowl.owlapi import OWLAPIAdapter
from mowl.datasets import PathDataset
small_ontology = PathDataset("small_ontology.owl").ontology
translator = Translator(small_ontology.getOWLOntologyManager().getOWLDataFactory(), IntegerOntologyObjectFactoryImpl())
small_axioms = HashSet()
small_axioms.addAll(small_ontology.getAxioms())
translator.getTranslationRepository().addAxiomEntities(small_ontology)
for o in small_ontology.getImportsClosure():
small_axioms.addAll(o.getAxioms())
translator.getTranslationRepository().addAxiomEntities(o)
intAxioms = translator.translateSA(small_axioms)
factory = IntegerOntologyObjectFactoryImpl()
n = SimpleNormalizer(factory)
objectPropIdSet = HashSet()
currentAxiomSet = HashSet()
for ax in intAxioms:
objectPropIdSet.addAll(ax.getObjectPropertiesInSignature())
if isinstance(ax, IntegerInverseObjectPropertiesAxiom):
newSet = n.normalize(axiom)
currentAxiomSet.addAll(newSet)
else:
currentAxiomSet.add(ax)
for propId in list(objectPropIdSet):
inversePropId = factory.getEntityManager().createOrGetInverseObjectPropertyOf(propId)
currentAxiomSet.addAll(n.getAxiomsForInverseObjectProperties(propId, inversePropId))
ret = HashSet()
while currentAxiomSet.size() > 0:
nextAxiomSet = HashSet()
for axiom in list(currentAxiomSet):
if isinstance(axiom, NormalizedIntegerAxiom):
ret.add(axiom)
else:
newSet = n.normalize(axiom)
nextAxiomSet.addAll(newSet)
currentAxiomSet = nextAxiomSet
The integer-encoded normalized set of axioms is as follows:
rTranslator = ReverseAxiomTranslator(translator, small_ontology)
for ax in list(ret):
try:
axiom = rTranslator.visit(ax)
key, value = process_axiom(axiom)
print(str(value.owl_axiom))
except Exception as e:
logging.info("Reverse translation. Ignoring axiom: %s", ax)
logging.info(e)
the output is as follows:
INFO:root:Reverse translation. Ignoring axiom: SubClassOf*(ObjectIntersectionOf(8 11) 10)
INFO:root:de.tudresden.inf.lat.jcel.owlapi.translator.TranslationException: The translation map is incomplete. Item id was not found: '11'.
INFO:root:Reverse translation. Ignoring axiom: SubClassOf*(ObjectSomeValuesFrom(10 10) 8)
INFO:root:de.tudresden.inf.lat.jcel.owlapi.translator.TranslationException: The translation map is incomplete. Item id was not found: '10'.
INFO:root:Reverse translation. Ignoring axiom: SubClassOf*(ObjectSomeValuesFrom(11 9) 11)
INFO:root:de.tudresden.inf.lat.jcel.owlapi.translator.TranslationException: The translation map is incomplete. Item id was not found: '11'.
SubClassOf(<D> <C>)
SubClassOf(<A> ObjectSomeValuesFrom(<r> <D>))
SubClassOf(<D> ObjectSomeValuesFrom(<s> <D>))
SubClassOf(ObjectIntersectionOf(<B> <C>) <A>)
SubClassOf(<A> <B>)
whereas according to normalization rules described here (table 4.2) the output should look similar to this:
Hello. I tried to normalize the following axiom:
EquivalentClasses(<A> ObjectIntersectionOf(<B> ObjectSomeValuesFrom(<r> ObjectIntersectionOf(<C> ObjectSomeValuesFrom(<s> <D>)))))
The axiom was saved in small_ontology.owl file, the list of axioms is as follows:
Here's the code; mOWL is used for loading the ontology small_ontology.owl containing the axiom, the code is written in Python and utilizes JPype to access Java:
The integer-encoded normalized set of axioms is as follows:
After reverse translation
the output is as follows:
whereas according to normalization rules described here (table 4.2) the output should look similar to this:
where
A1, B1, C1, D1
are fresh concept names.The text was updated successfully, but these errors were encountered: