2016-07-29 8 views
2

erhalten Ich möchte abgeleitete Axiome von Reasoner [HermiT] zusammen mit seiner richtigen Erklärung erhalten. Ich habe folgende Ontologie in Protege erstellt.OWLAPI: Wollen abgeleitete Axiome aus Ontologie mit HermiT Reasoner

A.owl

<?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/A#" 
    xml:base="http://www.semanticweb.org/ontologies/A" 
    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/A"/> 
    <!-- 
    /////////////////////////////////////////////////////////////////////////////////////// 
    // 
    // Classes 
    // 
    /////////////////////////////////////////////////////////////////////////////////////// 
    --> 
    <!-- http://www.semanticweb.org/ontologies/A#A --> 
    <owl:Class rdf:about="http://www.semanticweb.org/ontologies/A#A"> 
     <rdfs:subClassOf rdf:resource="http://www.semanticweb.org/ontologies/A#B"/> 
    </owl:Class> 
    <!-- http://www.semanticweb.org/ontologies/A#B --> 
    <owl:Class rdf:about="http://www.semanticweb.org/ontologies/A#B"> 
     <owl:equivalentClass rdf:resource="http://www.semanticweb.org/ontologies/A#C"/> 
    </owl:Class> 
    <!-- http://www.semanticweb.org/ontologies/A#C --> 
    <owl:Class rdf:about="http://www.semanticweb.org/ontologies/A#C"/> 
</rdf:RDF> 
<!-- Generated by the OWL API (version 3.5.1) http://owlapi.sourceforge.net --> 

Es folgt mein Java-Code: -

//Some work done to load ontology 
ReasonerFactory factory = new ReasonerFactory(); 
Reasoner reasoner = new Reasoner(reasonerConf, owlOntology); 
BlackBoxExplanation explain = new BlackBoxExplanation(owlOntology, factory, reasoner); 
HSTExplanationGenerator multiEx = new HSTExplanationGenerator(explain); 
InferredSubClassAxiomGenerator gen = new InferredSubClassAxiomGenerator(); 
Set<OWLSubClassOfAxiom> subClass = gen.createAxioms(dataFactory, reasoner); 
SatisfiabilityConverter converter = new SatisfiabilityConverter(dataFactory); 
for (OWLSubClassOfAxiom ax : subClass) { 
    System.out.println("\nAxiom :- " + ax); 
    System.out.println("Is axiom entailed by reasoner ? :- " + reasoner.isEntailed(ax)); 
    System.out.println("Is axiom contained in ontology ? :- " + owlOntology.containsAxiom(ax)); 
    Set<Set<OWLAxiom>> expl = multiEx.getExplanations(converter.convert(ax)); 
    System.out.println("No. of Explanations :- " + expl.size()); 
    System.out.println("Explanation :- "); 
    for (Set<OWLAxiom> a : expl) { 
     System.out.println(a); 
    } 
} 

Nach hier mein Code ist die Ausgang: -

Axiom :- SubClassOf(<http://www.semanticweb.org/ontologies/A#B> owl:Thing) 
Is axiom entailed by reasoner ? :- true 
Is axiom contained in ontology ? :- false 
No. of Explanations :- 1 
Explanation :- 
[EquivalentClasses(<http://www.semanticweb.org/ontologies/A#B> <http://www.semanticweb.org/ontologies/A#C>)] 

Axiom :- SubClassOf(<http://www.semanticweb.org/ontologies/A#C> owl:Thing) 
Is axiom entailed by reasoner ? :- true 
Is axiom contained in ontology ? :- false 
No. of Explanations :- 1 
Explanation :- 
[EquivalentClasses(<http://www.semanticweb.org/ontologies/A#B> <http://www.semanticweb.org/ontologies/A#C>)] 

Axiom :- SubClassOf(<http://www.semanticweb.org/ontologies/A#A> <http://www.semanticweb.org/ontologies/A#B>) 
Is axiom entailed by reasoner ? :- true 
Is axiom contained in ontology ? :- true 
No. of Explanations :- 1 
Explanation :- 
[SubClassOf(<http://www.semanticweb.org/ontologies/A#A> <http://www.semanticweb.org/ontologies/A#B>)] 

Axiom :- SubClassOf(<http://www.semanticweb.org/ontologies/A#A> <http://www.semanticweb.org/ontologies/A#C>) 
Is axiom entailed by reasoner ? :- true 
Is axiom contained in ontology ? :- false 
No. of Explanations :- 1 
Explanation :- 
[EquivalentClasses(<http://www.semanticweb.org/ontologies/A#B> <http://www.semanticweb.org/ontologies/A#C>), SubClassOf(<http://www.semanticweb.org/ontologies/A#A> <http://www.semanticweb.org/ontologies/A#B>)] 

Ich habe folgende Fragen:

1) Reicht dieser Code aus, um abgeleitete Axiome zu erhalten? (Wie kann ich überprüfen, ob neue Axiom innerhalb ursprünglichen Ontologie zur Verfügung steht, wenn kein dann seine eine abgeleitete Axiom - [Axiome Achten Sie darauf, sagen C SubClassOf owl:Thing])

2) Was ist die Verwendung von isEntailed() Methode des reasoner wenn sein giving true immer?

3) Es gibt immer eine Erklärung für das abgeleitete Axiom. Ist es richtig ? Für abgeleitete Axiom A SubClassOf C, hat 1 Erklärung, aber seine Set ist entgegengesetzt (Reihenfolge-weise) von dem, was in Protege gezeigt hat. Also muss ich es immer in umgekehrter Richtung zeigen?

Protege Bild: -

Explanation of <code>A SubClassOf C</code>

Antwort

2

1) Ja, es ist ausreichend - ein Axiom, dass und in der Ontologie zur Folge ist in der Regel 'behauptet' genannt wird.

2) isEntailed() gibt nicht immer True zurück. Es tut für die Axiome, die Sie verwenden - versuchen Sie zu fragen, ob Eule: Ding ist Unterklasse, wenn Eule: Nichts.

3) es gibt mindestens eine Erklärung für ein damit verbundenes Axiom. Wenn das Axiom in der Ontologie enthalten ist, ist es die triviale Erklärung - alle enthaltenen Axiome sind miteinbezogen. Für komplexere Fälle sind mehrere Erklärungen möglich.

+0

wie die Erklärungshierarchie wie in Protege dargestellt zu bilden? – SuhasD

+0

Der beste Weg ist es, so wie es protégé tut, der Code ist alles Open Source. Die WorkbenchPanel-Klasse sieht wie ein guter Ausgangspunkt aus. – Ignazio