Search code examples
owlgraphdb

owl:functionalProperty & owl:differentFrom


I'd be grateful for some help on what I'd assumed was a very simple scenario; but being a relative newcomer to OWL and GraphDB I may have made some basic error.

I have a very simple Turtle-specified OWL example as follows:

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix demo: <urn:demo> .

demo:Gender a owl:Class .

demo:Male a demo:Gender .
demo:Female a demo:Gender .

demo:Male owl:differentFrom demo:Female .

demo:Person a owl:Class .

demo:hasGender a owl:ObjectProperty, owl:FunctionalProperty;
                rdfs:domain demo:Person;
                rdfs:range demo:Gender .

demo:Per1 a demo:Person;
            demo:hasGender demo:Male;
            demo:hasGender demo:Female .

In essence, I have a class called Gender and assert that there are 2 distinct members Male and Female.

Then I define another class Person with a functional property hasGender whose range is Gender.

Finally I assert an instance of Person, and also two separate assertions that it is both Male and Female.

Now as I understand it this is something of a contradiction; I've asserted that the hasGender property is functional so that, for a given Person, there should be only one gender. I've also asserted that Male and Female are different, so when I import this into GraphDB I was expecting it to fail because of this.

But GraphDB is happy to load both assertions. Have I missed something?


Solution

  • When creating a repository:

    If you try to import your data, GraphDB will have to say:

    Could not import data; com.ontotext.trree.consistency.ConsistencyException:
    Consistency check eq_diff1_1 failed:
    urn:demoMale owl:differentFrom urn:demoMale
    urn:demoMale owl:sameAs urn:demoMale
    

    Alternatively, unselect the checkbox, import your data and then execute:

    PREFIX sys: <http://www.ontotext.com/owlim/system#>
    INSERT DATA { []  sys:consistencyCheckAgainstRuleset "owl2-rl" }
    

    Another modelling approach is to create Male and Female as disjoint subclasses of Person.
    Unlike owl:FunctionalProperty, owl:AllDisjointClasses is covered by OWL 2 QL.