如何在 OWL/GraphDB 中推断具有 2 个以上属性的个体? [英] How to infer individual with more than 2 properties in OWL / GraphDB?
问题描述
我从上一个问题那里得到了建议并修改了来源.但是,源仍然无法正常工作.
I got advice from the previous question and modified the source. However, the source still does not work properly.
我正在使用 GraphDB(规则集:OWL2-RL)和 SPARQL.
I am using GraphDB(RuleSet: OWL2-RL) and SPARQL.
我有一个包含 Person 和 Animal_Lover 类的本体.如果人们拥有超过 2 只宠物,则他们是 Animal_Lover.
I have an ontology with Person and Animal_Lover classes. People are Animal_Lover if they have more than 2 pet.
我怎样才能在我的本体中做到这一点?
How can I do this in my ontology?
<?xml version="1.0"?>
<rdf:RDF xmlns="http://www.example.com/test"
xmlns:test="http://www.example.com/test#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<owl:Ontology rdf:about="http://www.example.com/test"/>
<owl:ObjectProperty rdf:about="http://www.example.com/test#hasOwner">
<owl:inverseOf rdf:resource="http://www.example.com/test#hasPet"/>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:about="http://www.example.com/test#hasPet">
<owl:inverseOf rdf:resource="http://www.example.com/test#hasOwner"/>
</owl:ObjectProperty>
<owl:Class rdf:about="http://www.example.com/test#Animal_Lover">
<owl:equivalentClass>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.example.com/test#hasPet"/>
<owl:minQualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">2</owl:minQualifiedCardinality>
<owl:onClass rdf:resource="http://www.example.com/test#Mammal"/>
</owl:Restriction>
</owl:equivalentClass>
<rdfs:subClassOf rdf:resource="http://www.example.com/test#Person"/>
</owl:Class>
<owl:Class rdf:about="http://www.example.com/test#Mammal"/>
<owl:Class rdf:about="http://www.example.com/test#Dog">
<rdfs:subClassOf rdf:resource="http://www.example.com/test#Mammal"/>
<owl:disjointWith rdf:resource="http://www.example.com/test#Person"/>
</owl:Class>
<owl:Class rdf:about="http://www.example.com/test#Person">
<rdfs:subClassOf rdf:resource="http://www.example.com/test#Mammal"/>
<owl:disjointWith rdf:resource="http://www.example.com/test#Dog"/>
</owl:Class>
<owl:NamedIndividual rdf:about="http://www.example.com/test#Lulu">
<rdf:type rdf:resource="http://www.example.com/test#Dog"/>
<test:hasOwner rdf:resource="http://www.example.com/test#Smith"/>
</owl:NamedIndividual>
<owl:NamedIndividual rdf:about="http://www.example.com/test#Tank">
<rdf:type rdf:resource="http://www.example.com/test#Dog"/>
<test:hasOwner rdf:resource="http://www.example.com/test#Smith"/>
</owl:NamedIndividual>
<owl:NamedIndividual rdf:about="http://www.example.com/test#Nala">
<rdf:type rdf:resource="http://www.example.com/test#Dog"/>
<test:hasOwner rdf:resource="http://www.example.com/test#Smith"/>
</owl:NamedIndividual>
<owl:NamedIndividual rdf:about="http://www.example.com/test#Smith">
<rdf:type rdf:resource="http://www.example.com/test#Person"/>
<test:hasPet rdf:resource="http://www.example.com/test#Lulu"/>
<test:hasPet rdf:resource="http://www.example.com/test#Nala"/>
<test:hasPet rdf:resource="http://www.example.com/test#Tank"/>
</owl:NamedIndividual>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#AllDifferent"/>
<owl:distinctMembers rdf:parseType="Collection">
<rdf:Description rdf:about="http://www.example.com/test#Lulu"/>
<rdf:Description rdf:about="http://www.example.com/test#Nala"/>
<rdf:Description rdf:about="http://www.example.com/test#Smith"/>
<rdf:Description rdf:about="http://www.example.com/test#Tank"/>
</owl:distinctMembers>
</rdf:Description>
</rdf:RDF>
我希望 Smith 被推断并成为 Animal_Lover.但是这段代码在 OWL(或 GraphDB)中不起作用.有什么问题?
I want Smith to be inferred and become Animal_Lover. But this code does not work in OWL (or GraphDB). What is the problem?
推荐答案
我认为您的要求属于 OWL DL,GraphDB 不支持.
I think what you ask for falls in OWL DL, which is not supported by GraphDB.
这篇关于如何在 OWL/GraphDB 中推断具有 2 个以上属性的个体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!