User:TweetsFactsAndQueries/Queries/some signature images
Originally posted on Twitter and on Mastodon.
#defaultView:ImageGrid{"hide":["?placeOfBirthCoordinates", "?signature"]}
#view:Map{"hide":["?placeOfBirthCoordinates"]}
SELECT ?person ?personLabel ?signature ?placeOfBirthCoordinates WITH {
# get all the actual data
SELECT ?person (SAMPLE(?signature_) AS ?signature) (SAMPLE(?placeOfBirthCoordinates_) AS ?placeOfBirthCoordinates) WHERE {
# get some random signature image statements
SERVICE bd:sample {
?person wdt:P109 ?signature_.
bd:serviceParam bd:sample.limit 110 . # a bit over 100 in case some of them happen to be non-humans
}
# ensure they’re signatures of humans (most are but there are some exceptions)
?person wdt:P31 wd:Q5.
# for the map display, optionally add the place of birth
OPTIONAL {
?person wdt:P19 ?placeOfBirth.
?placeOfBirth wdt:P625 ?placeOfBirthCoordinates_.
}
}
GROUP BY ?person # avoid multiple results in case of multiple signature / place of death (coordinate) statements
LIMIT 100
} AS %results WHERE {
# add labels
INCLUDE %results.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}