I am trying to match a single word in SPARQL using a regular expression filter, but without success ...: / I am sending a request to the endpoint located at "http://dbtune.org/musicbrainz/sparql". Well, the following query works:
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns
PREFIX mo: <http://purl.org/ontology/mo/>
SELECT ?artist ?name
WHERE {
?artist a mo:MusicArtist
. ?artist foaf:name "Switchfoot"
. ?artist foaf:name ?name
. FILTER(regex(str(?name), "switchfoot", "i"))
}
But if I delete line 7 (.? Artist foaf: name "Switchfoot"), the following query will not match:
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns
PREFIX mo: <http://purl.org/ontology/mo/>
SELECT ?artist ?name
WHERE {
?artist a mo:MusicArtist
. ?artist foaf:name ?name
. FILTER(regex(str(?name), "switchfoot", "i"))
}
I don’t know if I am doing something wrong or is it an endpoint error ...
Can someone help me?
source
share