query-4a9688b3b13c812a8826012f649df0e9

rq turtle/ttl

Daniel Mietchen

Use at

PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?type ?typeLabel WHERE {
  {
    SELECT ?item WHERE {
      hint:SubQuery hint:optimizer "None".
      BIND(wd:Q9460683 AS ?template)
      ?templateArticle schema:isPartOf ?wikiProjectUrl;
                       schema:about ?template;
                       schema:name ?templateTitleWithNamespace.
      BIND(STRBEFORE(STRAFTER(?wikiProjectUrl, "https://"), "/") AS ?endpoint)
      BIND(STRAFTER(?templateTitleWithNamespace, ":") AS ?templateTitleWithoutNamespace)
      BIND(CONCAT("hastemplate:"", ?templateTitleWithoutNamespace, """) AS ?gsrsearch)
      SERVICE wikibase:mwapi {
        bd:serviceParam wikibase:endpoint ?endpoint;
                        wikibase:api "Generator";
                        mwapi:generator "search";
                        mwapi:gsrsearch ?gsrsearch;
                        mwapi:gsrlimit "max".
        ?item wikibase:apiOutputItem mwapi:item.
      }
    }
    LIMIT 100
  }
  hint:Prior hint:runFirst "true".
  ?item wdt:P31|wdt:P279 ?type .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
LIMIT 100

Query found at