Skip to content

Commit aef651e

Browse files
committed
Add urban areas and principal place to geo core
1 parent 61e4b86 commit aef651e

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ source/sab.ttl: scripts/extract_sab_data_from_docx.py cache/esab-2015_1.docx
1010
# TODO 2: In XL, add precomposed usages (extract from usage in records)? See:
1111
# ../librisxl/marc_export/src/main/resources/se/kb/libris/export/sabrub.txt # precomposed
1212

13-
cache/geocore.ttl: source/geo/construct-geocore.rq
14-
scripts/rq.sh https://query.wikidata.org/sparql $^ | scripts/fmt.sh > $@
15-
#scripts/construct.py source/geo/modify-geocore.rq cache/wd-geocore.ttl > $@
13+
cache/geocore.ttl: cache/remote-geocore.ttl
14+
cat $^ | scripts/fmt.sh > $@
15+
#scripts/construct.py source/geo/modify-geocore.rq $^ > $@
1616

17+
cache/remote-geocore.ttl: source/geo/construct-geocore.rq
18+
scripts/rq.sh https://query.wikidata.org/sparql $^ > $@

scripts/fmt.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/bash
2-
trld -ittl -e -f -c context.jsonld -B -ottl | sed 's/rdf:type/a/'
2+
trld -ittl -e -f -c $(dirname $0)/../build/sys/context/kbv.jsonld -B -ottl | sed 's/rdf:type/a/'

source/geo/construct-geocore.rq

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ CONSTRUCT {
1919
:code ?swedishMunicipalityCode ;
2020
:geo ?geo ;
2121
:locatedIn ?locatedIn ;
22+
:principalPlace ?capital ;
2223
:country <https://id.kb.se/country/sw> ;
2324
:startDate ?foundingDate ;
2425
:image ?image .
@@ -33,14 +34,13 @@ CONSTRUCT {
3334
?wdplace a|wdt:P31 ?type ;
3435
wdt:P17 wd:Q34 . # :country Sweden
3536

36-
FILTER EXISTS { ?type wdt:P279* wd:Q914262 } # administrative territorial entity of Sweden
37-
#FILTER EXISTS {
38-
# {
39-
# ?type wdt:P279* wd:Q914262 # administrative territorial entity of Sweden
40-
# } UNION {
41-
# ?wdplace wdt:P1376 [] . # :capital :label "centralort"@sv
42-
# }
43-
#}
37+
FILTER EXISTS {
38+
{
39+
?type wdt:P279* wd:Q914262 # administrative territorial entity of Sweden
40+
} UNION {
41+
?type wdt:P279* wd:Q12813115 # urban area of Sweden
42+
}
43+
}
4444

4545
?wdplace rdfs:label ?label .
4646

@@ -73,6 +73,12 @@ CONSTRUCT {
7373
BIND(?wdplace AS ?sameAs)
7474
}
7575

76+
OPTIONAL {
77+
?wdplace wdt:P36 ?capital .
78+
# :capital :label "centralort"@sv
79+
# (Cf. wdt:P1376 == huvudstad.)
80+
}
81+
7682
BIND(IF(?wdLocatedIn = wd:Q34, idkbse:country\/sw, ?wdLocatedIn) AS ?locatedIn)
7783
BIND(IF(BOUND(?dsId), ?dsId, ?wdplace) AS ?place)
7884

0 commit comments

Comments
 (0)