query-e94f662981c91b63545d7a3cd3202bb7

rq turtle/ttl

.on Mastodon and on TwitterOriginally posted

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:ImageGrid{"hide":["?placeOfBirthCoordinates", "?signature"]}
#view:Map{"hide":["?placeOfBirthCoordinates"]}
SELECT ?person ?personLabel ?signature ?placeOfBirthCoordinates WHERE {
  # add labels
   {
  # 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
}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?person"):::projected v3("?placeOfBirth") v6("?placeOfBirthCoordinates"):::projected v4("?placeOfBirthCoordinates_") v5("?signature"):::projected v2("?signature_") c5(["110^^xsd:integer"]):::literal c3(["bd:serviceParam"]):::iri c7(["wd:Q5"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph s1["http://www.bigdata.com/rdf#sample"] style s1 stroke-width:4px; v1 --"wdt:P109"--> v2 c3 --"bd:sample.limit"--> c5 end v1 --"wdt:P31"--> c7 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P19".-> v3 v3 --"wdt:P625"--> v4 end bind2[/"sample(?signature_)"/] v2 --o bind2 bind2 --as--o v5 bind3[/"sample(?placeOfBirthCoordinates_)"/] v4 --o bind3 bind3 --as--o v6 subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c3 --"wikibase:language"--> c12 end