使用SKOS进行SPARQL推理



我们正试图用链接数据来展示推理。

这个简单的图形看起来像下面的乌龟格式:

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.

想法是在SPARQL中执行以下查询:

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

它应该返回YES,但返回NO。

是否有可能对数据进行建模,使本ASK声明得到YES的回答?

就推论而言,它应该是正确的,因为ex:伯尔尼是ex:地方,这是一个skos:更广泛的ex:国家,即ex:瑞士。

我还没有找到任何关于skos建模和推理的好例子。我们希望使用skos:概念,而不是rdfs子类化。因为它应该展示在不能对所有内容进行子类化的情况下对概念的推理。

我正在使用:

  • GraphDB 9.5.0 EE
  • OWL2-RL-规则集

为了完成这个问题,我在上面发布了我的评论作为答案。。。

要使其工作,您需要定义属性ex:isPartOfex:livesIn的一些含义。建议使ex:isPartOf可传递,然后将ex:livesIn定义为ex:isPartOf上的属性链,例如:

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

最新更新