我需要推断,一个人是另一个的弟弟,如果他们有相同的父亲。
所以,如果我有这样的:
巴特hasFather荷马。
丽莎hasFather荷马。
由于Bart
和Lisa
有同一个父亲,我想推断:
丽莎hasBrother巴特。
有没有什么方法来做到这一点使用任何财产的特点?
我需要推断,一个人是另一个的弟弟,如果他们有相同的父亲。
所以,如果我有这样的:
巴特hasFather荷马。
丽莎hasFather荷马。
由于Bart
和Lisa
有同一个父亲,我想推断:
丽莎hasBrother巴特。
有没有什么方法来做到这一点使用任何财产的特点?
Antoine Zimmermann's answer is a very good start to this problem, and touches on the major point that you need to solve this sort of task:
From x to each of x's brothers, there is a path of the form hasFather o hasFather-1.
Now, that's actually not true of just brothers, though. That's true for all siblings and for x itself. This means you'll have the following definition of hasSibling:
hasSibling ≡ hasFather o hasFather-1
(Actually, that's really just hasPaternalSibling; a more refined definition would use hasParent.) Now, using this, you could ask for brothers, which are simply siblings who are men, of x with a query like:
(hasSibling value x) and Man
However, it would be nice to define a proper hasBrother property. You could do this with a property chain and hasSibling if you had a special property that linked each Man to himself, and only linked males to themselves:
hasBrother ≡ hasSibling o specialProperty
In fact, such a property is what we get from a technique called rolification, which has been described more in a question, OWL 2 rolification, and its answer. The idea is that for the class Man, we create a new property rMan and add the equivalence:
Man ≡ rMan some Self
which says that each Man is related to himself by the rMan property, and that only instances of Man are so connected. This is exactly the property that we need as specialProperty above. Thus, we end up with the following definitions of Man, hasSibling, and hasBrother:
Now we can ask for the brothers of x with a query like:
hasBrother-1 value x
For instance, we can ask for Greg's siblings, and get Peter, Greg (himself), and Bobby.
Here's that ontology in Turtle:
@prefix : <http://www.example.org/brady#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix brady: <http://www.example.org/brady#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
brady:hasSibling a owl:ObjectProperty ;
owl:propertyChainAxiom ( brady:hasFather [ owl:inverseOf
brady:hasFather ] ) .
brady:Carol a owl:NamedIndividual , brady:Woman .
brady:hasBrother a owl:ObjectProperty ;
owl:propertyChainAxiom ( brady:hasSibling brady:r_Man ) .
<http://www.example.org/brady>
a owl:Ontology .
brady:Woman a owl:Class ;
rdfs:subClassOf brady:Person ;
owl:equivalentClass [ a owl:Restriction ;
owl:hasSelf true ;
owl:onProperty brady:r_Woman
] .
brady:hasFather a owl:ObjectProperty .
brady:Person a owl:Class .
brady:Man a owl:Class ;
rdfs:subClassOf brady:Person ;
owl:equivalentClass [ a owl:Restriction ;
owl:hasSelf true ;
owl:onProperty brady:r_Man
] .
brady:r_Woman a owl:ObjectProperty .
brady:r_Man a owl:ObjectProperty .
brady:Marcia a owl:NamedIndividual , brady:Woman ;
brady:hasFather brady:Mike .
brady:Peter a owl:NamedIndividual , brady:Man ;
brady:hasFather brady:Mike .
brady:Jan a owl:NamedIndividual , brady:Woman ;
brady:hasFather brady:Mike .
brady:Cindy a owl:NamedIndividual , brady:Woman ;
brady:hasFather brady:Mike .
brady:Bobby a owl:NamedIndividual , brady:Man ;
brady:hasFather brady:Mike .
brady:Greg a owl:NamedIndividual , brady:Man ;
brady:hasFather brady:Mike .
brady:Mike a owl:NamedIndividual , brady:Man .
假设每个人都是自己的兄弟,姐妹们是兄弟太:
:hasBrother owl:propertyChainAxiom (:hasFather [ owl:inverseOf :hasFather ]) .
这几乎是不可能的定义:hasBrother更准确地说,不包括女性的兄弟和自我兄弟。 但可以推断丽莎的所有兄弟如下:
:Female a owl:Class .
:Male a owl:Class;
owl:disjointWith :Female .
:Lisa a :Female .
:Bart a :Male .
:Homer a :Male .
:hasFather a owl:ObjectProperty;
rdfs:range :Male .
:hasBrother a owl:ObjectProperty;
rdfs:range :Male .
:hasSiblingOrSelf owl:propertyChainAxiom ( :hasFather [ :hasFather ] ) .
:LisaBrother owl:equivalentClass [
a owl:Restriction;
owl:onProperty [ owl:inverseOf :hasBrother ];
owl:hasValue :Lisa
], [
a owl:Class;
owl:intersectionOf (
[ a owl:Restriction; owl:onProperty :hasSiblingOrSelf; owl:hasValue :Lisa ]
:Male
)
] .