1

I'm trying to import data to GraphDB, but have a problem (or more likely: a misunderstanding) regarding consistency validation on functional properties:

I am using a repository with OWL2-RL ruleset and consistency checks enabled, and imported the following ontology, which provides a class for Buildings and Elevators, as well as the property hasElevator to link elevators to their building. Furthermore, it includes a functional boolean property containsAnyElevators, which is automatically inferred to be true as soon as a building has any elevator:

# Ontology
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

@prefix onto: <https://example.data/ontology#> .
@prefix data: <https://example.data/data#> .

onto:Building a rdfs:Class .
onto:Elevator a rdfs:Class .

onto:hasElevator a owl:ObjectProperty ;
    rdfs:domain onto:Building ;
    rdfs:range onto:Elevator .

onto:containsAnyElevators a owl:DatatypeProperty ;
    a owl:FunctionalProperty ;
    rdfs:domain onto:Building ;
    rdfs:range xsd:boolean .

_:buildingHasElevator a owl:Restriction ;
    owl:onProperty onto:hasElevator ;
    owl:someValuesFrom onto:Elevator .

_:buildingContainsAnyElevatorsTrue a owl:Restriction ;
    owl:onProperty onto:containsAnyElevators ;
    owl:hasValue "true"^^xsd:boolean .

_:buildingHasElevator owl:equivalentClass _:buildingContainsAnyElevatorsTrue .

Now, given the following data:

# Data
@prefix onto: <https://example.data/ontology#> .
@prefix data: <https://example.data/data#> .

data:ElevatorA a onto:Elevator .

data:BuildingA a onto:Building ;
    onto:hasElevator data:ElevatorA .

data:BuildingB a onto:Building.

GraphDB correctly infers onto:containsAnyElevators = true for ElevatorA. If I now however import another dataset which is inconsistent with that fact

@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix onto: <https://example.data/ontology#> .
@prefix data: <https://example.data/data#> .

data:BuildingA onto:containsAnyElevators "false"^^xsd:boolean .

GraphDB doesn't complain, and will show onto:containsAnyElevators = false as well as onto:containsAnyElevators = true when describing ElevatorA, which shouldn't be possible, given that containsAnyElevators is a functional property.

I'm pretty sure I'm either misunderstanding the purpose/scope of consistency checks or that I'm overlooking something else, but I'd be really thankful if anyone could help and explain why GraphDB is not complaining here.

Thanks in advance (:

Edit: I'm using GraphDB 9.10.1

Julius
  • 11
  • 2

1 Answers1

2

I think you understand the meaning FunctionalProperty restrictions incorrectly and there seems to be layers of misunderstanding. I.e., in your ontology you have GCIs, that are not necessary for the inferencing of functional properties and actually makes the problem more difficult. Hence, I will give a small example where a Functional property is at work.

Let us assume you have hasElevator defined as a functional property,

:hasElevator rdf:type owl:ObjectProperty ,
                  owl:FunctionalProperty .

and you have the following triples:

:BuidingA :hasElevator :ElevatorA .
:BuidingA :hasElevator :ElevatorB .

Then because :hasElevator is defined as functional, the OWL RL rules engine will add the following triple:

:ElevatorA owl:sameAs :ElevatorB .

How do I know this? This is stated in Table 5: Semantics of axioms about properties of the OWL 2 Profiles Specification. The pertinent bit I have provided a screenshot of below:

enter image description here

There is perhaps another problem here: You expect consisting checking to complain about "missing" information. I.e., if you have

:hasElevator rdf:type owl:ObjectProperty ,
                  owl:FunctionalProperty ;
             rdfs:domain :Building ;
             rdfs:range :Elevator .

and

:BuildingB rdf:type :Building .

and no further information, the consistency checking will tell you that :BuildingB should have 1 elevator. However, OWL follows open world semantics. This means that no inference will be made based on absence of information. In this case, just because no information is given about an elevator for :BuildingB it does not mean that :BuildingB does not have an elevator - in fact it may have 1, but it was not noted.

If you want closed world semantics, you may want to look into SHACL for example.

Update based on comment

Consistency checks based on the OWL RL rules are not on values but types. In short, what you want will work with an OWL DL reasoner, but not in OWL RL because it is less expressive (to reduce computational complexity). I.e., to get an inconsistency you have to have something like the following:

TypeA owl:disjointWith TypeB .
x rdf.type TypeA .
y rdf.type TypeB .

For exact details of the rules used for OWL RL in GraphDB, see GraphDBinstallDir/configs/rules/builtin_owl2-rl.pie.

Henriette Harmse
  • 4,167
  • 1
  • 13
  • 22
  • Thank you very much for your detailled answer! I'm not 100% sure if I got my problem across, though: In my case, I have a _data_ property which can either be true or false, and I made it functional to make sure that any object for which this property would be both true and false at the same time would be detected as inconsistent (because the FunctionalProperty axiom would result in the conclusion that true = false). My problem now is that GraphDB doesn't seem to care about this violation of the FunctionalDataProperty definition. – Julius Oct 17 '22 at 22:21
  • (To add a bit of context for my example above: The reason I have an object prop. hasElevator (which is _not_ functional) and a data prop. containsAnyElevators (which _is_ functional) and link them as described is that I have 2 different data sources, one which has exact information about which elevators exist, and another which only contains a flag if a building has an elevator or not, and I want to automatically detect inconsistencies that are obvious even with open world semantics, namely the case that a building has any elevator within the dataset, but containsAnyElevators is false) – Julius Oct 17 '22 at 22:25
  • @Julius Updated answer based on your comments. – Henriette Harmse Oct 18 '22 at 11:02