我试图为我的测试服务器构建正确的查询,但我面临着无法定义前缀的问题。
例如,下面的查询是这样的:
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。
发布于 2012-03-16 05:05:48
如果我对所有的query参数进行URI编码,那么它对我来说是有效的:
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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这将是请求:
对于神秘的不可读的URI,很抱歉...这里有一个简短的版本:
https://stackoverflow.com/questions/9725828
复制相似问题