我在这个 SPARQL 查询中的错误在哪里?
Where is my mistake in this SPARQL query?
"@PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> " +
"SELECT ?o ?stringTest ?boolTest " +
"where { "+
"?s ?p ?o . "+
"BIND (xsd:string(?o) as ?stringTest). " +
"BIND (xsd:boolean(?o) as ?boolTest) "+
"}\n ";
我试图在 Eclipse 中使用 Jena 执行此操作,但我找不到我的错误。
这是非常简单的查询,我不知道我的错误是什么。有人可以给我一些反馈吗?
这里只有SPARQL代码:
@PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?o ?stringTest ?boolTest
where {
?s ?p ?o .
BIND (xsd:string(?o) as ?stringTest).
BIND (xsd:boolean(?o) as ?boolTest)
}
这是我得到的错误:
Encountered " <LANGTAG> "@prefix "" at line 1, column 1.
Was expecting one of:
"\ufeff" ...
"base" ...
"prefix" ...
"select" ...
"describe" ...
"construct" ...
"ask" ...
如错误所述,SPARQL 处理器遇到了 @prefix
它预期的 prefix
。
SPARQL 1.1 语法使用 PREFIX
(没有 @
符号)。
Turtle 1.1 语法使用 @PREFIX
(SPARQL 之前的日期)或 PREFIX
(现在首选,因为它与 SPARQL 1.1 协调)。
"@PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> " +
"SELECT ?o ?stringTest ?boolTest " +
"where { "+
"?s ?p ?o . "+
"BIND (xsd:string(?o) as ?stringTest). " +
"BIND (xsd:boolean(?o) as ?boolTest) "+
"}\n ";
我试图在 Eclipse 中使用 Jena 执行此操作,但我找不到我的错误。 这是非常简单的查询,我不知道我的错误是什么。有人可以给我一些反馈吗?
这里只有SPARQL代码:
@PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?o ?stringTest ?boolTest
where {
?s ?p ?o .
BIND (xsd:string(?o) as ?stringTest).
BIND (xsd:boolean(?o) as ?boolTest)
}
这是我得到的错误:
Encountered " <LANGTAG> "@prefix "" at line 1, column 1.
Was expecting one of:
"\ufeff" ...
"base" ...
"prefix" ...
"select" ...
"describe" ...
"construct" ...
"ask" ...
如错误所述,SPARQL 处理器遇到了 @prefix
它预期的 prefix
。
SPARQL 1.1 语法使用 PREFIX
(没有 @
符号)。
Turtle 1.1 语法使用 @PREFIX
(SPARQL 之前的日期)或 PREFIX
(现在首选,因为它与 SPARQL 1.1 协调)。