Hicham
Hicham

Reputation: 13

slash in property name sparql

I'm working on a project using sparql & dbpedia. I 'm currently having an issue with a textuel property with a slash on it. Here is a working query with the property "discharge" which express the amount of water per time of a river:

PREFIX dbp: <http://dbpedia.org/property/> 
SELECT ?discharge 
WHERE
{
   <http://dbpedia.org/resource/Nile> dbp:discharge ?discharge .
   FILTER(ISLITERAL(?discharge))
} 
LIMIT 200

This request is working fine. Still if use, a similar property called "discharge_m3/s", it"s not working anymore and I got this error which increminates the slash on the property name:

Virtuoso 37000 Error SP030: SPARQL compiler, line 3: syntax error at '/' before 's'

Any idea to go through this ?

Upvotes: 1

Views: 933

Answers (2)

cygri
cygri

Reputation: 9482

In compliant SPARQL 1.1 systems, you can backslash-escape the slash: dbp:discharge_m3\/s. I'm not sure if Virtuoso supports that syntax yet. In the meantime, @RobV's solution will work.

Upvotes: 3

RobV
RobV

Reputation: 28655

Do you mean you are trying to use the property in prefixed name form i.e. dbp:discharge_m3/s?

If that is the case you can't do that because that is not a valid prefixed name according to the SPARQL grammer hence the compiler error.

You would have to include the full URI instead of the prefixed name form e.g.

<http://dbpedia.org/property/discharge_m3/s>

Upvotes: 3

Related Questions