query-b2bb126f5b81da3cc0c33bba1d08c68b
Commons depicts data for files in a given category, which works on whole categories of files at a time. tagged using the ISA Tool for campaign #150 labels for files wdt:P180Hello, I'm trying to obtain all the . 1930s photographs in Auckland MuseumMy first example is the category This is what I've tried so far:
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?file ?title ?label
WHERE {
{
SELECT * WHERE {
SERVICE wikibase:mwapi
{
bd:serviceParam wikibase:api "Generator" .
bd:serviceParam wikibase:endpoint "commons.wikimedia.org" .
bd:serviceParam mwapi:gcmtitle "Category:1930s photographs in Auckland Museum" .
bd:serviceParam mwapi:generator "categorymembers" .
bd:serviceParam mwapi:gcmtype "file" .
bd:serviceParam mwapi:gcmlimit "max" .
?title wikibase:apiOutput mwapi:title .
?pageid wikibase:apiOutput "@pageid" .
}
BIND (URI(CONCAT('https://commons.wikimedia.org/entity/M', ?pageid)) AS ?file)
}
}.
{
SELECT ?depicts WHERE {
{
SELECT * WHERE {
SERVICE wikibase:mwapi
{
bd:serviceParam wikibase:api "Generator" .
bd:serviceParam wikibase:endpoint "commons.wikimedia.org" .
bd:serviceParam mwapi:gcmtitle "Category:1930s photographs in Auckland Museum" .
bd:serviceParam mwapi:generator "categorymembers" .
bd:serviceParam mwapi:gcmtype "file" .
bd:serviceParam mwapi:gcmlimit "max" .
?title wikibase:apiOutput mwapi:title .
?pageid wikibase:apiOutput "@pageid" .
}
BIND (URI(CONCAT('https://commons.wikimedia.org/entity/M', ?pageid)) AS ?file)
}
}.
?file wdt:P180 ?depicts .
}
}.
SERVICE <https://query.wikidata.org/sparql> {
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,mi".
?depicts rdfs:label ?label .
}
}
}
LIMIT 50
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?depicts")
v4("?file"):::projected
v5("?label"):::projected
v2("?pageid")
v1("?title"):::projected
c8(["Category:1930s photographs in Auckland Museum"]):::literal
c14(["max"]):::literal
c10(["categorymembers"]):::literal
c2(["bd:serviceParam"]):::iri
c12(["file"]):::literal
c22(["#91;AUTO_LANGUAGE#93;,en,mi"]):::literal
c16(["mwapi:title"]):::iri
c6(["commons.wikimedia.org"]):::literal
c17(["@pageid"]):::literal
c4(["Generator"]):::literal
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c2 --"mwapi:api"--> c4
c2 --"mwapi:endpoint"--> c6
c2 --"mwapi:gcmtitle"--> c8
c2 --"mwapi:generator"--> c10
c2 --"mwapi:gcmtype"--> c12
c2 --"mwapi:gcmlimit"--> c14
v1 --"mwapi:apiOutput"--> c16
v2 --"mwapi:apiOutput"--> c17
end
bind0[/"concat('https://commons.wikimedia.org/entity/M',?pageid)"/]
v2 --o bind0
bind0 --as--o v4
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c2 --"mwapi:api"--> c4
c2 --"mwapi:endpoint"--> c6
c2 --"mwapi:gcmtitle"--> c8
c2 --"mwapi:generator"--> c10
c2 --"mwapi:gcmtype"--> c12
c2 --"mwapi:gcmlimit"--> c14
v1 --"mwapi:apiOutput"--> c16
v2 --"mwapi:apiOutput"--> c17
end
bind1[/"concat('https://commons.wikimedia.org/entity/M',?pageid)"/]
v2 --o bind1
bind1 --as--o v4
v4 --"p:direct/P180"--> v4
subgraph s2["https://query.wikidata.org/sparql"]
style s2 stroke-width:4px;
subgraph s3["http://wikiba.se/ontology#label"]
style s3 stroke-width:4px;
c2 --"mwapi:language"--> c22
v4 --"rdfs:label"--> v5
end
end