query-3a031a44e935c0cfe936ab526fac0079

rq turtle/ttl

item has no statements, search term may occur anywhere in the item record SELECT DISTINCT ?item ?itemLabel ?itemDescription ?sitelink WHERE { hint:Query hint:optimizer "None". SERVICE wikibase:mwapi { bd:serviceParam wikibase:api "Search"; wikibase:endpoint "www.wikidata.org"; mwapi:srsearch "aero". # <<<<<<<This is where you set the search term ?title wikibase:apiOutput mwapi:title. } BIND(IRI(CONCAT(STR(wd:), ?title)) AS ?item) ?item wikibase:statements "0"^^xsd:integer. optional { ?article schema:about ?item . ?sitelink ^schema:name ?article . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }

Use at

PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#item has no statements, search term may occur anywhere in the item record
SELECT DISTINCT ?item ?itemLabel ?itemDescription ?sitelink
WHERE {

  SERVICE wikibase:mwapi {
    bd:serviceParam wikibase:api "Search";
                    wikibase:endpoint "www.wikidata.org";
                    mwapi:srsearch "aero".  # <<<<<<<This is where you set the search term
    ?title wikibase:apiOutput mwapi:title.
  }
  BIND(IRI(CONCAT(STR(wd:), ?title)) AS ?item)
  ?item wikibase:statements "0"^^xsd:integer.
  optional {  ?article schema:about ?item .
              ?sitelink ^schema:name ?article . 
           }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?article") v2("?item"):::projected v4("?sitelink"):::projected v1("?title") c6(["www.wikidata.org"]):::literal c8(["aero"]):::literal c12(["0^^xsd:integer"]):::literal c2(["bd:serviceParam"]):::iri c4(["Search"]):::literal c17(["#91;AUTO_LANGUAGE#93;,en"]):::literal c10(["mwapi:title"]):::iri subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c2 --"mwapi:api"--> c4 c2 --"mwapi:endpoint"--> c6 c2 --"mwapi:srsearch"--> c8 v1 --"mwapi:apiOutput"--> c10 end bind0[/"concat(str('wd:'),?title)"/] v1 --o bind0 bind0 --as--o v2 v2 --"mwapi:statements"--> c12 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."schema:about".-> v2 v3 --"schema:name"--> v4 end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c2 --"mwapi:language"--> c17 end