Hi all
I am trying to query the wiki data for entities with labels that matches a regex. I am new in the sparql world. So could you please help me with it. Here is what I have for now.
https://gist.github.com/anonymous/2810eb5747e51a9ae746183a43f20771
But I don't think it is the right way. Any help will be much appreciate. Thanks
Hi Mike!
I'm no SPARQL expert, but regular expressions in queries are often not optimized using indexes. So *all* labels would need to be checked against the regular expression, which of course times out.
But there are other options. Perhaps instead of FILTER regex(?label, "^apparel") try FILTER (STRSTARTS(?label,"apparel"))
See https://www.w3.org/TR/2013/REC-sparql11-query-20130321/#func-strstarts
Another option would be Blazegraph's full text index:
WHERE { ?label bds:search "apparel*" . .... }
This woudl match any label that contains a word that starts with apparel.
See https://wiki.blazegraph.com/wiki/index.php/FullTextSearch
HTH
Am 29.03.2016 um 22:47 schrieb mike white:
Hi all
I am trying to query the wiki data for entities with labels that matches a regex. I am new in the sparql world. So could you please help me with it. Here is what I have for now.
https://gist.github.com/anonymous/2810eb5747e51a9ae746183a43f20771
But I don't think it is the right way. Any help will be much appreciate. Thanks
Wikidata mailing list Wikidata@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata