query-71479bb8c61882144bac8148b920a935
. Using that info I made this query: mw:Manual:$wgHashedUploadDirectory: Sorry for the delay. I found out how to construct the content URL from the filename. It is explained in Vojtěch Dostál@ ]reply[09:49, 17 November 2020 (UTC)) talk (Vojtěch DostálThank you - I see the discussion. Happy to see that I might not be completely ignorant of something elementary :-). Thank you for inquiring the issue. ]reply[09:44, 17 November 2020 (UTC)) talk (Dipsacus fullonum and thought that I easily could make a query for you. However it turned out that the documentation is wrong, and it seems that there are no triples in WCQS to go from filenames to the media objects (M-numbers). I asked for help yesterday at the documentation talk page at mediawiki.org. If I don't get an answer from the development team today I will try at Phabricator. I will return when I know more. --mw:Extension:WikibaseMediaInfo/RDF mapping: I read the documentation at Vojtěch Dostál@ ]reply[06:46, 16 November 2020 (UTC)) talk (Vojtěch DostálHi! Yeah, sorry, I should have made myself clearer, although the uploader will be the same as creator in most of these cases. Anyway, querying for "creator" would be just fine for this :). Thank you very much, ]reply[22:45, 15 November 2020 (UTC)) talk (Dipsacus fullonum. I think that is possible, but the query you outline will not find the uploader. It will find the creator if they happen to have a Wikimedia username. That may be someone else than the uploader. You can find the uploader for all images by using the MWAPI service to call Commons Mediawiki API although I'm not sure that it is possible for all 6328 images in one query without timeout. So do you want creator or uploader for images? --Vojtěch DostálHi So, Zbyszko suggest to correct the query this way:
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?username (COUNT(DISTINCT ?file) AS ?count)
WHERE
{
{
SELECT ?file
WHERE
{
{
SELECT ?item ?image ?filename ?contentUrl
WHERE
{
SERVICE <https://query.wikidata.org/sparql>
{
?item wdt:P31 wd:Q5153359 .
?item wdt:P18 ?image .
}
BIND (REPLACE(wikibase:decodeUri(SUBSTR(STR(?image), 52)), " ", "_") AS ?filename)
BIND (REPLACE(SUBSTR(STR(?image), 52), "%20", "_") AS ?filenameUnencoded)
BIND (MD5(?filename) AS ?MD5)
BIND (URI(CONCAT("https://upload.wikimedia.org/wikipedia/commons/", SUBSTR(?MD5, 1, 1), "/", SUBSTR(?MD5, 1, 2), "/", ?filenameUnencoded)) As ?contentUrl)
}
} ?file schema:contentUrl ?contentUrl .
}
} ?file p:P170 / pq:P4174 ?username .
}
GROUP BY ?username