query-5510d939b556271c1c2e06157135c0e3
. The query below also finds items with the word "Frankfurt" in a label but uses the MediaWiki API, and can therefore run without timeout: MediaWiki API Query ServiceBut that query will timeout because the query engine would have to the read hundreds of millions of labels to find the word. But Wikidata's normal search function have all words in labels indexed and can make the search very fast. It is possible for a query to access Wikidata's search function with the Faster way to query sparql with labelsHi, I need to run SPARQL at wikidata endpoint using query that has a few labels in it, label query is very slow and inefficient, such as this, to find journalist that are born in Chicago it takes about 29 seconds, I have many other query that also time out. 10 LIMIT } } )"en" = )?valLabel(lang(FILTER ?valLabel label:rdfs ?val { OPTIONAL . ?ent ?wdtProperty2 ?val .?wdtProperty2 directClaim:wikibase ;en@"place of birth" ?labelB2 ?wdProperty2 } altLabel:skos label:rdfs { ?labelB2 VALUES .en@"Chicago" ?label2 ?ent } altLabel:skos label:rdfs { ?label2 VALUES ]. en@'journalist' ?label1 [ P106:wdt|P31:wdt ?val } altLabel:skos label:rdfs { ?label1 VALUES { WHERE ?valLabel ?val ?wdtProperty ?ent DISTINCT SELECT I have already read the query optimization page on searching the label, using the example given, it's still very slow, the below query still takes 11 seconds to return result, it's not usable for real world application. . The query below also finds items with the word "Frankfurt" in a label but uses the MediaWiki API, and can therefore run without timeout: MediaWiki API Query ServiceBut that query will timeout because the query engine would have to the read hundreds of millions of labels to find the word. But Wikidata's normal search function have all words in labels indexed and can make the search very fast. It is possible for a query to access Wikidata's search function with the . The query below also finds items with the word "Frankfurt" in a label but uses the MediaWiki API, and can therefore run without timeout: MediaWiki API Query ServiceBut that query will timeout because the query engine would have to the read hundreds of millions of labels to find the word. But Wikidata's normal search function have all words in labels indexed and can make the search very fast. It is possible for a query to access Wikidata's search function with the De onderstaande query vindt ook items met het woord "Frankfurt" in een label, maar gebruikt de MediaWiki API, en kan daarom zonder time-out worden uitgevoerd: MediaWiki API Query ServiceMaar die query zal uitlopen omdat de zoekmachine honderden miljoenen labels zou moeten lezen om het woord te vinden. Maar de normale zoekfunctie van Wikidata heeft alle woorden in de labels echter geïndexeerd en kan de opdracht zeer snel uitvoeren. Het is mogelijk voor een query om toegang te krijgen tot de zoekfunctie van Wikidata met de TODO . The query below also finds items with the word "Frankfurt" in a label but uses the MediaWiki API, and can therefore run without timeout: MediaWiki API Query ServiceBut that query will timeout because the query engine would have to the read hundreds of millions of labels to find the word. But Wikidata's normal search function have all words in labels indexed and can make the search very fast. It is possible for a query to access Wikidata's search function with the . The query below also finds items with the word "Frankfurt" in a label but uses the MediaWiki API, and can therefore run without timeout: MediaWiki API Query ServiceBut that query will timeout because the query engine would have to the read hundreds of millions of labels to find the word. But Wikidata's normal search function have all words in labels indexed and can make the search very fast. It is possible for a query to access Wikidata's search function with the . The query below also finds items with the word "Frankfurt" in a label but uses the MediaWiki API, and can therefore run without timeout: MediaWiki API Query ServiceBut that query will timeout because the query engine would have to the read hundreds of millions of labels to find the word. But Wikidata's normal search function have all words in labels indexed and can make the search very fast. It is possible for a query to access Wikidata's search function with the
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?label
WHERE
{
SERVICE wikibase:mwapi
{
bd:serviceParam wikibase:endpoint "www.wikidata.org";
wikibase:api "Generator";
mwapi:generator "search";
mwapi:gsrsearch "inlabel:Frankfurt";
mwapi:gsrlimit "max".
?item wikibase:apiOutputItem mwapi:title.
}
?item rdfs:label ?label.
FILTER CONTAINS(?label, "Frankfurt")
}
Query found at
- https://www.wikidata.org/wiki/Wikidata:Contact_the_development_team/Query_Service_and_search/Archive/2020/11
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/query_optimization
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/query_optimization/en
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/query_optimization/fr
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/query_optimization/hy
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/query_optimization/nl
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/query_optimization/pt
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/query_optimization/ru
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/query_optimization/uk
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/query_optimization/zh