来自 OWL 文件的 SPARQL 查询中的条件错误
Condition error in SPARQL query from OWL file
在 sparql 查询中,我想列出 35 岁以上的人。但我收到以下错误。会是什么原因?
(即使我?yas > 35
结果也没有改变。我仍然得到错误。)
查询:
PREFIX uni:<http://muratkilinc.com/~ontologies/izmir.owl#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX un: <http://www.w3.org/2007/ont/unit#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?adi ?soyadi ?yas
WHERE
{
?turistler uni:yas ?yas > "35" .
?turistler uni:yas ?yas.
?turistler uni:adi ?adi.
?turistler uni:soyadi ?soyadi.
}
错误:
Error 400: Parse error:
Encountered " ">" "> "" at line 9, column 33.
Was expecting one of:
"values" ...
"graph" ...
"optional" ...
"minus" ...
"bind" ...
"service" ...
"let" ...
"exists" ...
"not" ...
"filter" ...
"{" ...
"}" ...
";" ...
"," ...
"." ...
要将这些类型的布尔条件放入 SPARQL 查询中,您必须使用 FILTER
约束。像这样:
PREFIX uni:<http://muratkilinc.com/~ontologies/izmir.owl#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX un: <http://www.w3.org/2007/ont/unit#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?adi ?soyadi ?yas
WHERE
{
?turistler uni:yas .
?turistler uni:yas ?yas.
?turistler uni:adi ?adi.
?turistler uni:soyadi ?soyadi.
FILTER(?yas > 35)
}
您可以使用的 SPARQL W3C doc is a great resource to read up on what kinds of filter expression,以及如何使用不同的值数据类型(字符串、整数、日期等)。
在 sparql 查询中,我想列出 35 岁以上的人。但我收到以下错误。会是什么原因?
(即使我?yas > 35
结果也没有改变。我仍然得到错误。)
查询:
PREFIX uni:<http://muratkilinc.com/~ontologies/izmir.owl#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX un: <http://www.w3.org/2007/ont/unit#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?adi ?soyadi ?yas
WHERE
{
?turistler uni:yas ?yas > "35" .
?turistler uni:yas ?yas.
?turistler uni:adi ?adi.
?turistler uni:soyadi ?soyadi.
}
错误:
Error 400: Parse error:
Encountered " ">" "> "" at line 9, column 33.
Was expecting one of:
"values" ...
"graph" ...
"optional" ...
"minus" ...
"bind" ...
"service" ...
"let" ...
"exists" ...
"not" ...
"filter" ...
"{" ...
"}" ...
";" ...
"," ...
"." ...
要将这些类型的布尔条件放入 SPARQL 查询中,您必须使用 FILTER
约束。像这样:
PREFIX uni:<http://muratkilinc.com/~ontologies/izmir.owl#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX un: <http://www.w3.org/2007/ont/unit#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?adi ?soyadi ?yas
WHERE
{
?turistler uni:yas .
?turistler uni:yas ?yas.
?turistler uni:adi ?adi.
?turistler uni:soyadi ?soyadi.
FILTER(?yas > 35)
}
您可以使用的 SPARQL W3C doc is a great resource to read up on what kinds of filter expression,以及如何使用不同的值数据类型(字符串、整数、日期等)。