假设我们在 Ontotext GraphDB 上加载了以下一组事实:
@prefix : <http://www.example.org#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
:bbq_sauce a :Ingredient ;
:hasBrand :ispc .
:strawberry a :Ingredient ;
:hasBrand :driscolls .
:blueberry a :Ingredient ;
:hasBrand :driscolls .
:ispc a :Brand ;
owl:sameAs :driscolls .
:driscolls a :Brand ;
owl:sameAs :ispc .
我希望使用以下 SPARQL 查询来检索
:strawberry
的所有品牌,显式和隐式:
PREFIX : <http://www.example.org#>
SELECT ?brand WHERE {
:strawberry :hasBrand ?brand .
}
在 UI 上的 GraphDB 的 SPARQL 选项卡上运行查询,我只检索知识图中明确说明的
driscolls
品牌。我怎样才能通过driscolls
检索与owl:sameAs
相同的其他品牌?请注意,推理功能在 UI 中激活(图标位于下面屏幕截图的右侧):正如评论部分中的 Damyan 所指出的,为了启用
owl:sameAs
功能,必须首先创建一个包含相应规则集的存储库。选择 OWL-Horst
(或者,我猜,任何可用的 OWL 变体)就可以完成这项工作 - 见下图: