Some 11 days ago I asked a question about showing in a category which files have de depicts field as structured data. I think that we need to be able to more easily access this piece of data to make the next step in Commons.I finally got some answers thanks to the help of multiple people. As I heard multiple people are interested in this too, let me share it here with you what I have found. Not all options are useful for me, but maybe for you they are.Option 1: haswbstatement:P180 in the search fieldWhat it does: it shows all files with property P180 (depicts) in the structured data.What it does not do: showing files that are missing P180.Option 2: use the has Depictsscript script by user TiagoLubianaWhat it does: script adds a dot below each file in a category (and more places), the dot is green if the file has the depicts statement (P180), the dot is red if the file hasn't. In this way you can quickly see which files have or haven't the depicts structured data.What it does not do: it does not show what the depicts is.How to add: go to your http://commons.wikimedia.org/wiki/Special:MyPage/common.js and add there:
importScript('User:TiagoLubiana/hasDepicts.js');Option 3: use the sdc_tool script by user Magnus ManskeWhat it does: in the right corner at the bottom is a button, clicking on it activates the scripts and shows what the file depicts (if any). You can also easily add statements through the script to the files.Issue: in my screen it shows the depicts statements right through the file name, making them both unreadable.How to add: go to your http://commons.wikimedia.org/wiki/Special:MyPage/common.js and add there:importScript('User:Magnus Manske/sdc_tool.js');Option 4: run a query to see what the depicts statements are of the files in a category.What it does: it shows all files in a category, and if the files have any depicts statement it shows the labels of them.Example query: https://w.wiki/F45MBecause manually changing the category (line 8) each time you want to use the query, I made a small script to be added to http://commons.wikimedia.org/wiki/Special:MyPage/common.js in what you can autorun this query with the category name added automatically. The link is present in the expandable menu under More.Script to add:// in Category namespace (ns:14) link to query for depicts of all files in category if ( mw.config.get( 'wgNamespaceNumber' ) === 14 ) { $(function() { mw.util.addPortletLink('p-cactions', 'https://commons-query.wikimedia.org/embed.html#SELECT%20DISTINCT%20%3Fdepicts%20%3FdepictsLabel%20%3Ffile%20%3Ftitle%20%0AWITH%20%7B%0A%20%20SELECT%20%3Ffile%20%3Ftitle%20%0A%20%20WHERE%20%7B%0A%20%20%20%20SERVICE%20wikibase%3Amwapi%20%7B%0A%20%20%20%20%20%20bd%3AserviceParam%20wikibase%3Aapi%20%22Generator%22%20.%0A%20%20%20%20%20%20bd%3AserviceParam%20wikibase%3Aendpoint%20%22commons.wikimedia.org%22%20.%0A%20%20%20%20%20%20bd%3AserviceParam%20mwapi%3Agcmtitle%20%22' + mw.config.get( 'wgPageName' ) + '%22%20.%0A%20%20%20%20%20%20bd%3AserviceParam%20mwapi%3Agenerator%20%22categorymembers%22%20.%0A%20%20%20%20%20%20bd%3AserviceParam%20mwapi%3Agcmtype%20%22file%22%20.%0A%20%20%20%20%20%20bd%3AserviceParam%20mwapi%3Agcmlimit%20%22max%22%20.%0A%20%20%20%20%20%20%3Ftitle%20wikibase%3AapiOutput%20mwapi%3Atitle%20.%0A%20%20%20%20%20%20%3Fpageid%20wikibase%3AapiOutput%20%22%40pageid%22%20.%0A%20%20%20%20%7D%0A%20%20%20%20BIND%20%28URI%28CONCAT%28%27https%3A%2F%2Fcommons.wikimedia.org%2Fentity%2FM%27%2C%20%3Fpageid%29%29%20AS%20%3Ffile%29%0A%20%20%7D%0A%7D%20AS%20%25get_files%0AWHERE%0A%7B%0A%20%20INCLUDE%20%25get_files%0A%20%20%3Ffile%20schema%3Aurl%20%3Furl%20.%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%3Ffile%20wdt%3AP180%20%3Fdepicts%20.%0A%20%20%20%20SERVICE%20%3Chttps%3A%2F%2Fquery.wikidata.org%2Fsparql%3E%20%7B%0A%20%20%20%20%20%20%3Fdepicts%20rdfs%3Alabel%20%3FdepictsLabel%20.%0A%20%20%20%20%20%20FILTER%20%28lang%28%3FdepictsLabel%29%20%3D%20%22en%22%29%20%20%20%20%20%20%20%20%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D', "depicts:", "FileDepicts", "depicts:"); }); };Further more I can also recommend using the gadget AC/DC for adding (not showing) structured data (based on the files in a category or PagePile). Enabling in your gadgets: https://commons.wikimedia.org/wiki/Special:Preferences#mw-prefsection-gadgets (section Interface: Structured Data).More suggestions remain welcome!Romaine_______________________________________________Op wo 6 aug 2025 om 12:16 schreef Romaine Wiki <romaine.wiki@gmail.com>:Hi all,Is there a script/gadget/tool to easily see which files in a category has or hasn't the depicts field added as structured data?Thanks!Romaine
Wikidata mailing list -- wikidata@lists.wikimedia.org
Public archives at https://lists.wikimedia.org/hyperkitty/list/wikidata@lists.wikimedia.org/message/4USYALENWYKQ4BVEKQLELK2EBWKKDPOO/
To unsubscribe send an email to wikidata-leave@lists.wikimedia.org