query-21fdb47e61731a89219eddc62f008f47
Content
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 psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map{"hide":["?placeCoords", "?line", "?rgb"]}
SELECT ?item ?itemLabel ?place ?placeLabel ?placeCoords ?layer ?line ?rgb
{
{ {
SELECT ?item ?line {
{
SELECT ?item ?birth ?birthCoords ?birthCoordsLo ?birthCoordsLa ?death ?deathCoords ?deathCoordsLo ?deathCoordsLa {
INCLUDE %0.
?item
p:P19 [
ps:P19 ?birth;
wikibase:rank wikibase:NormalRank;
ps:P19/p:P625 [
ps:P625 ?birthCoords;
psv:P625 [
wikibase:geoLongitude ?birthCoordsLo;
wikibase:geoLatitude ?birthCoordsLa
]
]
];
p:P20 [
ps:P20 ?death;
wikibase:rank wikibase:NormalRank;
ps:P20/p:P625 [
ps:P625 ?deathCoords;
psv:P625 [
wikibase:geoLongitude ?deathCoordsLo;
wikibase:geoLatitude ?deathCoordsLa
]
]
];
}
}
BIND(CONCAT('LINESTRING(', STR(?birthCoordsLo), ' ', STR(?birthCoordsLa), ',', STR(?deathCoordsLo), ' ', STR(?deathCoordsLa), ')') AS ?str).
BIND(STRDT(?str, geo:wktLiteral) AS ?line).
}
}}
UNION
{ {
SELECT
?item
(?birth AS ?place)
(?birthCoords AS ?placeCoords)
(?birthCoordsLa AS ?placeCoordsLa)
(?birthCoordsLo AS ?placeCoordsLo)
(wdt:P19 AS ?p)
{
{
SELECT ?item ?birth ?birthCoords ?birthCoordsLo ?birthCoordsLa ?death ?deathCoords ?deathCoordsLo ?deathCoordsLa {
INCLUDE %0.
?item
p:P19 [
ps:P19 ?birth;
wikibase:rank wikibase:NormalRank;
ps:P19/p:P625 [
ps:P625 ?birthCoords;
psv:P625 [
wikibase:geoLongitude ?birthCoordsLo;
wikibase:geoLatitude ?birthCoordsLa
]
]
];
p:P20 [
ps:P20 ?death;
wikibase:rank wikibase:NormalRank;
ps:P20/p:P625 [
ps:P625 ?deathCoords;
psv:P625 [
wikibase:geoLongitude ?deathCoordsLo;
wikibase:geoLatitude ?deathCoordsLa
]
]
];
}
}
}
}}
UNION
{ {
SELECT
?item
(?death AS ?place)
(?deathCoords AS ?placeCoords)
(?deathCoordsLa AS ?placeCoordsLa)
(?deathCoordsLo AS ?placeCoordsLo)
(wdt:P20 AS ?p)
{
{
SELECT ?item ?birth ?birthCoords ?birthCoordsLo ?birthCoordsLa ?death ?deathCoords ?deathCoordsLo ?deathCoordsLa {
INCLUDE %0.
?item
p:P19 [
ps:P19 ?birth;
wikibase:rank wikibase:NormalRank;
ps:P19/p:P625 [
ps:P625 ?birthCoords;
psv:P625 [
wikibase:geoLongitude ?birthCoordsLo;
wikibase:geoLatitude ?birthCoordsLa
]
]
];
p:P20 [
ps:P20 ?death;
wikibase:rank wikibase:NormalRank;
ps:P20/p:P625 [
ps:P625 ?deathCoords;
psv:P625 [
wikibase:geoLongitude ?deathCoordsLo;
wikibase:geoLatitude ?deathCoordsLa
]
]
];
}
}
}
}}
BIND(COALESCE(IF(?p = wdt:P19, "place of birth", 1/0),
IF(?p = wdt:P20, "place of death", 1/0))
AS ?layer).
BIND(COALESCE(IF(?p = wdt:P19, "ff0000", 1/0),
IF(?p = wdt:P20, "000000", 1/0))
AS ?rgb).
SERVICE wikibase:label {bd:serviceParam wikibase:language "en"}.
}