< SPARQL

Wikimedia Comnmons images use structured data too (Structured Data on Commons (SDoC). With Wikimedia Commons Query Service (WCQS) the data can be queried. This is availabe in beta phase at https://wcqs-beta.wmflabs.org/.

Find below an example of Depictions of Douglas Adams shown as image grid.

#workaround to show the images in an image grid
#defaultView:ImageGrid
SELECT ?file ?image WHERE {
  ?file wdt:P180 wd:Q42 .
  ?file schema:contentUrl ?url .
  bind(iri(concat("http://commons.wikimedia.org/wiki/Special:FilePath/", replace(substr(str(?url),53),"_","%20"))) AS ?image)
}

Try it!

Mind: use |project=sdc where sdc =Structured Data on Commons, the default is |project=wd for Wikidata.

See more examples on WCQS itself.

References

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.