query-964afb0c965b4c681416aec1e134856c
Efficient query, based on a string, to find Wikidata pagesTo find a Wikidata page/article, the normal way is certainly to call the API with "action=wbsearchentities". a string. contains with a string, or just begins a string, or is exactlyBut here I am trying to find pages/articles doing SPARQL queries, in order to better tailor the results, asking for instance pages where the name I am aware that the efficiency of string queries in SPARQL strongly depends on the back-end and how those queries are enhanced (for instance using Lucene, etc.). I have also heard that "regex" queries in SPARQL are often discouraged, for performance reason. articles but only specific ones (rock bands, etc.) allHowever I saw in the examples some queries that make use of STRSTARTS [1], CONTAINS [2], or regex [3]. It seems some of them no more work, but this might be related to the use of "SERVICE wikibase:label". Then the performance of those queries seems acceptable, but they do not query So my questions is: is it possible and efficient to use the SPARQL end-point to search for pages using some text operations, and if yes what would be a sample query ? For instance I tried this query to find items with a label that starts with "suisse" but it does a time-out:
Use at
- https://query.wikidata.org/sparql
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?item ?label
WHERE
{
?item rdfs:label ?label .
FILTER(lang(?label) = "fr") .
FILTER regex (str(?label), "^suisse", "i").
}
LIMIT 10