User:Ainali/WitchMapQuery

From Wikidata
Jump to navigation Jump to search
#defaultView:Map
SELECT
  ?item
  ?itemLabel
  ?deathPlaceLabel
  ?coords
  (if(BOUND(?linkfr), concat('[[', substr(str(?linkfr),31,500),  '|', ?itemLabel, ']]'), ?itemLabel)
   as ?title)
  (concat('décès en ',
    if (BOUND(?death), str(YEAR(?death)), '- date inconnue -'),
    ' à ',
    ?deathPlaceLabel,
    '\n\n',
    if(BOUND(?image), concat('[[File:', substr(str(?image), 52, 500), '|200px]]'), ''),
    if (BOUND(?linken), concat(' [[:en:', substr(str(?linken),31,500),  '|(en)]]'), ''),
    if (BOUND(?linkde), concat(' [[:de:', substr(str(?linkde),31,500),  '|(de)]]'), ''),
    if (BOUND(?linkes), concat(' [[:es:', substr(str(?linkes),31,500),  '|(es)]]'), ''),
    if (BOUND(?linkno), concat(' [[:no:', substr(str(?linkno),31,500),  '|(no)]]'), '')
  )
   as ?description)
  ('1000' as ?randomise)
  ?linkfr
  ?linkde
  ?linken
  ?linkes
  ?linkno
  ?layer
WHERE {
  { ?item wdt:P1399 wd:Q259745. }
  UNION
  { ?item wdt:P1595 wd:Q259745. }
  ?item wdt:P20 ?deathPlace.
  ?deathPlace wdt:P625 ?coords.
  OPTIONAL { ?item wdt:P21 ?gender. }
  OPTIONAL { ?item wdt:P570 ?death. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en". ?gender rdfs:label ?genderLabel}
  OPTIONAL { ?item wdt:P18 ?image. }
  OPTIONAL {
    ?linkfr schema:about ?item .
    ?linkfr schema:isPartOf <https://fr.wikipedia.org/> .
  }
  OPTIONAL {
    ?linkde schema:about ?item .
    ?linkde schema:isPartOf <https://de.wikipedia.org/> .
  }
  OPTIONAL {
    ?linken schema:about ?item .
    ?linken schema:isPartOf <https://en.wikipedia.org/> .
  }
  OPTIONAL {
    ?linkes schema:about ?item .
    ?linkes schema:isPartOf <https://es.wikipedia.org/> .
  }
  OPTIONAL {
    ?linkno schema:about ?item .
    ?linkno schema:isPartOf <https://no.wikipedia.org/> .
  }
  BIND(?genderLabel AS ?layer )
}
Try it!