Skip to content

Commit 0e06f7a

Browse files
committed
Update transformation #589
1 parent 4491602 commit 0e06f7a

File tree

5 files changed

+1678
-30
lines changed

5 files changed

+1678
-30
lines changed

metafacture-runner/src/main/dist/examples/marc21-to-edm/MARC21-EDM.fix

Lines changed: 73 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,27 @@ do list(path:"650?7|60017|61017|61017|630??|655?7|651?7|648??","var":"SUBJECT")
9797
if any_match("SUBJECT_ID","^\\(DE-588\\)(.*)$")
9898
copy_field("SUBJECT_ID","skos:Concept.$append.~rdf:about")
9999
replace_all("skos:Concept.$last.~rdf:about","^\\(DE-588\\)(.*)$","http://d-nb.info/gnd/$1")
100-
copy_field("SUBJECT.a","skos:Concept.$last.~rdf:prefLabel$de")
100+
copy_field("SUBJECT.a","skos:Concept.$last.skos:prefLabel$de")
101101
end
102102
end
103103
end
104104

105-
unless exists("@publisherID")
106-
copy_field("2603 .b", "260bcount.$append")
107-
count("260bcount")
108-
paste("@publisherID", "~#/agent/","001","~-","260bcount", join_char:"")
105+
do list(path:"2603 ","var":"$i")
106+
do list(path:"$i.b","var":"$b")
107+
unless exists("@publisherID")
108+
copy_field("2603 .b", "260bcount.$append")
109+
copy_field("@publisherList","@publisherCount")
110+
if is_array("@publisherount")
111+
count("@publisherCount")
112+
else
113+
add_field("@publisherCount","1")
114+
end
115+
paste("@publisherID", "~#/agent/","001","~-","@publisherCount", join_char:"")
116+
end
117+
end
109118
end
110119

120+
111121
paste("@orgID","~http://ld.zdb-services.de/data/organisations/","@isil",join_char:"")
112122

113123
unless str_equal("$[sector]","")
@@ -116,7 +126,7 @@ end
116126

117127
replace_all("@sectorID","sec_","")
118128

119-
copy_field("@sectorID","edm:Agent.$append.*rdf:type")
129+
copy_field("@sectorID","edm:Agent.$append.#rdf:type")
120130
copy_field("@orgID","edm:Agent.$last.~rdf:about")
121131
copy_field("@isil","edm:Agent.$last.skos:prefLabel$de")
122132
lookup("edm:Agent.$last.skos:prefLabel$de","isils")
@@ -138,12 +148,43 @@ paste("@cEventID", "~#/event/", "001", "~-c", join_char:"")
138148

139149
paste("@pEventID", "~#/event/", "001", "~-p", join_char:"")
140150

141-
copy_field("@pEventID","edm:Agent.$last.*edm:wasPresent")
151+
copy_field("@pEventID","edm:Agent.$last.#edm:wasPresent")
152+
153+
do list(path:"2603 ","var":"$i")
154+
do list(path:"$i.a","var":"$a")
155+
unless exists("@place")
156+
copy_field("$a","@place")
157+
copy_field("$a","@placeList.$append")
158+
copy_field("@placeList","@placeCount")
159+
if is_array("@placeCount")
160+
count("@placeCount")
161+
else
162+
add_field("@placeCount","1")
163+
end
164+
end
165+
end
166+
end
167+
replace_all("@place"," \\[?u.a.\\]?.*$","")
168+
169+
paste("@placeID","~#/place/","001","~_place","@placeCount",join_char:"")
170+
171+
172+
do list(path:"260[ 3] ","var":"$i")
173+
do list(path:"$i.c","var":"$c")
174+
unless exists("@timeID")
175+
copy_field("$c","@timespan")
176+
copy_field("$c","@timespanList.$append")
177+
copy_field("@timespanList","@timespanCount")
178+
if is_array("@timespanCount")
179+
count("@timespanCount")
180+
else
181+
add_field("@timespanCount","1")
182+
end
183+
paste("@timeID","~#/timespan/","001","~_timespan","@timespanCount",join_char:"")
184+
end
185+
end
186+
end
142187

143-
# copy_field("2603 .a","@place")
144-
# replace_all("@place"," \\[?u.a.\\]?.*$","")
145-
# paste("@placeID","~#/place/","001","~_place","@place",join_char:"") # what is the count doing?
146-
paste("@timeID","~#/timespan/","001","~_timespan","260[ 3] .c",join_char:"")
147188

148189
paste("recordID","@recordIDUrl","001","@recordIDSuffix", join_char:"")
149190

@@ -163,7 +204,7 @@ do list(path:"1001 |1101 |7001 |7101", "var":"CREATOR")
163204
copy_field("CREATORID","edm:Agent.$append.~rdf:about")
164205
replace_all("edm:Agent.$last.~rdf:about", "^\\(DE-588\\)(.*)$","http://d-nb.info/gnd/$1")
165206
copy_field("CREATOR.a","edm:Agent.$last.skos:prefLabel$de")
166-
copy_field("@cEventID","edm:Agent.$last.*edm:wasPresent")
207+
copy_field("@cEventID","edm:Agent.$last.#edm:wasPresent")
167208
end
168209
end
169210
end
@@ -173,15 +214,15 @@ copy_field("@cEventID","edm:Event.$append.~rdf:about")
173214
add_field("edm:Event.$last.edm:hasType", "http://terminology.lido-schema.org/lido00012")
174215
do list(path:"edm:Agent","var":"AGENT")
175216
if any_match("AGENT.~rdf:about", "http://d-nb.info/gnd/.*")
176-
copy_field("AGENT.~rdf:about", "edm:Event.$last.*crm:P11_had_participant.$append")
217+
copy_field("AGENT.~rdf:about", "edm:Event.$last.#crm:P11_had_participant.$append")
177218
end
178219
end
179220

180221
copy_field("@pEventID","edm:Event.$append.~rdf:about")
181222
add_field("edm:Event.$last.edm:hasType", "http://terminology.lido-schema.org/lido00228")
182-
copy_field("@publisherID", "edm:Event.$last.*crm:P11_had_participant.$append")
183-
copy_field("@timeID", "edm:Event.$last.*edm:occuredAt")
184-
copy_field("@placeID", "edm:Event.$last.*edm:happenedAt")
223+
copy_field("@publisherID", "edm:Event.$last.#crm:P11_had_participant.$append")
224+
copy_field("@timeID", "edm:Event.$last.#edm:occuredAt")
225+
copy_field("@placeID", "edm:Event.$last.#edm:happenedAt")
185226

186227

187228

@@ -197,7 +238,7 @@ copy_field("260[ 3] .c","edm:TimeSpan.skos:notation")
197238

198239

199240

200-
copy_field("@mediatypeID","skos:Concept.$append.rdf:about")
241+
copy_field("@mediatypeID","skos:Concept.$append.~rdf:about")
201242
unless str_equal("$[media_type]","")
202243
add_field("skos:Concept.$last.skos:notation","$[media_type]")
203244
end
@@ -214,7 +255,7 @@ add_field("*dcterms:rights","http://creativecommons.org/publicdomain/zero/1.0/")
214255

215256
copy_field("@recordID","edm:ProvidedCHO.~rdf:about")
216257

217-
copy_field("@pEventID|@cEventID","edm:ProvidedCHO.*edm:wasPresent.$append")
258+
copy_field("@pEventID|@cEventID","edm:ProvidedCHO.#edm:wasPresent.$append")
218259

219260
copy_field("@mat","edm:ProvidedCHO.dc:type")
220261

@@ -229,7 +270,7 @@ end
229270

230271
copy_field("@lang","edm:ProvidedCHO.dc:language")
231272

232-
paste("edm:ProvidedCHO.*dcterms:language","~http://id.loc.gov/vocabulary/iso639-2/","@lang",join_char:"")
273+
paste("edm:ProvidedCHO.#dcterms:language","~http://id.loc.gov/vocabulary/iso639-2/","@lang",join_char:"")
233274

234275

235276

@@ -239,20 +280,25 @@ copy_field("1[10]1 .a","edm:ProvidedCHO.dc:creator.$append")
239280

240281
copy_field("7[10]1 .a","edm:ProvidedCHO.dc:contributor.$append")
241282

242-
do list(path:"650?7|60017|61017|61017|630??|655?7|651?7|648??","var":"SUBJECT")
243-
copy_field("SUBJECT.a", "edm:ProvidedCHO.dc:subject.$append")
244-
end
245-
246283

247284
do list(path:"830??|800??|810??|811??","var":"$i")
248285
do list(path:"$i.w","var":"$j")
249286
if any_match("$j","^\\(DE-101\\)(.*)$")
250-
copy_field("$j","edm:ProvidedCHO.*dcterms:isPartOf.$append")
287+
copy_field("$j","edm:ProvidedCHO.#dcterms:isPartOf.$append")
288+
end
289+
end
290+
end
291+
292+
do list(path:"650?7|60017|61017|61017|630??|655?7|651?7|648??","var":"$SUBJECT")
293+
do list(path:"$SUBJECT.0","var":"$SUBJECT_ID")
294+
if any_match("$SUBJECT_ID","^\\(DE-588\\)(.*)$")
295+
copy_field("$SUBJECT.a","edm:ProvidedCHO.dc:subject.$append")
296+
copy_field("$SUBJECT_ID","edm:ProvidedCHO.#dc:subject.$append")
251297
end
252298
end
253299
end
254300

255-
replace_all("edm:ProvidedCHO.*dcterms:isPartOf.*","^\\(DE-101\\)(.*)$","http://d-nb.info/$1")
301+
replace_all("edm:ProvidedCHO.#dcterms:isPartOf.*","^\\(DE-101\\)(.*)$","http://d-nb.info/$1")
256302

257303

258304
paste("edm:ProvidedCHO.dc:title","24510.a","24510.b",join_char:" : ")
@@ -266,7 +312,7 @@ copy_field("502??.a","edm:ProvidedCHO.dc:description.$append")
266312

267313

268314
unless str_equal("$[dnb_subject]","")
269-
add_field("edm:ProvidedCHO.*dc:subject", "$[dnb_subject]")
315+
add_field("edm:ProvidedCHO.#dc:subject", "$[dnb_subject]")
270316
add_field("@dnbSubjectID","$[dnb_subject]")
271317
end
272318

@@ -287,4 +333,4 @@ do list(path:"85640","var":"$i")
287333
end
288334

289335

290-
retain("edm:*","dc*")
336+
retain("edm*","dc*","skos*", "aggregation_id")

metafacture-runner/src/main/dist/examples/marc21-to-edm/MARC21-EDM.flux

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
default out = "stdout";
1+
default out = FLUX_DIR + "test-fix.xml";
22
default file = FLUX_DIR + "Test_DNB_Mono.xml";
33
default id = "1025374754";
44
default sector = "sec_002";
@@ -14,6 +14,6 @@ decode-xml|
1414
handle-marcxml|
1515
fix(FLUX_DIR + "MARC21-EDM.fix", *)|
1616
add-oreaggregation|
17-
rdf-macros|
17+
rdf-macros(referenceMarker="#")|
1818
encode-xml(roottag="rdf:RDF", recordtag="", namespacefile= FLUX_DIR+"edm-namespaces.properties")|
1919
write(out);

0 commit comments

Comments
 (0)