Reputation: 10767
I am trying to build correct query for my test server, and i am faced the problem that i'm not able to define PREFIX.
For instance, this query works:
select * where
{
?stayingURL <http://localhost/resource_lng> ?lng .
?stayingURL <http://localhost/resource_staying_date> ?date .
?stayingURL <http://localhost/resource_address> ?address .
}
LIMIT 100
I try to add filter by date, just like that:
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
Now i got the following error: "MALFORMED QUERY: org.openrdf.query.parser.sparql.ast.VisitorException: QName 'xsd:date' uses an undefined prefix
"
OK, i try to declare this prefix manually by adding the following line to the start of query:
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
Now i got this error:
MALFORMED QUERY: Encountered " "<" "< "" at line 1, column 14.
Was expecting:
<Q_IRI_REF> ...
This is pretty strange for me, but anyway i tried to write it directly, without any prefix:
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
Result is almost the same:
MALFORMED QUERY: Encountered " "<" "< "" at line 1, column 228.
Was expecting one of:
<Q_IRI_REF> ...
<PNAME_NS> ...
<PNAME_LN> ...
What am I doing wrong?
Here's my server address: http://176.34.226.101:8080/openrdf-sesame/repositories/ecomobile .
Upvotes: 3
Views: 2780
Reputation: 16525
It works for me if I URI encode all the query
parameter:
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
This would be the request:
Apologies for the cryptic unreadable URI ... a shorten version here:
Upvotes: 4