query-db09e234d3a26a34107e7a5747c4a81b
Getting elements in category tree with name of subcat
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?subcat ?item ?title WHERE {
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Generator" .
bd:serviceParam wikibase:endpoint "ru.wikipedia.org" .
bd:serviceParam mwapi:gcmtitle "Категория:Древнегреческие боги" .
bd:serviceParam mwapi:generator "categorymembers" .
bd:serviceParam mwapi:gcmprop "title" .
bd:serviceParam mwapi:gcmlimit "max" .
bd:serviceParam mwapi:gcmnamespace "14" .
?subcat wikibase:apiOutput mwapi:title .
}
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Generator" .
bd:serviceParam wikibase:endpoint "ru.wikipedia.org" .
bd:serviceParam mwapi:gcmtitle ?subcat .
bd:serviceParam mwapi:generator "categorymembers" .
bd:serviceParam mwapi:gcmprop "title" .
bd:serviceParam mwapi:gcmlimit "max" .
?title wikibase:apiOutput mwapi:title .
?item wikibase:apiOutputItem mwapi:item .
?ns wikibase:apiOutput "@ns" .
}
FILTER(?ns = "0")
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?item"):::projected
v1("?ns")
v2("?subcat"):::projected
v3("?title"):::projected
c7(["ru.wikipedia.org"]):::literal
c9(["Категория:Древнегреческие боги"]):::literal
c17(["14"]):::literal
c21(["mwapi:item"]):::iri
c15(["max"]):::literal
c22(["@ns"]):::literal
c13(["title"]):::literal
c11(["categorymembers"]):::literal
c3(["bd:serviceParam"]):::iri
c19(["mwapi:title"]):::iri
c5(["Generator"]):::literal
f0[["?ns = '0'"]]
f0 --> v1
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c3 --"mwapi:api"--> c5
c3 --"mwapi:endpoint"--> c7
c3 --"mwapi:gcmtitle"--> c9
c3 --"mwapi:generator"--> c11
c3 --"mwapi:gcmprop"--> c13
c3 --"mwapi:gcmlimit"--> c15
c3 --"mwapi:gcmnamespace"--> c17
v2 --"mwapi:apiOutput"--> c19
end
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c3 --"mwapi:api"--> c5
c3 --"mwapi:endpoint"--> c7
c3 --"mwapi:gcmtitle"--> v2
c3 --"mwapi:generator"--> c11
c3 --"mwapi:gcmprop"--> c13
c3 --"mwapi:gcmlimit"--> c15
v3 --"mwapi:apiOutput"--> c19
v4 --"mwapi:apiOutputItem"--> c21
v1 --"mwapi:apiOutput"--> c22
end