SPARQL query error


(Gabriel Dehner) #1

My query in SPARQL is the following:
stardog query PruebaOntologia “SELECT ?z
WHERE { ?x :nombre ?z.
FILTER (REGEX(?z, “^Alb”)).
}”
According to the W3C documentation, the syntax is correct. I should recover the triplet that has the name Alberto, for example.
But I have the following error:
Encountered " “^” "^ “” at line 3, column 29.
Was expecting one of:
“(” …
“!” …
“+” …
“-” …
“if” …
“tz” …
“md5” …
“str” …
“sum” …
“min” …
“max” …
“avg” …
“abs” …
“day” …
“now” …
“IRI” …
“URI” …
“ceil” …
“year” …
“sha1” …
“uuid” …
“lang” …
“true” …
“rand” …



I will appreciate if you can help me. Regards!
Atte: Gabriel Dehner


(Jess Balint) #2

Hi Gabriel,

The query looks fine in general. It looks like you might have a “smart quote” if your query text. Can you try re-typing the double quotes around the regex string in Stardog Studio when you execute the query?

Jess


(Gabriel Dehner) #3

Excuse me but I do not know how to do that. How do I do it?


(Jess Balint) #4

In the query editor, you will need to position the cursor immediately following the quote. Then press backspace and type the quote character. Do this for each of the quotes surrounding the regular expression.

Jess


(Ghislain ) #5

Try to copy and replace your query with this one
SELECT ?z WHERE { ?x :nombre ?z.
FILTER (REGEX(?z, “^Alb”)).
}
The problem is probably this ’ “ ’ before ^Alb.
HTH


(Gabriel Dehner) #6

Many thanks. Greetings.


(system) #7

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.