-
Notifications
You must be signed in to change notification settings - Fork 0
/
link-sab.html
189 lines (151 loc) · 7.39 KB
/
link-sab.html
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<!DOCTYPE html>
<title>Linking : LD Slides</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="ldslides.css" />
<script type="module">
import {Steps} from './ldslides.js'
let steps = new Steps(window)
steps.load(`
<btm92gjn5q8pkjx#it> a :Instance ;
:issuanceType :Monograph ;
marc:mediaTerm "Kartografiskt material" ;
:hasTitle [ a :Title ;
:mainTitle "Vattendragsutredningens förslag till vattendrag som bör skyddas enligt naturresurslagen (NRL)" ] ;
:responsibilityStatement "producerad av SMHI" ;
:instanceOf [ a :Cartography ;
:contribution [ a :PrimaryContribution ;
:agent <tr5757qc3zhq910#it> ] ;
:genreForm <https://id.kb.se/marc/GovernmentPublicationType-1> ;
:language <https://id.kb.se/language/swe> ;
:subject <https://id.kb.se/term/sao/Sverige> ;
:classification [ a :Classification ;
:code "Ubbbd-c" ;
:inScheme [ a :ConceptScheme ;
:code "kssb" ;
:sameAs <https://id.kb.se/term/kssb%2F6/> ;
:version "6" ] ] ,
[ a :Classification ;
:code "Uh-c" ;
:inScheme [ a :ConceptScheme ;
:code "kssb" ;
:sameAs <https://id.kb.se/term/kssb%2F6/> ;
:version "6" ] ] ,
[ a :Classification ;
:code "Ubbbd-c/K" ;
:inScheme [ a :ConceptScheme ;
:code "kssb" ;
:version "6" ] ] ,
[ a :Classification ;
:code "Uh-c/K" ;
:inScheme [ a :ConceptScheme ;
:code "kssb" ;
:version "6" ] ] ;
:cartographicAttributes [ a :Cartographic ;
:coordinates "Ö 10⁰50'-Ö 24⁰11'/N 69⁰04'-N 55⁰20'" ;
:scale [ a :Scale ;
:label "Skala 1:2 500 000" ] ] ;
] ;
:projection <https://id.kb.se/marc/MapsProjectionType-a> ;
:classification [ a :Classification ;
:code "Ubbbd-c/K" ;
:inScheme [ a :ConceptScheme ;
:code "kssb" ;
:sameAs <https://id.kb.se/term/kssb%2F6/> ;
:version "6" ] ] ,
[ a :Classification ;
:code "Uh-c/K" ;
:inScheme [ a :ConceptScheme ;
:code "kssb" ;
:sameAs <https://id.kb.se/term/kssb%2F6/> ;
:version "6" ] ] ;
:publication [ a :PrimaryPublication ;
:country <https://id.kb.se/country/sw> ;
:place [ a :Place ; :label "[Stockholm]" ] ;
:year "1996" ] ;
:meta <btm92gjn5q8pkjx> .
`)
const ref = id => ( { ['@id']: id } )
const print = 'btm92gjn5q8pkjx#it'
const work = 'work1#it'
const sabref = ref('https://id.kb.se/term/kssb/6')
steps.display('Extrahera verket till ny post')
steps.extractAsLink(print, 'instanceOf', work)
steps.display('Ta bort redundant klassifikation', {incomplete: true})
steps.drop(work, ['classification', 3])
steps.complete().drop(work, ['classification', 2])
steps.display('Visa SAB (för referens)')
steps.create(`
<SAB> {
<https://id.kb.se/term/kssb/6> a :ConceptScheme; :code "kssb"; :version "6" .
#<https://id.kb.se/term/kssb/6/U> a :Classification ;
# :code "U"; :prefLabel "Naturvetenskap"@sv .
#<https://id.kb.se/term/kssb/6/Ub> a :Classification ;
# :broader <https://id.kb.se/term/kssb/6/U> ;
# :code "Ub"; :prefLabel "Geofysik"@sv .
#<https://id.kb.se/term/kssb/6/Ubb> a :Classification ;
# :broader <https://id.kb.se/term/kssb/6/Ub> ;
# :code "Ubb"; :prefLabel "Oceanografi och hydrologi"@sv .
#<https://id.kb.se/term/kssb/6/Ubbb> a :Classification ;
# :broader <https://id.kb.se/term/kssb/6/Ubb> ;
# :code "Ubbb"; :prefLabel "Hydrologi"@sv .
<https://id.kb.se/term/kssb/6/Ubbbd> a :Classification ;
:broader <https://id.kb.se/term/kssb/6/Ubbb> ;
:code "Ubbbd"; :prefLabel "Floder, älvar, åar"@sv .
<https://id.kb.se/term/kssb/6/Uh> a :Classification ;
:broader <https://id.kb.se/term/kssb/6/U> ;
:code "Uh"; :prefLabel "Miljöfrågor och naturskydd"@sv .
<https://id.kb.se/term/kssb/6/-c> a :GeographicElement ; :code "-c"; :prefLabel "Sverige"@sv .
<https://id.kb.se/term/kssb/6/media/K> a :MediaElement ; :code "/K"; :prefLabel "Kartor in plano"@sv .
} `)
steps.display('Länka scheme', {incomplete: true})
steps.replace(print, ['classification', 0, 'inScheme'], sabref)
steps.replace(print, ['classification', 1, 'inScheme'], sabref)
steps.replace(work, ['classification', 0, 'inScheme'], sabref)
steps.complete().replace(work, ['classification', 1, 'inScheme'], sabref)
const sab = 'https://id.kb.se/term/kssb/6'
const dash_c = 'https://id.kb.se/term/kssb/6/-c'
const media_k = 'https://id.kb.se/term/kssb/6/media/K'
const uddb = 'https://id.kb.se/term/kssb/6/Ubbbd'
const uddb_c = `${uddb}-c`
const uh = 'https://id.kb.se/term/kssb/6/Uh'
const uh_c = `${uh}-c`
steps.display('"Prekoordinera" koder', {incomplete: true})
steps.extractAsLink(work, ['classification', 0], uddb_c)
steps.complete().extractAsLink(work, ['classification', 1], uh_c)
steps.display('Ersätt koder med länkar', {incomplete: true})
//steps.add(uddb_c, 'broader', [ref(uddb), ref(dash_c)])
//steps.add(uh_c, 'broader', [ref(uh), ref(dash_c)])
steps.replace(uddb_c, 'code', [ref(uddb), ref(dash_c)], 'termComponentList')
steps.replace(uh_c, 'code', [ref(uh), ref(dash_c)], 'termComponentList')
steps.replace(print, ['classification', 0, 'code'], [ref(uddb_c), ref(media_k)], 'termComponentList')
steps.complete().replace(print, ['classification', 1, 'code'], [ref(uh_c), ref(media_k)], 'termComponentList')
const sao = 'https://id.kb.se/term/sao'
const maps = 'https://id.kb.se/term/gmgpc/swe/Kartor'
// Här börjar den *reducerande* normaliseringen...
steps.display('Visa SAO + GMGPC (referenser)')
steps.create(`
<SAO> {
<https://id.kb.se/term/sao/Sverige> a :Topic ; :prefLabel "Sverige"@sv .
<https://id.kb.se/term/sao/Vattendrag> a :Topic ; :prefLabel "Vattendrag"@sv .
<https://id.kb.se/term/sao/Milj%C3%B6fr%C3%A5gor> a :Topic ; :prefLabel "Miljöfrågor"@sv .
<https://id.kb.se/term/sao/Naturv%C3%A5rd> a :Topic ; :prefLabel "Naturvård"@sv .
<https://id.kb.se/term/gmgpc/swe/Kartor> a :GenreForm ; :prefLabel "Kartor"@sv .
} `)
steps.display('Matcha termer med SAB...', {incomplete: true})
steps.add(`${sao}/Sverige`, 'exactMatch', ref(dash_c))
steps.add(`${sao}/Vattendrag`, 'narrowMatch', ref(uddb))
steps.add(`${sao}/Milj%C3%B6fr%C3%A5gor`, 'broadMatch', ref(uh))
steps.add(`${sao}/Naturv%C3%A5rd`, 'broadMatch', ref(uh))
steps.complete().add(maps, 'narrowMatch', ref(media_k))
steps.display('Lägg på ämnesord', {incomplete: true})
steps.add(work, 'subject', ref(`${sao}/Sverige`)) // already present (just showing link)
steps.add(work, 'subject', ref(`${sao}/Vattendrag`), true)
steps.add(work, 'subject', ref(`${sao}/Milj%C3%B6fr%C3%A5gor`), true)
steps.complete().add(work, 'subject', ref(`${sao}/Naturv%C3%A5rd`), true)
steps.display('Gör om media-term till genre/form på trycket')
steps.replace(print, 'marc:mediaTerm', ref(maps), 'genreForm')
steps.display('Ta bort klassifikation från trycket', {note: 'Vad "Kartor in plano" tillför på en kartografisk resurs bör diskuteras (här anses en genre/form-term tillräcklig)'})
steps.drop(print, 'classification')
steps.display('Ta bort <em>all</em> klassifikation', {note: 'Givet att en automatisk metod för att följa länkarna och pussla ihop SAB-koden finns på plats.'})
steps.drop(work, 'classification')
</script>