3

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?

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
wabrit
  • 217
  • 2
  • 14

1 Answers1

2

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.

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
  • Thanks Stanislav - I assume there will be a performance penalty to both switching on consistency checking and choosing OWL2-RL over the default (RDFS-Plus Optimized) GraphDB setting for a repository? Would that affect data import, or query, or both? – wabrit Feb 26 '18 at 11:05
  • Of course, there will be performance penalty... Probably you could also try the "OWL2RL Optimized" ruleset. This penalty would affect data import mostly, because GraphDB *materializes* inferred statements. – Stanislav Kralin Feb 26 '18 at 11:26
  • @wabrit, what's preventing you from accepting the answer? – Stanislav Kralin Mar 01 '18 at 15:02