|
From: Ivan M. <imi...@op...> - 2008-04-22 02:09:24
|
Hello Rob, LIKE operator in SPARQL clones SQL LIKE so you should use "Queen%Elizabeth" string as the right argument of LIKE, not aa regex. If you realy need to use regex then use regex :) It's PCRE-based so you may make the pattern case-insensitive by (?i) option, e.g. regex(?mystring, "(?i)Queen Elizabeth") . The proper support for third argument of REGEX will be added in next version. In any case, indexes are not used by REGEX due to the nature of regular expressions. If you're looking for names that consists of words, consider using of free-text index as described in http://docs.openlinksw.com/virtuoso/freetext.html (if you haven't tried free-text of Virtuoso before) and http://docs.openlinksw.com/virtuoso/rdfsparqlrulefulltext.html (RDF-specific details) Best Regards, Ivan Mikhailov, OpenLink Software ----- Original Message ----- From: "robl" <ro...@mo...> To: <vir...@li...> Sent: Monday, April 21, 2008 8:40 PM Subject: [Virtuoso-users] DBpedia and Virtuoso SPARQL Query > 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/ki...@op.../weblog/ki...@op...'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 > Vir...@li... > https://lists.sourceforge.net/lists/listinfo/virtuoso-users > |