使用ProtégéDL查询编辑器构建子查询

时间:2014-05-04 20:29:51

标签: rdf sparql owl ontology

我有

  • 带有DocA,DocB和DocC个人的“文件”类
  • 对象属性“约”
  • 与WatchA,WatchB和WatchC
  • 个人一起观看课程

我断言DocA是关于WatchA,关于WatchB的DocB,关于watchC的DocC

我需要一个返回所有现有手表的所有文档的查询。我可以写一个DL查询:Document和(关于值WatchA或关于值WatchB或关于值WatchC)

但是我想写一个子查询,例如。观看hasColor Black - 并获得相应的文件。所以有两个步骤:

  1. 一个子查询,将被评估为多个人(A,B),
  2. 并且这些个人将用于评估第一个查询:关于值A或关于值B
  3. 我没有使用SPARQL,因为它似乎不支持推理。

    有什么建议吗?感谢

1 个答案:

答案 0 :(得分:2)

您可以将OWL表达式表示为:Document and about some (Watch and color value black),并检索个体。在这种情况下,查询将返回documentA,因为它是此表达式所需的唯一一个。

我假设您的本体/知识库看起来如下(伪OWL曼彻斯特语法):

Prefix: example: <http://www.example.org/>

# Object properties
ObjectProperty: <example:about>
ObjectProperty: <example:color>

# Classes
Class: <example:Color>
Class: <example:Watch> 
Class: <example:Document>

# Individuals and their types
Individual: <example:black>
  Types: 
     <example:Color>

Individual: <example:watchA>
  Types: 
     <example:Watch>

  Facts:  
     <example:color>  <example:black>

Individual: <example:documentA>

  Types: 
     <example:Document>

  Facts:  
     <:example:about>  <example:watchA>