query-c40fb782667e8053451c4e63b493b467
Images on Wikimedia Commons
Run this from WCQS - https://commons-query.wikimedia.org/
PREFIX commons: http://commons.wikimedia.org/wiki/Special:FilePath/ PREFIX sdc: https://commons.wikimedia.org/entity/
SELECT ?title ?entity ?file ?file2 WHERE { SERVICE wikibase:mwapi { bd:serviceParam wikibase:endpoint "commons.wikimedia.org" ; wikibase:api "Generator" ; wikibase:limit 500 ; mwapi:gcmtitle "Category:Exoplanets" ; mwapi:generator "categorymembers" ; mwapi:gcmtype "file" ; mwapi:gcmlimit "max" ; mwapi:prop "info|pageprops" . ?title wikibase:apiOutput mwapi:title . ?pageid wikibase:apiOutput mwapi:pageid . } BIND (URI(CONCAT(STR(sdc:), 'M', ?pageid)) AS ?entity) OPTIONAL { ?entity schema:url ?file . } # Some images don't have structured data associated with them BIND(URI(CONCAT(STR(commons:), ENCODE_FOR_URI(SUBSTR(?title, 6)))) AS ?file2) }
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#>
# Images on Wikimedia Commons
# Run this from WCQS - https://commons-query.wikimedia.org/
PREFIX commons: <http://commons.wikimedia.org/wiki/Special:FilePath/>
PREFIX sdc: <https://commons.wikimedia.org/entity/>
SELECT ?title ?entity ?file ?file2
WHERE {
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "commons.wikimedia.org" ;
wikibase:api "Generator" ;
wikibase:limit 500 ;
mwapi:gcmtitle "Category:Exoplanets" ;
mwapi:generator "categorymembers" ;
mwapi:gcmtype "file" ;
mwapi:gcmlimit "max" ;
mwapi:prop "info|pageprops" .
?title wikibase:apiOutput mwapi:title .
?pageid wikibase:apiOutput mwapi:pageid .
}
BIND (URI(CONCAT(STR(sdc:), 'M', ?pageid)) AS ?entity)
OPTIONAL { ?entity schema:url ?file . } # Some images don't have structured data associated with them
BIND(URI(CONCAT(STR(commons:), ENCODE_FOR_URI(SUBSTR(?title, 6)))) AS ?file2)
}