SPARQL 个人查询披萨 ontology
SPARQL individuals queries for Pizza ontology
我写了这个查询,但它不起作用。谁知道是什么问题。
PREFIX : <http://www.semanticweb.org/ontologies/2009/pizza.owl#>
SELECT ?X ?Y
WHERE {?X :hasCountryOfOrigin "Italy".
?Y :hasCalorificValue "400"}
根据披萨 ontology 教程 here,您的查询有两个主要问题:
hasCountryOfOrigin
是一个对象 属性,因此,值不能是文字。意大利是个人,因此,您必须使用正确的 URI,可能 http://www.semanticweb.org/ontologies/2009/pizza.owl#Italy
- 数据 属性
hasCalorificValue
具有整数类型的值,即应像 "400"^^xsd:integer
一样使用文字(或者 xsd:int
,取决于您选择的内容在 Protege 中)
- 您查询中的两个三重模式都没有连接,即没有共享变量。我没有看到您的查询目标。
PREFIX : <http://www.semanticweb.org/ontologies/2009/pizza.owl#>
SELECT ?X ?Y
WHERE {?X :hasCountryOfOrigin :Italy.
?Y :hasCalorificValue "400"^^xsd:integer}
我写了这个查询,但它不起作用。谁知道是什么问题。
PREFIX : <http://www.semanticweb.org/ontologies/2009/pizza.owl#>
SELECT ?X ?Y
WHERE {?X :hasCountryOfOrigin "Italy".
?Y :hasCalorificValue "400"}
根据披萨 ontology 教程 here,您的查询有两个主要问题:
hasCountryOfOrigin
是一个对象 属性,因此,值不能是文字。意大利是个人,因此,您必须使用正确的 URI,可能http://www.semanticweb.org/ontologies/2009/pizza.owl#Italy
- 数据 属性
hasCalorificValue
具有整数类型的值,即应像"400"^^xsd:integer
一样使用文字(或者xsd:int
,取决于您选择的内容在 Protege 中) - 您查询中的两个三重模式都没有连接,即没有共享变量。我没有看到您的查询目标。
PREFIX : <http://www.semanticweb.org/ontologies/2009/pizza.owl#>
SELECT ?X ?Y
WHERE {?X :hasCountryOfOrigin :Italy.
?Y :hasCalorificValue "400"^^xsd:integer}