Hi Patrick, > On 8 Oct 2015, at 13:33, Patrick van Kleef <pkl...@openlinksw.com> wrote: > >> I know i can do something like the following, but it's terribly slow >> (timeout, no result): >> >> select * where { >> ?s rdfs:label ?l . >> FILTER(str(?l) = "贝拉克·奥巴马"). >> } >> >> [...] > > This of course would result in a partial table scan as the str function would > need to be evaluated for each record.
yes and no... i mean the current implementation seems to, but it could certainly be optimised, as this sadly is the default pattern to search across languages :( >> [...] > > The problem is that when you use the contain function with unicode characters > it has difficulties find word separation, so you need to quote the word > yourself: > > Try like this: > > prefix dbpedia: <http://dbpedia.org/resource/> > select * where { > ?s rdfs:label ?l . > FILTER(bif:contains(?l, "'贝拉克·奥巴马'")). > } > > which will give you super fast results: > [...] Cool, thanks, with this i can at least make it work somehow. Sadly it's still not exactly what i need... for example if i search for an exact label "Barack Obama" this method will give me way too many results: select * where { ?s rdfs:label ?l . FILTER(bif:contains(?l, "'Barack Obama'")). } http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&qtxt=prefix+dbpedia%3A+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2F%3E%0D%0Aselect+*+where+{%0D%0A++%3Fs+rdfs%3Alabel+%3Fl+.%0D%0A++FILTER%28bif%3Acontains%28%3Fl%2C+%22%27Barack+Obama%27%22%29%29.%0D%0A}&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=30000&debug=on I'd actually only be interested in exact matches, so the equivalent of `?s rdfs:label ?l . FILTER(str(?l) = "Barack Obama")`, just performant ;) The workaround i found for now is this: select * where { ?s rdfs:label ?l . FILTER(bif:contains(?l, "'Barack Obama'") && str(?l) = "Barack Obama"). } http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&qtxt=prefix+dbpedia%3A+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2F%3E%0D%0Aselect+*+where+{%0D%0A++%3Fs+rdfs%3Alabel+%3Fl+.%0D%0A++FILTER%28bif%3Acontains%28%3Fl%2C+%22%27Barack+Obama%27%22%29+%26%26+str%28%3Fl%29+%3D+%22Barack+Obama%22%29.%0D%0A}&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=30000&debug=on but is that the "best" way? Best, Jörn ------------------------------------------------------------------------------ _______________________________________________ Virtuoso-users mailing list Virtuoso-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/virtuoso-users