Hi,
It's alway worth trying the query without the filter just to make sure of what
to expect from regex.
Or, negate the first regex like:
SELECT DISTINCT * WHERE {
?a a foaf:Agent .
?a foaf:name ?n .
FILTER regex(?n, '^[^a]', 'i')
}
You will see that names that don’t start with an 'a' are like these:
"(Max) Zong-Ming Cheng”
"Á. B. Nagy"
This means that there are no names start with 'b’. That’s why you got no
results.
If you are just searching for names, why not just write like this:
SELECT DISTINCT * WHERE {
?a a foaf:Agent .
?a foaf:name ?n .
FILTER regex(?n, ‘b', 'i')
}
This above query will match any ‘b' character at any position. Or write more
specific regex to match a position.
Also, as suggested, other functions from SPARQL 1.1 like : STRSTARTS or
CONTAINS would be, in principles, more efficient, but this would depend if the
sparql engine is compatible with 1.1.
I might be wrong but it seems not working on this endpoint so far.
Cheers,
Saud.