query-de26a09d6a5162c294a2fa7f2cbcee42
TODO
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 schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?sitelink {
VALUES ?searchTerm { "water" } SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "EntitySearch".
bd:serviceParam wikibase:endpoint "www.wikidata.org".
bd:serviceParam wikibase:limit 10 .
bd:serviceParam mwapi:search ?searchTerm.
bd:serviceParam mwapi:language "en".
?item wikibase:apiOutputItem mwapi:item. ?num wikibase:apiOrdinal true.
}
?item (wdt:P279|wdt:P31) ?type.
FILTER NOT EXISTS { ?article schema:about ?item;
schema:isPartOf <https://en.wikipedia.org/>. }
FILTER NOT EXISTS { ?article2 schema:about ?item;
schema:isPartOf <https://commons.wikimedia.org/>. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ?searchTerm ?num
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?article")
v3("?article2")
v4("?item"):::projected
v2("?num")
v6("?searchTerm")
v6("?type")
c10(["www.wikidata.org"]):::literal
c17(["mwapi:item"]):::iri
c3([https://commons.wikimedia.org/]):::iri
c15(["en"]):::literal
c4([https://en.wikipedia.org/]):::iri
c6(["bd:serviceParam"]):::iri
c8(["EntitySearch"]):::literal
c19(["true^^xsd:boolean"]):::literal
c12(["10^^xsd:integer"]):::literal
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"schema:about"--> e0v2
e0v1 --"schema:isPartOf"--> e0c3
e0v1("?article2"):::projected
e0v2("?item"):::projected
e0c3([https://commons.wikimedia.org/]):::iri
end
f0--EXISTS--> f0e0
f0 --> v3
f0 --> c1
f0 --> v4
f0 --> c2
f0 --> c3
v3 --"schema:about"--> v4
v3 --"schema:isPartOf"--> c3
f1[["not "]]
subgraph f1e1["Exists Clause"]
e1v1 --"schema:about"--> e1v2
e1v1 --"schema:isPartOf"--> e1c3
e1v1("?article"):::projected
e1v2("?item"):::projected
e1c3([https://en.wikipedia.org/]):::iri
end
f1--EXISTS--> f1e1
f1 --> v5
f1 --> c1
f1 --> v4
f1 --> c2
f1 --> c4
v5 --"schema:about"--> v4
v5 --"schema:isPartOf"--> c4
bind2[/VALUES ?searchTerm/]
bind2-->v6
bind20(["water"])
bind20 --> bind2
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c6 --"mwapi:api"--> c8
c6 --"mwapi:endpoint"--> c10
c6 --"mwapi:limit"--> c12
c6 --"mwapi:search"--> v6
c6 --"mwapi:language"--> c15
v4 --"mwapi:apiOutputItem"--> c17
v2 --"mwapi:apiOrdinal"--> c19
end
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P31"--> v6
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P279"--> v6
end
union0r <== or ==> union0l
end
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c6 --"mwapi:language"--> c15
end