Virtuoso and some other SPARQL endpoint software extend the SPARQL 1.1 spec with some custom functions. one of them is free text search, which is INCREDIBLY much more faster than using regular expression text searches on, for example, DBPedia.
Here is an example SPARQL query for DBPedia using regex's :
SELECT DISTINCT ?film ?some_studio ?some_producer
WHERE {
?film rdf:type <http://dbpedia.org/ontology/Film> .
?film foaf:name ?film_title .
FILTER regex(str(?film_title), "\\bArgo\\b") .
?film dbpprop:studio ?some_studio .
FILTER regex(str(?some_studio), "\\bSmokehouse Pictures\\b") .
?film dbpprop:producer ?some_producer .
FILTER regex(str(?some_producer), "\\bBen Affleck\\b")
}
And here is one (same result) using Virtuoso's bif:contains :
SELECT DISTINCT ?film ?some_studio ?some_producer
WHERE {
?film rdf:type <http://dbpedia.org/ontology/Film> .
?film foaf:name ?name .
?film dbpprop:name ?name .
?film foaf:name ?name .
?name bif:contains '"Argo"' .
?film dbpprop:studio ?some_studio .
?some_studio bif:contains '"Smokehouse Pictures"' .
?film dbpprop:producer ?some_producer .
?some_producer bif:contains '"Ben Affleck"'
}
Notice the set of quotes around the 'free text': this is for including whitespace. You can test the queries for yourself on DBPedia's public SPARQL endpoint:
Happy SPARQL'ing!