Wikidata:Tools/Monumental/Technical Details

From Wikidata
Jump to: navigation, search

Below you can find technical implementation in Monumental.

Monument view (#/object/<id>)[edit]

Empire State Building (Q9188) used as example.

Data about monument
https://www.wikidata.org/w/api.php?action=wbgetentities&format=json&ids=Q9188&props=info%7Clabels%7Caliases%7Cdescriptions%7Cclaims%7Cdatatype%7Csitelinks
Location of monument
SELECT ?parent ?parentLabel WHERE {
 wd:Q9188 wdt:P276/wdt:P131* ?parent .
 SERVICE wikibase:label { bd:serviceParam wikibase:language "en, de" }
}

Try it!

List view (#/list/<id>)[edit]

Moabit (Q699800) used as example.

List of monuments
SELECT DISTINCT ?item ?itemLabel (SAMPLE(?admin) AS ?admin) (SAMPLE(?adminLabel) AS ?adminLabel) (SAMPLE(?coord) AS ?coord) (SAMPLE(?image) AS ?image)
WHERE {
  ?item p:P1435 ?monument; wdt:P131* wd:Q699800; wdt:P131 ?admin; wdt:P625 ?coord .
  OPTIONAL { ?item wdt:P18 ?image } 
  OPTIONAL { ?admin rdfs:label ?adminLabel . FILTER(LANG(?adminLabel) IN ("en")) }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en, de" }
}
GROUP BY ?item ?itemLabel
ORDER BY ?itemLabel

Try it!

Map view (#/map?c=<lat>:<lon>:<zoom>)[edit]

List of monuments
SELECT ?item ?itemLabel ?admin ?adminLabel ?image ?coord ?heritage
WHERE {
  SERVICE wikibase:box {
    ?item wdt:P625 ?coord .
    bd:serviceParam wikibase:cornerWest "Point(2.2821521759033208 48.852955004124134)"^^geo:wktLiteral .
    bd:serviceParam wikibase:cornerEast "Point(2.30663537979126 48.86364195726954)"^^geo:wktLiteral .
  }
  OPTIONAL { ?item wdt:P131 ?admin . }
  OPTIONAL { ?item wdt:P18 ?image . }
  ?item wdt:P1435 ?heritage .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de" }
}

Try it!