query-e5986302e6d21f09164442ac730782e7

rq turtle/ttl

This query works SELECT DISTINCT ?item (STR(?itemLabel) AS ?label) WHERE { SERVICE wikibase:mwapi { bd:serviceParam wikibase:endpoint "www.wikidata.org"; wikibase:api "Generator"; mwapi:generator "search"; mwapi:gsrsearch "Beaupre"; mwapi:gsrlimit "max". ?item wikibase:apiOutputItem mwapi:title. } ?item wdt:P31 wd:Q5. ?item rdfs:label ?itemLabel. FILTER STRENDS(?itemLabel, "Beaupre") }

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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
# This query works
SELECT DISTINCT ?item (STR(?itemLabel) AS ?label)
WHERE
{
  SERVICE wikibase:mwapi
  {
    bd:serviceParam wikibase:endpoint "www.wikidata.org";
    wikibase:api "Generator";
    mwapi:generator "search";
    mwapi:gsrsearch "Beaupre";
    mwapi:gsrlimit "max".
    ?item wikibase:apiOutputItem mwapi:title.
  }
  ?item wdt:P31 wd:Q5.
  ?item rdfs:label ?itemLabel.
  FILTER STRENDS(?itemLabel, "Beaupre")
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?item"):::projected v1("?itemLabel"):::projected v3("?label") c5(["www.wikidata.org"]):::literal c12(["max"]):::literal c1(["Beaupre"]):::literal c9(["search"]):::literal c3(["bd:serviceParam"]):::iri c16(["wd:Q5"]):::iri c14(["mwapi:title"]):::iri c7(["Generator"]):::literal f0[["ends-with(?itemLabel,'Beaupre')"]] f0 --> v1 subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c3 --"mwapi:endpoint"--> c5 c3 --"mwapi:api"--> c7 c3 --"mwapi:generator"--> c9 c3 --"mwapi:gsrsearch"--> c1 c3 --"mwapi:gsrlimit"--> c12 v2 --"mwapi:apiOutputItem"--> c14 end v2 --"wdt:P31"--> c16 v2 --"rdfs:label"--> v1 bind1[/"str(?itemLabel)"/] v1 --o bind1 bind1 --as--o v3