User:Pepe piton/Queries
Jump to navigation
Jump to search
All files from a category with no depict statements
[edit]# All files from a category with no depict statements
SELECT DISTINCT ?file ?title # ?depicted ?depictedLabel
WITH
{
SELECT DISTINCT ?file ?title # Retrieve file links and titles...
WHERE
{
SERVICE wikibase:mwapi
{
bd:serviceParam wikibase:api "Generator" .
bd:serviceParam wikibase:endpoint "commons.wikimedia.org" .
bd:serviceParam mwapi:gcmtitle "Category:VisibleWikiWomen 2020" . # ...from a category...
bd:serviceParam mwapi:generator "categorymembers" .
bd:serviceParam mwapi:gcmtype "file" .
bd:serviceParam mwapi:gcmlimit "max" .
?title wikibase:apiOutput mwapi:title .
?pageid wikibase:apiOutput "@pageid" .
}
BIND (URI(CONCAT('https://commons.wikimedia.org/entity/M', ?pageid)) AS ?file)
}
} AS %get_files
WHERE
{
INCLUDE %get_files
MINUS { ?file wdt:P180 ?depicted . } # ...if the files have not depict statements.
# SERVICE <https://query.wikidata.org/sparql>
# {
# ?depicted wdt:P31 wd:Q5 . # ...if the items depicted are human beings
# ?depicted rdfs:label ?depictedLabel .
# FILTER ( LANG(?depictedLabel) = "en" ) .
# }
}