← the ontology · class 08 · the question slide

An order with exactly one customer gets two

The intuitive answer — «an error» — is wrong. This is example 06, run on the server with owlrl.

1. With the cardinality only

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix onto: <https://data.csoares.me/onto#> .
onto:hasCustomer a owl:ObjectProperty .
onto:Order a owl:Class ; rdfs:subClassOf [ a owl:Restriction ; owl:onProperty onto:hasCustomer ;
    owl:maxCardinality "1"^^xsd:nonNegativeInteger ] .

@prefix onto: <https://data.csoares.me/onto#> . @prefix order: <https://data.csoares.me/order/> .
@prefix customer: <https://data.csoares.me/customer/> .
order:1001 a onto:Order ; onto:hasCustomer customer:4 , customer:5 .
customer:4 owl:sameAs customer:5 ? True · inconsistencies: 0
Open world: the reasoner does not reject the data, it concludes that the two URIs name the same customer.

2. And the two are declared different

@prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix customer: <https://data.csoares.me/customer/> .
customer:4 owl:differentFrom customer:5 .
inconsistencies: 4 Only now is there a contradiction. For «an order must have one and only one customer» as a rule on the data, the tool is SHACL — class 09.