2

I have the following Turtle syntax file (see end of question), and I would like to be able to infer :hasSibling, but only full siblings, not half. i.e. I only want those children that share the same mother and father.

I have reviewed How to infer isBrotherOf property between two individuals, which solves half of the problem. The following SPARQL query:

PREFIX : <http://example.com/Test#>
SELECT DISTINCT *
WHERE {
    ?child :isSiblingOf ?sibling .
    FILTER ( ?child = :jennySmith )
}

returns:

  • :jimJones - half-sibling, don't want
  • :joeSmith
  • :jennySmith - self, not ideal, but I can live with it

I've tried to use owl:intersectionOf and provide 2 sets, one using :hasFather in an owl:propertyChainAxiom and the other using :hasMother but that intersection is empty (it's possible -- likely -- I've got the syntax wrong, or that the 2 property chains are in fact returning different "things" -- I don't have a strong grasp of OWL yet):

:x1
    a owl:Restriction ;
    owl:intersectionOf (
        [
            owl:propertyChainAxiom(
                :hasFather
                :isParentOf
            ) ] [
            owl:propertyChainAxiom(
                :hasMother
                :isParentOf
            )
        ]
    )
.

Another possibility is that such a thing is just not possible with OWL.

I have the repository in GraphDB set up with OWL2-RL. Please ignore that there are existing ontologies to define family trees, and that OWL might not be the best way to represent them. My goal is not to create a family tree, but to learn OWL restrictions and inferences. This was the MVCE I came up with to illustrate my problem.

@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix owl2: <http://www.w3.org/2006/12/owl2#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix : <http://example.com/Test#> .

<file:test.ttl>
  a owl:Ontology ;
.
:Person
    a owl:Class ;
    rdfs:subClassOf owl:Thing ;
.
:hasGender
    a owl:ObjectProperty ;
    rdfs:domain :Person ;
.
:Man
    a owl:Class ;
    rdfs:subClassOf :Person ;
    owl:equivalentClass [
        a owl:Restriction ;
        owl:onProperty :hasGender ;
        owl:hasValue :male ;
    ]
.
:Woman
    a owl:Class ;
    rdfs:subClassOf :Person ;
    owl:equivalentClass [
        a owl:Restriction ;
        owl:onProperty :hasGender ;
        owl:hasValue :female ;
    ]
.
:Parent
    a owl:Restriction ;
    rdfs:subClassOf :Person ;
    owl:onProperty :isParentOf ;
    owl:someValuesFrom :Person ;
.
:Child
    a owl:Restriction ;
    rdfs:subClassOf :Person ;
    owl:onProperty :hasParent ;
    owl:someValuesFrom :Person ;
.
:Father
    a owl:Class ;
    rdfs:subClassOf :Parent ;
    owl:equivalentClass [
        a owl:Restriction ;
        owl:intersectionOf ( :Parent :Man ) ;
    ] ;
.
:Mother
    a owl:Class ;
    rdfs:subClassOf :Parent ;
    owl:equivalentClass [
        a owl:Restriction ;
        owl:intersectionOf ( :Parent :Woman ) ;
    ] ;
    owl2:disjointObjectProperties :Father ;
.
:hasFather
    owl:inverseOf :isFatherOf ;
.
:hasMother
    owl:inverseOf :isMotherOf ;
.
:hasParent
    a owl:ObjectProperty ;
.
:isMotherOf
    a owl:ObjectProperty ;
    rdfs:domain :Woman ;
    rdfs:range: :Child ;
    rdfs:subPropertyOf :isParentOf ;
.
:isFatherOf
    a owl:ObjectProperty ;
    rdfs:domain :Man ;
    rdfs:range: :Child ;
    rdfs:subPropertyOf :isParentOf ;
.
:isParentOf
    a owl:ObjectProperty ;
    rdfs:domain :Person ;
    rdfs:range :Person ;
    owl:inverseOf :hasParent ;
.
:isSiblingOf
    a owl:ObjectProperty  ;
    owl:propertyChainAxiom(
        :hasParent
        :isParentOf
    )
.

:janeSmith
    a :Person ;
    :hasGender :female ;
    :isMotherOf :jimJones ;
    :isMotherOf :joeSmith ;
    :isMotherOf :jennySmith ;
.
:johnSmith
    a :Person ;
    :hasGender :male ;
    :isFatherOf :joeSmith ;
    :isFatherOf :jennySmith ;
.
:tomJones
    a :Person ;
    :hasGender :male ;
    :isFatherOf :jimJones ;
.
:jimJones
    a :Person ;
    :hasGender :male ;
.
:joeSmith
    a :Person ;
    :hasGender :male ;
.
:jennySmith
    a :Person ;
    :hasGender :female ;
    :isMotherOf :harrySmith ;
.
:harrySmith
    a :Person ;
    :hasGender :male ;
.
Colin Young
  • 3,018
  • 1
  • 22
  • 46
  • you can't do the intersection of properties are property chains. What you have there is not a valid OWL axiom. You also don't have variables in OWL, thus, what you want to express needs SWRL or some other kind of rule language if supported by the triple store of your choice. GraphDB does support custom rules, so just try to write the rule in the corresponding syntax. – UninformedUser Oct 04 '19 at 19:14
  • So is it that it is impossible to express the concept "instances are siblings _if and only if_ they have the same 2 parents" in OWL? I don't _have_ to use property chains, that's just what I've been able to come up with. I'm working under the assumption that just because I can't figure it out doesn't mean it isn't possible. – Colin Young Oct 04 '19 at 19:37

1 Answers1

0

You can define :isFullSiblingOf with a custom rule like this. Read about Constraints and Cut at http://graphdb.ontotext.com/documentation/enterprise/reasoning.html

id: isFullSiblingOf
  x <:hasFather> f
  x <:hasMother> m
  y <:hasFather> f [Constraint x != y] [Cut]
  y <:hasMother> m
  ----------------
  x <:isSiblingOf> y

PS1: I assume you already have inverse reasoning. The best is to pick the axioms you need, then add your own: eg you don't have to include all RL axioms if you don't need them. See more advice: http://graphdb.ontotext.com/documentation/standard/rules-optimisations.html

PS2: You should also declare isFullSiblingOf as owl:SymmetricProperty. BTW I would use hasFullSibling since the inverse name is harder to grasp

PS3: owl2:disjointObjectProperties :Father above is a mistake, you can't use that on classes.

PS4: <file:test.ttl> uses a relative URL without base, which is not very good.

Vladimir Alexiev
  • 2,477
  • 1
  • 20
  • 31