我正在尝试为我的测试服务器构建正确的查询,但我遇到了无法定义 PREFIX 的问题。
例如,此查询有效:
select * where
{
?stayingURL <http://localhost/resource_lng> ?lng .
?stayingURL <http://localhost/resource_staying_date> ?date .
?stayingURL <http://localhost/resource_address> ?address .
}
LIMIT 100
我尝试按日期添加过滤器,就像这样:
select * where
{
?stayingURL <http://localhost/resource_lng> ?lng .
?stayingURL <http://localhost/resource_staying_date> ?date .
?stayingURL <http://localhost/resource_address> ?address .
FILTER (?date > "2012-01-01"^^xsd:date)
}
LIMIT 100
现在我收到以下错误:“ MALFORMED QUERY: org.openrdf.query.parser.sparql.ast.VisitorException: QName 'xsd:date' uses an undefined prefix
”
好的,我尝试通过将以下行添加到查询的开头来手动声明此前缀:
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
现在我收到了这个错误:
MALFORMED QUERY: Encountered " "<" "< "" at line 1, column 14.
Was expecting:
<Q_IRI_REF> ...
这对我来说很奇怪,但无论如何我尝试直接写它,没有任何前缀:
select * where
{
?stayingURL <http://localhost/resource_lng> ?lng .
?stayingURL <http://localhost/resource_staying_date> ?date .
?stayingURL <http://localhost/resource_address> ?address .
FILTER (?date > "2012-01-01"^^<http://www.w3.org/2001/XMLSchema#date> )
}
LIMIT 100
结果几乎相同:
MALFORMED QUERY: Encountered " "<" "< "" at line 1, column 228.
Was expecting one of:
<Q_IRI_REF> ...
<PNAME_NS> ...
<PNAME_LN> ...
我究竟做错了什么?
这是我的服务器地址: http://176.34.226.101:8080/openrdf-sesame/repositories/ ecomobile。