query-3e15243863fbbe337f37dae4fd6f7b7b
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 ?catQ ?title ?count where {
{
select ?title (count(distinct ?file_title) as ?count) where {
service wikibase:mwapi {
bd:serviceParam wikibase:endpoint "commons.wikimedia.org" .
bd:serviceParam wikibase:api "Generator" .
bd:serviceParam mwapi:generator "links" .
bd:serviceParam mwapi:titles "Commons:British_Library/MC_maps_batch_01_(GB_counties)" .
bd:serviceParam mwapi:gplnamespace 6 .
bd:serviceParam mwapi:prop "categories" .
?title wikibase:apiOutput "categories/cl/@title" .
?file_title wikibase:apiOutput "@title" .
}
} group by ?title
}
OPTIONAL {
?catLink schema:name ?title .
?catLink schema:isPartOf <https://commons.wikimedia.org/> .
?catLink schema:about ?catQ .
}
}
order by desc(?count)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?catLink")
v5("?catQ"):::projected
v4("?count"):::projected
v3("?file_title")
v2("?title"):::projected
c20([https://commons.wikimedia.org/]):::iri
c16(["categories/cl/@title"]):::literal
c10(["Commons:British_Library/MC_maps_batch_01_(GB_counties)"]):::literal
c17(["@title"]):::literal
c2(["bd:serviceParam"]):::iri
c12(["6^^xsd:integer"]):::literal
c8(["links"]):::literal
c14(["categories"]):::literal
c4(["commons.wikimedia.org"]):::literal
c6(["Generator"]):::literal
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c2 --"mwapi:endpoint"--> c4
c2 --"mwapi:api"--> c6
c2 --"mwapi:generator"--> c8
c2 --"mwapi:titles"--> c10
c2 --"mwapi:gplnamespace"--> c12
c2 --"mwapi:prop"--> c14
v2 --"mwapi:apiOutput"--> c16
v3 --"mwapi:apiOutput"--> c17
end
bind1[/"count(?file_title)"/]
v3 --o bind1
bind1 --as--o v4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."schema:name".-> v2
v4 --"schema:isPartOf"--> c20
v4 --"schema:about"--> v5
end