OWL API를 직접 사용할 때와 비교하여 Protégé의 하위 클래스 처리에 대해 다소 혼란 스럽습니다.(Un) 유추 된 하위 클래스 규칙과 OWL API
나는 "남자"또는 "여자"가 남성 또는 여성 인 인간이라고 논리적으로 정의하는 간단한 온톨로지를 만들었습니다. 내가 피보호자이 온톨로지를 표시 할 때, 자동 :
이hasSex (Human -> Gender)
그래서 여성 인간과 hasGender 일부 여성
내 문제 :
클래스는
Human
Woman
Man
Gender
Female
Male
속성입니다 추론을 사용하지 않고 인간의 하위 클래스 인 남자와 여자를 조직합니다. 나는 그들의 서브 클래스를 OWL API의 모든 클래스를 반복하고 인쇄 할 때 그러나, 만 주장 서브 클래스는 찾을 수 있습니다
Subclasses of <http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Female>
Subclasses of <http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Woman>
Subclasses of <http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Male>
Subclasses of <http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Human>
Subclasses of <http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Gender>
<http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Female>
<http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Male>
Subclasses of <http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Man>
내가 피보호자 하나를 사용하지 않고 표시되는지, 예상 된 결과를 얻을 수있는 추론을 사용할 필요가 :
Subclasses of <http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Female>
Node(owl:Nothing)
Subclasses of <http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Woman>
Node(owl:Nothing)
Subclasses of <http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Male>
Node(owl:Nothing)
Subclasses of <http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Human>
Node(<http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Man>)
Node(<http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Woman>)
Subclasses of <http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Gender>
Node(<http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Female>)
Node(<http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Male>)
Subclasses of <http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Man>
Node(owl:Nothing)
여기서 내가 뭘 잘못하고 있니? Protégé에는 하위 클래스의 "명확한"사례에 대한 기본 제공 규칙이 있습니까? 어디에서 찾을 수 있습니까? 참고로
는 예를 온톨로지와 OWL API 코드 추적 :
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Object Properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#hasAge -->
<owl:ObjectProperty rdf:about="http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#hasAge">
<rdfs:domain rdf:resource="http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Human"/>
</owl:ObjectProperty>
<!-- http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#hasSex -->
<owl:ObjectProperty rdf:about="http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#hasSex">
<rdfs:domain rdf:resource="http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Human"/>
<rdfs:range rdf:resource="http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Gender"/>
</owl:ObjectProperty>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Classes
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Female -->
<owl:Class rdf:about="http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Female">
<rdfs:subClassOf rdf:resource="http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Gender"/>
</owl:Class>
<!-- http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Gender -->
<owl:Class rdf:about="http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Gender"/>
<!-- http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Human -->
<owl:Class rdf:about="http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Human"/>
<!-- http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Male -->
<owl:Class rdf:about="http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Male">
<rdfs:subClassOf rdf:resource="http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Gender"/>
</owl:Class>
<!-- http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Man -->
<owl:Class rdf:about="http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Man">
<owl:equivalentClass>
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
<rdf:Description rdf:about="http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Human"/>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#hasSex"/>
<owl:someValuesFrom rdf:resource="http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Male"/>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
</owl:equivalentClass>
</owl:Class>
<!-- http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Woman -->
<owl:Class rdf:about="http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Woman">
<owl:equivalentClass>
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
<rdf:Description rdf:about="http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Human"/>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#hasSex"/>
<owl:someValuesFrom rdf:resource="http://www.semanticweb.org/user/ontologies/2017/4/untitled-ontology-222#Female"/>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
</owl:equivalentClass>
</owl:Class>
public static void main(String[] args) throws OWLOntologyCreationException {
OWLOntologyManager m = OWLManager.createOWLOntologyManager();
OWLOntology o = m.loadOntologyFromOntologyDocument(new File("testonto/Untitled.owl"));
OWLReasonerFactory reasonerFactory = new JFactFactory();
OWLReasoner reasoner = reasonerFactory.createReasoner(o);
o.classesInSignature().forEach(c -> {
System.out.println("Subclasses of " + c);
reasoner.getSubClasses(c, true).forEach(sc -> System.out.println(" " + sc));
// EntitySearcher.getSubClasses(c, o).forEach(sc -> System.out.println(" " + sc));
});
}
안녕하세요 Ignazio, 답변 해 주셔서 감사합니다. 그 규칙을 찾는 방법은 없나요? 나는 제자의 코드에서 그것들을 추출하는 것 이외의 의미입니다 :-D – khituras
그들은 제게 원시적 인 소스 코드로 하드 코딩되어 있다는 것을 알고 두렵습니다. – Ignazio
좋아, 많이 고마워! – khituras