query-8729749b77e366339f8329624f846c48
item has no P31, 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) FILTER NOT EXISTS { ?item wdt:P31 []. } optional { ?article schema:about ?item . ?sitelink ^schema:name ?article . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
Use at
- https://query.wikidata.org/sparql
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#>
#item has no P31, 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)
FILTER NOT EXISTS { ?item wdt:P31 []. }
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")
v3("?item"):::projected
v4("?sitelink"):::projected
v2("?title")
a1((" "))
c7(["www.wikidata.org"]):::literal
c9(["aero"]):::literal
c3(["bd:serviceParam"]):::iri
c5(["Search"]):::literal
c16(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c11(["mwapi:title"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"wdt:P31"--> e0a1
e0v1("?item"):::projected
e0a1((" ")):::projected
end
f0--EXISTS--> f0e0
f0 --> v3
f0 --> c1
f0 --> a1
v3 --"wdt:P31"--> a1
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c3 --"mwapi:api"--> c5
c3 --"mwapi:endpoint"--> c7
c3 --"mwapi:srsearch"--> c9
v2 --"mwapi:apiOutput"--> c11
end
bind1[/"concat(str('wd:'),?title)"/]
v2 --o bind1
bind1 --as--o v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."schema:about".-> v3
v3 --"schema:name"--> v4
end
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c3 --"mwapi:language"--> c16
end