使用 SKOS 进行 SPARQL 推理

如何解决使用 SKOS 进行 SPARQL 推理

我们正在尝试使用 linked-data 展示推理。

这个简单的图表以海龟格式如下所示:

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 语句可以得到“是”的回答?

就推理而言,它应该是 True,因为 ex:Bern 是 ex:Localities,而这是 ex:Countries 的 skos:broader,即 ex:Switzerland。

我还没有找到任何关于 skos-Modelling 和 Inference 的好例子。 我们希望使用 skos:concepts 而不是 rdfs-subclassing。 因为它应该在您无法对所有内容进行子类化的情况下展示对概念的推断。

我正在使用:

  • 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) . 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?
Java在半透明框架/面板/组件上重新绘画。
Java“ Class.forName()”和“ Class.forName()。newInstance()”之间有什么区别?
在此环境中不提供编译器。也许是在JRE而不是JDK上运行?
Java用相同的方法在一个类中实现两个接口。哪种接口方法被覆盖?
Java 什么是Runtime.getRuntime()。totalMemory()和freeMemory()?
java.library.path中的java.lang.UnsatisfiedLinkError否*****。dll
JavaFX“位置是必需的。” 即使在同一包装中
Java 导入两个具有相同名称的类。怎么处理?
Java 是否应该在HttpServletResponse.getOutputStream()/。getWriter()上调用.close()?
Java RegEx元字符(。)和普通点?