2016-05-26 30 views
1

說,我在門徒創造了一些本體論和存在的一些對象屬性的類的實例,和對象屬性的列表,顯示在下面的圖片:獲取推斷對象屬性斷言山人裏森納

An individual of the class Device, "Email_Server", with the object property "realizes"

對象屬性的層次結構是如下所示:

Object Property Hierarchy

現在,當我打開裏森納(隱士),得到以下斷言對象PR

Inferred Object Properties for the individual Email_server

當我的推斷對象屬性「dependsUp」顧客解釋點擊,我得到:此同一個人operties

Explanation for the inferred Object Property "dependsUp" customer

我的問題是如何產生這使用Java?我已經可以得到一些個人與以下推斷對象的屬性(不完全這裏abreviety,但它的作品,因爲我已經測試):

for (OWLNamedIndividual namedIndividual : this.ontology.getIndividualsInSignature()) { 
      if (subjectName.equals(namedIndividual.getIRI().getFragment())) { 
       OWLObjectProperty objectProperty = fac.getOWLObjectProperty(IRI.create(propertyIRI)); 
       NodeSet<OWLNamedIndividual> namedIndividualSet = reasoner.getObjectPropertyValues(namedIndividual ,objectProperty); 

       for (Node<OWLNamedIndividual> namedIndividualsInObjectPropertySet : namedIndividualSet) { 
        for (OWLNamedIndividual namedIndividualForObjectPropertySet : namedIndividualsInObjectPropertySet) { 
         for (OWLClassExpression owlClass : namedIndividualForObjectPropertySet.getTypes(this.ontology)){ 
          if (owlClass.toString().split("#")[1].replace(">", "").equals(archiClass)) { 
           result.add(OWLOntologyUtils.getHumanInstanceName(this.ontology, namedIndividualForObjectPropertySet.getIRI().getFragment())); 
// Result contains all the inferred object properties shown in the above pictures, so this code works. How can I access the explanation for one of the inferred object properties by the reasoner here? 
          } 
         } 
        } 
       } 

      } 
     } 

回答

1

您可以使用InferredObjectPropertyAxiomGenerator

InferredObjectPropertyAxiomGenerator generator = new InferredObjectPropertyAxiomGenerator(); 
generator.createAxioms(owldatafactory, reasoner); 
+0

聽起來很有趣,並不知道如何使用它來獲取個人的推斷對象屬性。 我看到您是OWLAPI的核心貢獻者,您是否可以提供一個示例,告訴我如何獲得使用此類的某個人的推斷對象屬性? – luispcosta