query-af000efd00cd3dd24d891a1fa8c18583
MWAPI category questionThen, referring to the category search, below, is there a means of indicating to MWAPI that it should search the indicated category and its child categories? TODO
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?sitelink ?article
WHERE
{
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "en.wikipedia.org";
wikibase:api "Generator";
mwapi:generator "categorymembers";
mwapi:gcmtitle "Category:Water pollution" ;
mwapi:gcmprop "ids|title|type";
mwapi:gcmlimit "max".
# out
?name wikibase:apiOutput mwapi:title. # en-wikipedia article / category name
?item wikibase:apiOutputItem mwapi:item. # wikidata QId for the person's item
}
?article schema:about ?item ;
schema:isPartOf <https://en.wikipedia.org/> ;
schema:name ?sitelink .
filter not exists {?article2 schema:about ?item ;
schema:isPartOf <https://de.wikipedia.org/> .}
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;
v4("?article"):::projected
v1("?article2")
v2("?item"):::projected
v3("?name")
v5("?sitelink"):::projected
c3([https://de.wikipedia.org/]):::iri
c21(["mwapi:item"]):::iri
c13(["Category:Water pollution"]):::literal
c7(["en.wikipedia.org"]):::literal
c22([https://en.wikipedia.org/]):::iri
c5(["bd:serviceParam"]):::iri
c17(["max"]):::literal
c11(["categorymembers"]):::literal
c26(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c19(["mwapi:title"]):::iri
c15(["ids|title|type"]):::literal
c9(["Generator"]):::literal
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"schema:about"--> e0v2
e0v1 --"schema:isPartOf"--> e0c3
e0v1("?article2"):::projected
e0v2("?item"):::projected
e0c3([https://de.wikipedia.org/]):::iri
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> c1
f0 --> v2
f0 --> c2
f0 --> c3
v1 --"schema:about"--> v2
v1 --"schema:isPartOf"--> c3
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c5 --"mwapi:endpoint"--> c7
c5 --"mwapi:api"--> c9
c5 --"mwapi:generator"--> c11
c5 --"mwapi:gcmtitle"--> c13
c5 --"mwapi:gcmprop"--> c15
c5 --"mwapi:gcmlimit"--> c17
v3 --"mwapi:apiOutput"--> c19
v2 --"mwapi:apiOutputItem"--> c21
end
v4 --"schema:about"--> v2
v4 --"schema:isPartOf"--> c22
v4 --"schema:name"--> v5
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c5 --"mwapi:language"--> c26
end