How to infer isBrotherOf property between two individuals
I need to infer that one individual is the brother of other one if they have the same father.
So, if I have this:
Bart hasFather Homer.
Lisa hasFather Homer.
Because Bart
and Lisa
have the same father, I would like to infer:
Lisa hasBrother Bart.
Is there any method to do that using any property characteristics?
Use Property Chains and Rolification
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.
Sample Ontology
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 .
Assuming that everyone is their own brother, and that sisters are brothers too:
:hasBrother owl:propertyChainAxiom (:hasFather [ owl:inverseOf :hasFather ]) .
It is hardly possible to define :hasBrother more precisely, excluding female brothers and self-brotherhood. But you can infer all the brothers of Lisa as follows:
: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
)
] .
One way to this is by using SWRL rules.
On protege:
- go to Window
- Click on Tabs
- Click on Swrl Tab
- Press the "new" button and write the following rule
Write rule:
isChildOf(?x,?y)^FatherOf(?y,?z)^differentFrom(?z,?x)->isBrotherOf(?x,?z)
This means that if "x is a child of y", and "y is also a parent of z" and "z and x are different" then "z and x are Brothers".