query-31acbb3d79fbe87bc15c27ef84d9e874
Some improvements for map queryHello again, I start a new paragraph because new ideas and questions. I'd like to achieve some small improvements in this layered map visualization: any chance to influence the order of the properties in the map bubble? (ok, at this point I might need to set up my own leaflet website and use the JSON-API, I suppose …) a map layer (instead of ?year) with (manually) grouped values for ?typology, like „private building“, „public building“, „bridge“ etc. (P279 won't work here, much more chaos as P31 alone …) Any ideas? and it would be nice to have a shorte clickable link text, like „more images“ for the Commons category. would like to add a small string prefix to the year output, like so: „KAP: 1967“, where to put the concat? cannot get the ?itemDescription to work, I might have missed the way to label it properly
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map{"hide":"?coords","layer":"?year"}
SELECT
?item ?itemLabel ?itemDescription ?commonsuri ?typologyLabel
?coords
(SAMPLE(?img) as ?image)
(MIN(YEAR(?date)) as ?year)
(GROUP_CONCAT(DISTINCT ?architectLabel;separator=", ") AS ?architects)
WHERE
{
?item wdt:P166 wd:Q1795794;
p:P166 [ps:P166 ?award; pq:P585 ?date];
wdt:P31 ?typology.
#let's try to get the Commons Link:
OPTIONAL {?comm schema:about ?item ; schema:isPartOf <https://commons.wikimedia.org/> .} # ?comm = other websites Commons link
BIND(replace(wikibase:decodeUri(SUBSTR(STR(?comm), 45)),"_"," ") AS ?comm_decode) # decode it
OPTIONAL {?item wdt:P373 ?p373 .} # or get the Commonscat property
BIND(COALESCE(?comm_decode, ?p373) as ?cat) . # ?cat = first fit
BIND(IRI(CONCAT("https://commons.wikimedia.org/wiki/",?cat)) as ?commonsuri). # how to make this clickable link a bit cleaner? Just “more images"
OPTIONAL{
?item wdt:P625 ?coords.
}
OPTIONAL{
?item wdt:P18 ?img.
}
OPTIONAL {
?item wdt:P84 ?architect. # will be grouped
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de" .
?item rdfs:label ?itemLabel .
?architect rdfs:label ?architectLabel .
?typology rdfs:label ?typologyLabel.
}
}
GROUP BY ?item ?itemLabel ?itemDescription ?coords ?commonsuri ?typologyLabel
LIMIT 300