Ich habe folgende Ontologie durch Protege erstellt.OWLAPI: HermiT Reasoner zeigt falsches Ergebnis und KEINE Erklärung
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 -->
Ich möchteEremit reasoner bekommen abgeleitete Klassenhierarchie zusammen mit seiner Erklärung laufen.
Es folgt mein 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();
Mein Ausgang für obigen Code ist:
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. Es gibt keine Erklärungen generiert von HermiT Reasoner. (Alles benötigt, um die Erklärungen zu erhalten?)
Q2. Auch die reasoner gibt einige Fakten/Behauptungen als zur Folge in folgenden Fällen -
1) SubClassOf(<http://www.semanticweb.org/ontologies/reasoner#A> <http://www.semanticweb.org/ontologies/reasoner#B>)
[Eingestellt in Ontology]
2) SubClassOf(<http://www.semanticweb.org/ontologies/reasoner#B> <http://www.semanticweb.org/ontologies/reasoner#C>)
[Eingestellt in Ontology]
Ich will bekommen Daten wie Schützling. Protege zeigt abgeleitete Axiome separat mit ihren Erklärungen. So, wie man sie bekommt?
Erklärung für entailment:
Ich habe die Antwort auf meine erste Frage bekommen. Wie kann ich die Axiome unterscheiden, die es in Ontologie und Axiomen gibt, die der Reasoner mit sich bringt? – SuhasD
Entfernen Sie einfach die Axiome, die in der Ontologie enthalten sind: 'owlOntology.getAxioms()' oder nur für Unterklassenaxiome 'owlOntology.getAxioms (AxiomType.SUBCLASS_OF)' Siehe Javadoc- und OWL-API-Beispiele. – AKSW