-
Notifications
You must be signed in to change notification settings - Fork 2
/
memories_obs_spatial.rq
47 lines (41 loc) · 1.78 KB
/
memories_obs_spatial.rq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# gives map of N observations per municipality
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX schema: <http://schema.org/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX iisgv: <https://iisg.amsterdam/openarchdeaths1910_1920/vocab/>
PREFIX iisgv2: <https://iisg.amsterdam/openarchdeath/vocab/>
PREFIX gg: <http://www.gemeentegeschiedenis.nl/gg-schema#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX bio: <http://purl.org/vocab/bio/0.1/>
PREFIX bif: <http://www.openlinksw.com/schemas/bif#>
SELECT DISTINCT ?gg_gemeente ?n ?wktColor ?wktTooltip ?wkt
WHERE {
{
select (count(?id) as ?n) ?gg_gemeente ?max ?wkt
{
{
select (max(?wktyear) as ?max) ?gg_gemeente
{
?gg_gemeente geo:hasGeometry ?geo .
?geo gg:year ?wktyear .
FILTER(?wktyear <= "1920"^^xsd:gYear)
}
}
?gg_gemeente geo:hasGeometry [gg:year ?max ;
geo:asWKT ?wkt ] .
?id schema:Residence ?gemeente .
?gemeente gg:Municipality ?gg_gemeente .
FILTER NOT EXISTS {
?gg_gemeente gg:startDate ?startdate
FILTER(?startdate >= "1921-01-01"^^<http://www.w3.org/2001/XMLSchema#date>) }
# FILTER NOT EXISTS { #to select only municipalities that existed, but for some reason throws out whole Friesland
# ?gg_gemeente gg:endDate ?enddate
# FILTER(?enddate <= "1918-01-01"^^<http://www.w3.org/2001/XMLSchema#date>)}
}
}
BIND ( IF ( ?n > 70, 1, IF ( ?n > 40, 0.75, IF (?n >= 20, 0.50, IF(?n >=10, 0.35, 0.1 )))) AS ?category)
BIND(concat('reds,', (?category)) as ?wktColor)
BIND(concat((?n),'_', STRAFTER(STR(?gg_gemeente), 'gemeentenaam/')) as ?wktTooltip)
}
ORDER BY desc (?n)