sparqlrdfgraphdblinked-dataskos

SPARQL Inference with SKOS


We are trying to showcase inference with linked-data.

The simple graph looks like the following in turtle-format:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ex: <http://schema.example.com/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

ex:Places rdf:type skos:ConceptScheme .

ex:Localities rdf:type skos:Concept .
ex:Localities skos:prefLabel "Localities" .
ex:Localities skos:inScheme ex:Places.

ex:Countries rdf:type skos:Concept .
ex:Countries skos:prefLabel "Countries" .
ex:Countries skos:inScheme ex:Places.

ex:Continents rdf:type skos:Concept .
ex:Continents skos:prefLabel "Continents" .
ex:Continents skos:inScheme ex:Places.

ex:Persons rdf:type skos:Concept .
ex:Persons skos:prefLabel "Persons" .

ex:livesIn a rdf:Property .

ex:isPartOf a rdf:Property .

ex:Localities skos:broader ex:Countries .
ex:Countries skos:broader ex:Continents .

ex:Europe a ex:Continents .

ex:Switzerland a ex:Countries .
ex:Switzerland ex:isPartOf ex:Europe.

ex:France a ex:Countries .
ex:France ex:isPartOf ex:Europe.

ex:Bern a ex:Localities .
ex:Bern skos:prefLabel "Bern".
ex:Bern ex:isPartOf ex:Switzerland.
 
ex:Thun a ex:Localities .
ex:Thun skos:prefLabel "Thun".
ex:Thun ex:isPartOf ex:Switzerland.

ex:Paris a ex:Localities .
ex:Paris skos:prefLabel "Paris".
ex:Paris ex:isPartOf ex:France.

ex:Hans a ex:Persons.
ex:Hans skos:prefLabel "Hans".
ex:Hans ex:livesIn ex:Bern.

ex:Fritz a ex:Persons.
ex:Frits skos:prefLabel "Fritz".
ex:Fritz ex:livesIn ex:Thun.

ex:Jaques a ex:Persons.
ex:Jaques skos:prefLabel "Jaques".
ex:Jaques ex:livesIn ex:Paris.

The Idea would be to do the following query in SPARQL:

PREFIX ex: <http://schema.example.com/>
ASK where { ex:Hans ex:livesIn ex:Switzerland }

It should return YES, but it returns NO.

Is there a possibility to model the data, that this ASK-Statement can get answered with YES?

In terms of inference it should be True, since ex:Bern is a ex:Localities and this is a skos:broader of ex:Countries, which is ex:Switzerland.

I haven't found any good examples for skos-Modelling and Inference yet. We would like to work with skos:concepts and rather not with rdfs-subclassing. Because it should showcase the inference over concepts in situations, where you are not able to subclass everything.

I am using:


Solution

  • To complete the question, I'm posting my comment above as an answer...

    To make it work, You need to define some meaning to your properties ex:isPartOf and ex:livesIn. Suggest to make ex:isPartOf transitive and then to define ex:livesIn as a property chain over ex:isPartOf, e.g.:

    ex:isPartOf a owl:TransitiveProperty . 
    ex:livesIn rdf:type owl:ObjectProperty;              
        owl:propertyChainAxiom( ex:livesIn ex:isPartOf) .