我有
我断言DocA是关于WatchA,关于WatchB的DocB,关于watchC的DocC
我需要一个返回所有现有手表的所有文档的查询。我可以写一个DL查询:Document和(关于值WatchA或关于值WatchB或关于值WatchC)
但是我想写一个子查询,例如。观看hasColor Black - 并获得相应的文件。所以有两个步骤:
我没有使用SPARQL,因为它似乎不支持推理。
有什么建议吗?感谢
答案 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>