I have following ontology created through Protege.
Ontology :
<?xml version="1.0"?>
<!DOCTYPE rdf:RDF [
<!ENTITY owl "http://www.w3.org/2002/07/owl#" >
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
]>
<rdf:RDF xmlns="http://www.semanticweb.org/ontologies/reasoner#"
xml:base="http://www.semanticweb.org/ontologies/reasoner"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<owl:Ontology rdf:about="http://www.semanticweb.org/ontologies/reasoner"/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Object Properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/ontologies/reasoner#myProp -->
<owl:ObjectProperty rdf:about="http://www.semanticweb.org/ontologies/reasoner#myProp"/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Classes
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/ontologies/reasoner#A -->
<owl:Class rdf:about="http://www.semanticweb.org/ontologies/reasoner#A">
<rdfs:subClassOf rdf:resource="http://www.semanticweb.org/ontologies/reasoner#B"/>
</owl:Class>
<!-- http://www.semanticweb.org/ontologies/reasoner#B -->
<owl:Class rdf:about="http://www.semanticweb.org/ontologies/reasoner#B">
<rdfs:subClassOf rdf:resource="http://www.semanticweb.org/ontologies/reasoner#C"/>
<rdfs:subClassOf>
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
<rdf:Description rdf:about="http://www.semanticweb.org/ontologies/reasoner#D"/>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.semanticweb.org/ontologies/reasoner#myProp"/>
<owl:someValuesFrom rdf:resource="http://www.semanticweb.org/ontologies/reasoner#A"/>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
</rdfs:subClassOf>
</owl:Class>
<!-- http://www.semanticweb.org/ontologies/reasoner#C -->
<owl:Class rdf:about="http://www.semanticweb.org/ontologies/reasoner#C">
<owl:equivalentClass rdf:resource="http://www.semanticweb.org/ontologies/reasoner#D"/>
</owl:Class>
<!-- http://www.semanticweb.org/ontologies/reasoner#D -->
<owl:Class rdf:about="http://www.semanticweb.org/ontologies/reasoner#D"/>
</rdf:RDF>
<!-- Generated by the OWL API (version 3.5.1) http://owlapi.sourceforge.net -->
I want to run HermiT reasoner to get inferred class hierarchy along with its explanation.
Following is my JAVA code :
//Some work done before to load the ontology into OWLOntologyManager
Configuration reasonerConf = new Configuration();
reasonerConf.throwInconsistentOntologyException = false;
ReasonerFactory factory = new ReasonerFactory();
OWLReasoner reasoner = factory.createReasoner(owlOntology, reasonerConf); // owlOntology : Current working Ontology
BlackBoxExplanation exp = new BlackBoxExplanation(owlOntology, factory, reasoner);
HSTExplanationGenerator multExplanator = new HSTExplanationGenerator(exp);
InferredSubClassAxiomGenerator ge = new InferredSubClassAxiomGenerator();
Set<OWLSubClassOfAxiom> subss = ge.createAxioms(dataFactory, reasoner); // dataFactory : OWLDataFactory
System.out.println("\nSubClassAxiom in reasoner :- ");
for (OWLSubClassOfAxiom ax : subss) {
System.out.println("\nAxiom :- " + ax);
System.out.println(ax.getSuperClass());
System.out.println(ax.getSubClass());
System.out.println("Is Axiom Entailed ? :- " + reasoner.isEntailed(ax));
Set<Set<OWLAxiom>> expl = multExplanator.getExplanations(ax.getSuperClass());
System.out.println("Explanation Set size :- " + expl.size());
}
reasoner.dispose();
My output for above code is :
SubClassAxiom in reasoner :-
Axiom :- SubClassOf(<http://www.semanticweb.org/ontologies/reasoner#C> owl:Thing)
owl:Thing
<http://www.semanticweb.org/ontologies/reasoner#C>
Is Axiom Entailed ? :- true
Explanation Set size :- 0
Axiom :- SubClassOf(<http://www.semanticweb.org/ontologies/reasoner#B> <http://www.semanticweb.org/ontologies/reasoner#C>)
<http://www.semanticweb.org/ontologies/reasoner#C>
<http://www.semanticweb.org/ontologies/reasoner#B>
Is Axiom Entailed ? :- true
Explanation Set size :- 0
Axiom :- SubClassOf(<http://www.semanticweb.org/ontologies/reasoner#B> <http://www.semanticweb.org/ontologies/reasoner#D>)
<http://www.semanticweb.org/ontologies/reasoner#D>
<http://www.semanticweb.org/ontologies/reasoner#B>
Is Axiom Entailed ? :- true
Explanation Set size :- 0
Axiom :- SubClassOf(<http://www.semanticweb.org/ontologies/reasoner#D> owl:Thing)
owl:Thing
<http://www.semanticweb.org/ontologies/reasoner#D>
Is Axiom Entailed ? :- true
Explanation Set size :- 0
Axiom :- SubClassOf(<http://www.semanticweb.org/ontologies/reasoner#A> <http://www.semanticweb.org/ontologies/reasoner#B>)
<http://www.semanticweb.org/ontologies/reasoner#B>
<http://www.semanticweb.org/ontologies/reasoner#A>
Is Axiom Entailed ? :- true
Explanation Set size :- 0
Q1 . There are no explanations generated by HermiT reasoner. (Anything needed to get the explanations ?)
Q2 . Also the reasoner gives some facts/assertions as Entailed in following cases -
1) SubClassOf(<http://www.semanticweb.org/ontologies/reasoner#A> <http://www.semanticweb.org/ontologies/reasoner#B>)
[Provided in Ontology]
2) SubClassOf(<http://www.semanticweb.org/ontologies/reasoner#B> <http://www.semanticweb.org/ontologies/reasoner#C>)
[Provided in Ontology]
I want to get data just like protege. Protege shows inferred axioms separately along with their explanations. So how to get them ? (I have added some screen shots of protege for reference)
My Ontology:
Explanation for entailment: