Hello, I'm playing with sparql & regexp on dbpedia.org (dbpedia.org/sparql).
I use a a query to get all movies a specific actor starred in, e.g:
This works fine, unless you forget that she has "Mary" as second name. That's why I use a regexp to solve this problem:
But this takes a long time to get a result, about 1 minute. Anyone an idea how I can speedup such a query?
You can try using the virtuoso build in "bif" functions for text search.
This is much faster in reality than using filters. Unfortunately, looking at your comment the virtuoso query execution estimator disagrees.
The 2 name variables are to work around a limitation of the bif functions. More general the contains function is normally slightly faster than the regex ones.
When you have a larger number of actors you can try the following. The theory here is that less variables need to be bound and that they can be passed into a single filter call faster. You will need to measure to see what is faster.