Sitelinks for files on commons.wikimedia: is it possible to query them with SPARQL or API?

86 Views Asked by At

I know how to query sitelinks for wikidata items with SPARQL (see below), is there some similar way to get sitelinks for files on commons.wikimedia? For example, if we open this image info page, at the bottom of the page we have two lists "File usage on Commons" and "File usage on other wikis". Is it possible to get these lists programmatically (with SPARQL or some other API)?

SELECT ?billGates  ?image  ?article
WHERE 
{
  VALUES ?billGates { wd:Q5284  }
  ?billGates wdt:P18 ?image.

  #?article schema:about ?billGates .  # this correctly returns 201 sitelinks for wikidata item

 { ?articleIm1 schema:about ?image. }         # this returns 0 sitelinks
  union  { ?image schema:about ?articleIm2.}  # this returns 0 sitelinks
}
1

There are 1 best solutions below

1
Pascalco On BEST ANSWER