Hi Rob,

The following change to the query should work:

SELECT ?subject ?predicate ?object WHERE {
  ?subject ?predicate ?object.
  ?object bif:contains "'%Queen%Elizabeth%'"
}

Note the single quotes around the % characters.

Best Regards
Hugh Williams
Professional Services
OpenLink Software

On 21 Apr 2008, at 14:40, robl wrote:

Hi,

I'm currently working with the latest DBpedia dataset in Virtuoso OS
Edition (5.06).  I'm trying to do the equivalent of a SQL LIKE using
SPARQL on a resource subject. So in SQL this would have been something
like :

SELECT * FROM pages WHERE page_title LIKE "Queen%Elizabeth"

This would perform a case insensitive match on Queen(anything) Elizabeth
(at least in mySQL).

I have tried the following in my virtuoso instance :

SELECT ?subject ?predicate ?object WHERE {
   ?subject ?predicate ?object.
FILTER(?subject like "^http://dbpedia.org/resource/ Queen.*Elizabeth$")
}

SELECT ?subject ?predicate ?object WHERE {
   ?subject ?predicate ?object.
   FILTER regex(?subject,
"^http://dbpedia.org/resource/Queen.*Elizabeth$";, "i")
}

These both take well over a minute to return (and the first doesn't seem
to be case insensitive), which isn't acceptable for my particular
application.

Is there quick way to do what I want ?  Are there any indexes I could
apply to improve things (I have already created the indexes specified at http://www.openlinksw.com/dataspace/kide...@openlinksw.com/weblog/ kide...@openlinksw.com's%20BLOG%20%5B127%5D/1298)
?

Or do I need to create a conventional SQL table of resource names and
then do a SQL LIKE query on those ?

Thanks,

Rob


---------------------------------------------------------------------- ---
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http:// java.sun.com/javaone
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users


Reply via email to