bibframe_ruby 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +24 -2
- data/docs/superpowers/plans/2026-09-09-marc-conversion.md +537 -0
- data/docs/superpowers/specs/2026-09-09-marc-conversion-design.md +110 -0
- data/lib/bibframe_ruby/marc_converter.rb +67 -0
- data/lib/bibframe_ruby/parser.rb +4 -2
- data/lib/bibframe_ruby/version.rb +1 -1
- data/lib/bibframe_ruby.rb +7 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-001-007.xsl +2276 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-006,008.xsl +1295 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-010-048.xsl +1712 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-050-088.xsl +713 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-1XX,7XX,8XX-names.xsl +1141 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-200-247not240-Titles.xsl +771 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-240andX30-UnifTitle.xsl +535 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-250-270.xsl +283 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-3XX.xsl +2245 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-460-468-SeriesTreat.xsl +135 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-490-510-Links.xsl +145 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-5XX.xsl +1448 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-600-662.xsl +1417 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-720+740to755.xsl +333 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-758.xsl +102 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-760-788-Links.xsl +771 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-841-887.xsl +328 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-880.xsl +119 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-ControlSubfields.xsl +495 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-LDR.xsl +183 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-Preprocess0-Splitting.xsl +765 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-Process6-Series.xsl +627 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-Process8-ProvAct.xsl +1021 -0
- data/vendor/marc2bibframe2/xsl/conf/abbreviations.xml +13 -0
- data/vendor/marc2bibframe2/xsl/conf/code-to-script.xml +399 -0
- data/vendor/marc2bibframe2/xsl/conf/codeMaps.xml +723 -0
- data/vendor/marc2bibframe2/xsl/conf/exclusions.xml +4 -0
- data/vendor/marc2bibframe2/xsl/conf/iso6392-to-1.xml +615 -0
- data/vendor/marc2bibframe2/xsl/conf/languageCrosswalk.xml +1503 -0
- data/vendor/marc2bibframe2/xsl/conf/map880.xml +175 -0
- data/vendor/marc2bibframe2/xsl/conf/scriptCrosswalk.xml +210 -0
- data/vendor/marc2bibframe2/xsl/conf/subjectThesaurus.xml +29 -0
- data/vendor/marc2bibframe2/xsl/marc2bibframe2.xsl +610 -0
- data/vendor/marc2bibframe2/xsl/naco-normalize.xsl +205 -0
- data/vendor/marc2bibframe2/xsl/utils.xsl +963 -0
- data/vendor/marc2bibframe2/xsl/variables.xsl +108 -0
- metadata +68 -1
|
@@ -0,0 +1,610 @@
|
|
|
1
|
+
<?xml version='1.0'?>
|
|
2
|
+
<xsl:stylesheet version="1.0"
|
|
3
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
4
|
+
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
|
|
5
|
+
xmlns:marc="http://www.loc.gov/MARC21/slim"
|
|
6
|
+
xmlns:bf="http://id.loc.gov/ontologies/bibframe/"
|
|
7
|
+
xmlns:bflc="http://id.loc.gov/ontologies/bflc/"
|
|
8
|
+
xmlns:madsrdf="http://www.loc.gov/mads/rdf/v1#"
|
|
9
|
+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
10
|
+
xmlns:date="http://exslt.org/dates-and-times"
|
|
11
|
+
extension-element-prefixes="date"
|
|
12
|
+
exclude-result-prefixes="xsl marc">
|
|
13
|
+
|
|
14
|
+
<xsl:output encoding="UTF-8" method="xml" indent="yes"/>
|
|
15
|
+
<xsl:strip-space elements="*"/>
|
|
16
|
+
|
|
17
|
+
<!-- stylesheet parameters -->
|
|
18
|
+
|
|
19
|
+
<!-- base for minting URIs -->
|
|
20
|
+
<xsl:param name="baseuri" select="'http://example.org/'"/>
|
|
21
|
+
|
|
22
|
+
<!--
|
|
23
|
+
MARC field in which to find the record ID
|
|
24
|
+
Defaults to subfield $a, to use a different subfield,
|
|
25
|
+
add to the end of the tag (e.g. "035a")
|
|
26
|
+
-->
|
|
27
|
+
<xsl:param name="idfield" select="'001'"/>
|
|
28
|
+
|
|
29
|
+
<!--
|
|
30
|
+
URI for record source, default none,
|
|
31
|
+
e.g. http://id.loc.gov/vocabulary/organizations/dlc
|
|
32
|
+
To run test of idsource, comment out next line, uncomment
|
|
33
|
+
following line, and uncomment the test in
|
|
34
|
+
test/ConvSpec-001-007.xspec
|
|
35
|
+
-->
|
|
36
|
+
<xsl:param name="idsource"/>
|
|
37
|
+
<!-- <xsl:param name="idsource" select="'http://id.loc.gov/vocabulary/organizations/dlc'"/> -->
|
|
38
|
+
|
|
39
|
+
<!--
|
|
40
|
+
Use field conversion for locally defined fields.
|
|
41
|
+
Some fields in the conversion (e.g. 859) are locally defined by
|
|
42
|
+
LoC for conversion. By default these fields will not be
|
|
43
|
+
converted unless this parameter evaluates to true()
|
|
44
|
+
-->
|
|
45
|
+
<xsl:param name="localfields" select="false()" />
|
|
46
|
+
|
|
47
|
+
<!--
|
|
48
|
+
Infer script from BCP47 code.
|
|
49
|
+
If true, BCP47 codes will not include
|
|
50
|
+
the script component when it can be inferred from the language component.
|
|
51
|
+
If false, the script component (the "-cyrl" of ru-cyrl) will be included in
|
|
52
|
+
the code. At all times codes will be lowercased.
|
|
53
|
+
-->
|
|
54
|
+
<xsl:param name="bcp47inferrence" select="true()" />
|
|
55
|
+
|
|
56
|
+
<!--
|
|
57
|
+
datestamp for generationProcess property of Work adminMetadata
|
|
58
|
+
Useful to override if date:date-time() extension is not
|
|
59
|
+
available
|
|
60
|
+
-->
|
|
61
|
+
<xsl:param name="pGenerationDatestamp">
|
|
62
|
+
<xsl:choose>
|
|
63
|
+
|
|
64
|
+
<xsl:when test="function-available('date:date-time')">
|
|
65
|
+
<xsl:value-of select="date:date-time()"/>
|
|
66
|
+
</xsl:when>
|
|
67
|
+
<xsl:when test="function-available('current-dateTime')">
|
|
68
|
+
<xsl:value-of select="current-dateTime()"/>
|
|
69
|
+
</xsl:when>
|
|
70
|
+
</xsl:choose>
|
|
71
|
+
</xsl:param>
|
|
72
|
+
|
|
73
|
+
<!-- Output serialization. Currently only "rdfxml" is supported -->
|
|
74
|
+
<xsl:param name="serialization" select="'rdfxml'"/>
|
|
75
|
+
|
|
76
|
+
<xsl:include href="variables.xsl"/>
|
|
77
|
+
<xsl:include href="utils.xsl"/>
|
|
78
|
+
<xsl:include href="ConvSpec-ControlSubfields.xsl"/>
|
|
79
|
+
<xsl:include href="ConvSpec-LDR.xsl"/>
|
|
80
|
+
<xsl:include href="ConvSpec-001-007.xsl"/>
|
|
81
|
+
<xsl:include href="ConvSpec-006,008.xsl"/>
|
|
82
|
+
<xsl:include href="ConvSpec-010-048.xsl"/>
|
|
83
|
+
<xsl:include href="ConvSpec-050-088.xsl"/>
|
|
84
|
+
<xsl:include href="ConvSpec-1XX,7XX,8XX-names.xsl"/>
|
|
85
|
+
<xsl:include href="ConvSpec-200-247not240-Titles.xsl"/>
|
|
86
|
+
<xsl:include href="ConvSpec-240andX30-UnifTitle.xsl"/>
|
|
87
|
+
<xsl:include href="ConvSpec-250-270.xsl"/>
|
|
88
|
+
<xsl:include href="ConvSpec-3XX.xsl"/>
|
|
89
|
+
<!-- Commenting out for now. Need to revist these. Tests commented out too. -->
|
|
90
|
+
<!-- <xsl:include href="ConvSpec-460-468-SeriesTreat.xsl"/> -->
|
|
91
|
+
<xsl:include href="ConvSpec-490-510-Links.xsl"/>
|
|
92
|
+
<xsl:include href="ConvSpec-5XX.xsl"/>
|
|
93
|
+
<xsl:include href="ConvSpec-600-662.xsl"/>
|
|
94
|
+
<xsl:include href="ConvSpec-720+740to755.xsl"/>
|
|
95
|
+
<xsl:include href="ConvSpec-758.xsl"/>
|
|
96
|
+
<xsl:include href="ConvSpec-760-788-Links.xsl"/>
|
|
97
|
+
<xsl:include href="ConvSpec-841-887.xsl"/>
|
|
98
|
+
<xsl:include href="ConvSpec-880.xsl"/>
|
|
99
|
+
<xsl:include href="ConvSpec-Process6-Series.xsl"/>
|
|
100
|
+
<xsl:include href="ConvSpec-Process8-ProvAct.xsl"/>
|
|
101
|
+
<xsl:template match="/">
|
|
102
|
+
|
|
103
|
+
<!-- RDF/XML document frame -->
|
|
104
|
+
<xsl:choose>
|
|
105
|
+
<xsl:when test="$serialization='rdfxml'">
|
|
106
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
107
|
+
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
|
|
108
|
+
xmlns:bf="http://id.loc.gov/ontologies/bibframe/"
|
|
109
|
+
xmlns:bflc="http://id.loc.gov/ontologies/bflc/"
|
|
110
|
+
xmlns:madsrdf="http://www.loc.gov/mads/rdf/v1#">
|
|
111
|
+
|
|
112
|
+
<xsl:apply-templates>
|
|
113
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
114
|
+
</xsl:apply-templates>
|
|
115
|
+
|
|
116
|
+
</rdf:RDF>
|
|
117
|
+
</xsl:when>
|
|
118
|
+
</xsl:choose>
|
|
119
|
+
|
|
120
|
+
</xsl:template>
|
|
121
|
+
|
|
122
|
+
<xsl:template match="marc:collection">
|
|
123
|
+
<xsl:param name="serialization"/>
|
|
124
|
+
|
|
125
|
+
<!-- pass marc:record nodes on down -->
|
|
126
|
+
<xsl:apply-templates>
|
|
127
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
128
|
+
</xsl:apply-templates>
|
|
129
|
+
|
|
130
|
+
</xsl:template>
|
|
131
|
+
|
|
132
|
+
<xsl:template match="marc:record[@type='Bibliographic' or not(@type)]">
|
|
133
|
+
<xsl:param name="serialization"/>
|
|
134
|
+
|
|
135
|
+
<xsl:variable name="recordno"><xsl:value-of select="position()"/></xsl:variable>
|
|
136
|
+
|
|
137
|
+
<xsl:variable name="recordid">
|
|
138
|
+
<xsl:apply-templates mode="recordid" select=".">
|
|
139
|
+
<xsl:with-param name="baseuri" select="$baseuri"/>
|
|
140
|
+
<xsl:with-param name="idfield" select="$idfield"/>
|
|
141
|
+
<xsl:with-param name="recordno" select="$recordno"/>
|
|
142
|
+
</xsl:apply-templates>
|
|
143
|
+
</xsl:variable>
|
|
144
|
+
|
|
145
|
+
<xsl:variable name="vInstanceType">
|
|
146
|
+
<xsl:apply-templates mode="instanceType" select="marc:leader">
|
|
147
|
+
<xsl:with-param name="pBaseUri" select="$baseuri"/>
|
|
148
|
+
</xsl:apply-templates>
|
|
149
|
+
</xsl:variable>
|
|
150
|
+
|
|
151
|
+
<xsl:variable name="vCount880"><xsl:value-of select="count(marc:datafield[@tag='880'])"/></xsl:variable>
|
|
152
|
+
|
|
153
|
+
<xsl:variable name="rAdminMetadata">
|
|
154
|
+
<!-- Small admin metadata for when it was new. -->
|
|
155
|
+
<bf:adminMetadata>
|
|
156
|
+
<bf:AdminMetadata>
|
|
157
|
+
<bf:status>
|
|
158
|
+
<bf:Status rdf:about="http://id.loc.gov/vocabulary/mstatus/n">
|
|
159
|
+
<rdfs:label>new</rdfs:label>
|
|
160
|
+
</bf:Status>
|
|
161
|
+
</bf:status>
|
|
162
|
+
|
|
163
|
+
<xsl:variable name="cf008date" select="marc:controlfield[@tag='008']"/>
|
|
164
|
+
<xsl:variable name="marcYear" select="substring($cf008date,1,2)"/>
|
|
165
|
+
<xsl:variable name="creationYear">
|
|
166
|
+
<xsl:choose>
|
|
167
|
+
<xsl:when test="$marcYear < 65"><xsl:value-of select="concat('20',$marcYear)"/></xsl:when>
|
|
168
|
+
<xsl:otherwise><xsl:value-of select="concat('19',$marcYear)"/></xsl:otherwise>
|
|
169
|
+
</xsl:choose>
|
|
170
|
+
</xsl:variable>
|
|
171
|
+
<xsl:variable name="cDate" select="concat($creationYear,'-',substring($cf008date,3,2),'-',substring($cf008date,5,2))" />
|
|
172
|
+
<xsl:variable name="cDateInt" select="10000 * $creationYear + 100 * substring($cf008date,3,2) + substring($cf008date,5,2)"/>
|
|
173
|
+
|
|
174
|
+
<xsl:variable name="cf005date" select="marc:controlfield[@tag='005']" />
|
|
175
|
+
<xsl:variable name="mDateInt" select="10000 * substring($cf005date,1,4) + 100 * substring($cf005date,5,2) + substring($cf005date,7,2)"/>
|
|
176
|
+
<xsl:variable name="mDate" select="concat(substring($cf005date,1,4),'-',substring($cf005date,5,2),'-',substring($cf005date,7,2))"/>
|
|
177
|
+
<bf:date>
|
|
178
|
+
<xsl:attribute name="rdf:datatype"><xsl:value-of select="$xs"/>dateTime</xsl:attribute>
|
|
179
|
+
<xsl:choose>
|
|
180
|
+
<xsl:when test="$cDateInt > $mDateInt">
|
|
181
|
+
<xsl:value-of select="concat($mDate, 'T00:00:00')" />
|
|
182
|
+
</xsl:when>
|
|
183
|
+
<xsl:otherwise>
|
|
184
|
+
<xsl:value-of select="concat($cDate, 'T00:00:00')" />
|
|
185
|
+
</xsl:otherwise>
|
|
186
|
+
</xsl:choose>
|
|
187
|
+
</bf:date>
|
|
188
|
+
|
|
189
|
+
<xsl:if test="marc:datafield[@tag='040']/marc:subfield[@code='a']">
|
|
190
|
+
<xsl:variable name="sfA" select="marc:datafield[@tag='040']/marc:subfield[@code='a']/text()" />
|
|
191
|
+
<bf:agent>
|
|
192
|
+
<bf:Agent>
|
|
193
|
+
<xsl:if test="$sfA = 'DLC'">
|
|
194
|
+
<xsl:attribute name="rdf:about"><xsl:value-of select="concat($organizations,'dlc')"/></xsl:attribute>
|
|
195
|
+
</xsl:if>
|
|
196
|
+
<bf:code><xsl:value-of select="$sfA"/></bf:code>
|
|
197
|
+
</bf:Agent>
|
|
198
|
+
</bf:agent>
|
|
199
|
+
</xsl:if>
|
|
200
|
+
</bf:AdminMetadata>
|
|
201
|
+
</bf:adminMetadata>
|
|
202
|
+
|
|
203
|
+
<!-- Small admin metadata capturing last modification of MARC. -->
|
|
204
|
+
<xsl:variable name="vStatus" select="substring(marc:leader,6,1)"/>
|
|
205
|
+
<xsl:if test="$vStatus!='n'">
|
|
206
|
+
<bf:adminMetadata>
|
|
207
|
+
<bf:AdminMetadata>
|
|
208
|
+
<xsl:choose>
|
|
209
|
+
<xsl:when test="$vStatus!=''">
|
|
210
|
+
<xsl:for-each select="$codeMaps/maps/mstatus/*[name() = $vStatus]">
|
|
211
|
+
<xsl:choose>
|
|
212
|
+
<xsl:when test="$serialization = 'rdfxml'">
|
|
213
|
+
<bf:status>
|
|
214
|
+
<bf:Status>
|
|
215
|
+
<xsl:attribute name="rdf:about"><xsl:value-of select="@href"/></xsl:attribute>
|
|
216
|
+
<rdfs:label><xsl:value-of select="."/></rdfs:label>
|
|
217
|
+
</bf:Status>
|
|
218
|
+
</bf:status>
|
|
219
|
+
</xsl:when>
|
|
220
|
+
</xsl:choose>
|
|
221
|
+
</xsl:for-each>
|
|
222
|
+
</xsl:when>
|
|
223
|
+
<xsl:otherwise>
|
|
224
|
+
<bf:status>
|
|
225
|
+
<bf:Status rdf:about="http://id.loc.gov/vocabulary/mstatus/c">
|
|
226
|
+
<rdfs:label>changed</rdfs:label>
|
|
227
|
+
</bf:Status>
|
|
228
|
+
</bf:status>
|
|
229
|
+
</xsl:otherwise>
|
|
230
|
+
</xsl:choose>
|
|
231
|
+
|
|
232
|
+
<xsl:variable name="cf005date" select="marc:controlfield[@tag='005']" />
|
|
233
|
+
<xsl:variable name="changeDate" select="concat(substring($cf005date,1,4),'-',substring($cf005date,5,2),'-',substring($cf005date,7,2),'T',substring($cf005date,9,2),':',substring($cf005date,11,2),':',substring($cf005date,13,2))" />
|
|
234
|
+
<xsl:if test="marc:controlfield[@tag='005'] and not(starts-with($changeDate, '0000'))">
|
|
235
|
+
<bf:date>
|
|
236
|
+
<xsl:attribute name="rdf:datatype"><xsl:value-of select="$xs"/>dateTime</xsl:attribute>
|
|
237
|
+
<xsl:value-of select="$changeDate"/>
|
|
238
|
+
</bf:date>
|
|
239
|
+
</xsl:if>
|
|
240
|
+
|
|
241
|
+
<xsl:choose>
|
|
242
|
+
<xsl:when test="marc:datafield[@tag='040']/marc:subfield[@code='d']">
|
|
243
|
+
<xsl:variable name="sfA" select="marc:datafield[@tag='040']/marc:subfield[@code='d'][last()]/text()" />
|
|
244
|
+
<bf:descriptionModifier>
|
|
245
|
+
<bf:Agent>
|
|
246
|
+
<xsl:if test="$sfA = 'DLC'">
|
|
247
|
+
<xsl:attribute name="rdf:about"><xsl:value-of select="concat($organizations,'dlc')"/></xsl:attribute>
|
|
248
|
+
</xsl:if>
|
|
249
|
+
<bf:code><xsl:value-of select="$sfA"/></bf:code>
|
|
250
|
+
</bf:Agent>
|
|
251
|
+
</bf:descriptionModifier>
|
|
252
|
+
</xsl:when>
|
|
253
|
+
<xsl:when test="marc:datafield[@tag='040']/marc:subfield[@code='a']">
|
|
254
|
+
<xsl:variable name="sfA" select="marc:datafield[@tag='040']/marc:subfield[@code='a']/text()" />
|
|
255
|
+
<bf:agent>
|
|
256
|
+
<bf:Agent>
|
|
257
|
+
<xsl:if test="$sfA = 'DLC'">
|
|
258
|
+
<xsl:attribute name="rdf:about"><xsl:value-of select="concat($organizations,'dlc')"/></xsl:attribute>
|
|
259
|
+
</xsl:if>
|
|
260
|
+
<bf:code><xsl:value-of select="$sfA"/></bf:code>
|
|
261
|
+
</bf:Agent>
|
|
262
|
+
</bf:agent>
|
|
263
|
+
</xsl:when>
|
|
264
|
+
</xsl:choose>
|
|
265
|
+
</bf:AdminMetadata>
|
|
266
|
+
</bf:adminMetadata>
|
|
267
|
+
</xsl:if>
|
|
268
|
+
|
|
269
|
+
<xsl:for-each select="marc:datafield[@tag='884' and contains(marc:subfield[@code='a'], 'DLC bibframe2marc')]">
|
|
270
|
+
<bf:adminMetadata>
|
|
271
|
+
<bf:AdminMetadata>
|
|
272
|
+
<bf:status>
|
|
273
|
+
<bf:Status rdf:about="http://id.loc.gov/vocabulary/mstatus/c">
|
|
274
|
+
<rdfs:label>changed</rdfs:label>
|
|
275
|
+
</bf:Status>
|
|
276
|
+
</bf:status>
|
|
277
|
+
|
|
278
|
+
<xsl:variable name="cf005date" select="marc:subfield[@code='g']" />
|
|
279
|
+
<xsl:variable name="changeDate">
|
|
280
|
+
<xsl:choose>
|
|
281
|
+
<xsl:when test="string-length($cf005date) > 8">
|
|
282
|
+
<xsl:value-of select="concat(substring($cf005date,1,4),'-',substring($cf005date,5,2),'-',substring($cf005date,7,2),'T',substring($cf005date,9,2),':',substring($cf005date,11,2),':',substring($cf005date,13,2))" />
|
|
283
|
+
</xsl:when>
|
|
284
|
+
<xsl:otherwise>
|
|
285
|
+
<xsl:value-of select="concat(substring($cf005date,1,4),'-',substring($cf005date,5,2),'-',substring($cf005date,7,2),'T00:00:00')" />
|
|
286
|
+
</xsl:otherwise>
|
|
287
|
+
</xsl:choose>
|
|
288
|
+
</xsl:variable>
|
|
289
|
+
<xsl:if test="not (starts-with($changeDate, '0000'))">
|
|
290
|
+
<bf:date>
|
|
291
|
+
<xsl:attribute name="rdf:datatype"><xsl:value-of select="$xs"/>dateTime</xsl:attribute>
|
|
292
|
+
<xsl:value-of select="$changeDate"/>
|
|
293
|
+
</bf:date>
|
|
294
|
+
</xsl:if>
|
|
295
|
+
|
|
296
|
+
<xsl:choose>
|
|
297
|
+
<xsl:when test="marc:subfield[@code='q']">
|
|
298
|
+
<xsl:variable name="sfA" select="marc:subfield[@code='q']" />
|
|
299
|
+
<bf:agent>
|
|
300
|
+
<bf:Agent>
|
|
301
|
+
<xsl:if test="$sfA = 'DLC'">
|
|
302
|
+
<xsl:attribute name="rdf:about"><xsl:value-of select="concat($organizations,'dlc')"/></xsl:attribute>
|
|
303
|
+
</xsl:if>
|
|
304
|
+
<bf:code><xsl:value-of select="$sfA"/></bf:code>
|
|
305
|
+
</bf:Agent>
|
|
306
|
+
</bf:agent>
|
|
307
|
+
</xsl:when>
|
|
308
|
+
</xsl:choose>
|
|
309
|
+
|
|
310
|
+
<bf:generationProcess>
|
|
311
|
+
<xsl:attribute name="rdf:resource"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
|
|
312
|
+
</bf:generationProcess>
|
|
313
|
+
</bf:AdminMetadata>
|
|
314
|
+
</bf:adminMetadata>
|
|
315
|
+
</xsl:for-each>
|
|
316
|
+
|
|
317
|
+
<!-- Small admin metadata when converted. -->
|
|
318
|
+
<bf:adminMetadata>
|
|
319
|
+
<bf:AdminMetadata>
|
|
320
|
+
<bf:status>
|
|
321
|
+
<bf:Status rdf:about="http://id.loc.gov/vocabulary/mstatus/c">
|
|
322
|
+
<rdfs:label>changed</rdfs:label>
|
|
323
|
+
</bf:Status>
|
|
324
|
+
</bf:status>
|
|
325
|
+
<xsl:choose>
|
|
326
|
+
<xsl:when test="$idsource != ''">
|
|
327
|
+
<bf:agent>
|
|
328
|
+
<xsl:attribute name="rdf:resource"><xsl:value-of select="$idsource"/></xsl:attribute>
|
|
329
|
+
</bf:agent>
|
|
330
|
+
</xsl:when>
|
|
331
|
+
<xsl:otherwise>
|
|
332
|
+
<xsl:message>No 'idsource' runtime value provided. No agent identified as the actor converting the record.</xsl:message>
|
|
333
|
+
</xsl:otherwise>
|
|
334
|
+
</xsl:choose>
|
|
335
|
+
<bf:generationProcess>
|
|
336
|
+
<xsl:attribute name="rdf:resource"><xsl:value-of select="$vConvVersionURI"/></xsl:attribute>
|
|
337
|
+
</bf:generationProcess>
|
|
338
|
+
<bf:date>
|
|
339
|
+
<xsl:attribute name="rdf:datatype"><xsl:value-of select="concat($xs,'dateTime')"/></xsl:attribute>
|
|
340
|
+
<xsl:value-of select="$pGenerationDatestamp"/>
|
|
341
|
+
</bf:date>
|
|
342
|
+
</bf:AdminMetadata>
|
|
343
|
+
</bf:adminMetadata>
|
|
344
|
+
|
|
345
|
+
<bf:adminMetadata>
|
|
346
|
+
<bf:AdminMetadata>
|
|
347
|
+
<bf:descriptionLevel>
|
|
348
|
+
<xsl:attribute name="rdf:resource"><xsl:value-of select="$vOntoVersionURI"/></xsl:attribute>
|
|
349
|
+
</bf:descriptionLevel>
|
|
350
|
+
<!-- pass fields through conversion specs for AdminMetadata properties -->
|
|
351
|
+
<xsl:choose>
|
|
352
|
+
<xsl:when test="$vCount880 = 0">
|
|
353
|
+
<xsl:apply-templates mode="adminmetadata">
|
|
354
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
355
|
+
</xsl:apply-templates>
|
|
356
|
+
</xsl:when>
|
|
357
|
+
<xsl:otherwise>
|
|
358
|
+
<xsl:apply-templates mode="mProcessAdminMetadata880">
|
|
359
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
360
|
+
</xsl:apply-templates>
|
|
361
|
+
</xsl:otherwise>
|
|
362
|
+
</xsl:choose>
|
|
363
|
+
</bf:AdminMetadata>
|
|
364
|
+
</bf:adminMetadata>
|
|
365
|
+
</xsl:variable>
|
|
366
|
+
|
|
367
|
+
<!-- generate main Work entity -->
|
|
368
|
+
<xsl:choose>
|
|
369
|
+
<xsl:when test="$serialization = 'rdfxml' and $vInstanceType != 'SecondaryInstance'">
|
|
370
|
+
<bf:Work>
|
|
371
|
+
<xsl:attribute name="rdf:about"><xsl:value-of select="$recordid"/>#Work</xsl:attribute>
|
|
372
|
+
<xsl:copy-of select="$rAdminMetadata" />
|
|
373
|
+
<!-- pass fields through conversion specs for Work properties -->
|
|
374
|
+
<xsl:choose>
|
|
375
|
+
<xsl:when test="$vCount880 = 0">
|
|
376
|
+
<xsl:apply-templates mode="work">
|
|
377
|
+
<xsl:with-param name="recordid" select="$recordid"/>
|
|
378
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
379
|
+
<xsl:with-param name="pInstanceType" select="$vInstanceType"/>
|
|
380
|
+
</xsl:apply-templates>
|
|
381
|
+
</xsl:when>
|
|
382
|
+
<xsl:otherwise>
|
|
383
|
+
<xsl:apply-templates mode="mProcessWork880">
|
|
384
|
+
<xsl:with-param name="recordid" select="$recordid"/>
|
|
385
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
386
|
+
<xsl:with-param name="pInstanceType" select="$vInstanceType"/>
|
|
387
|
+
</xsl:apply-templates>
|
|
388
|
+
</xsl:otherwise>
|
|
389
|
+
</xsl:choose>
|
|
390
|
+
<!-- for MTA Hub records, put Instance properties on the Work, do not generate Instance -->
|
|
391
|
+
<xsl:choose>
|
|
392
|
+
<xsl:when test="$vInstanceType = 'Hub'">
|
|
393
|
+
<xsl:choose>
|
|
394
|
+
<xsl:when test="$vCount880 = 0">
|
|
395
|
+
<xsl:apply-templates mode="instance">
|
|
396
|
+
<xsl:with-param name="recordid" select="$recordid"/>
|
|
397
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
398
|
+
<xsl:with-param name="pInstanceType" select="$vInstanceType"/>
|
|
399
|
+
</xsl:apply-templates>
|
|
400
|
+
</xsl:when>
|
|
401
|
+
<xsl:otherwise>
|
|
402
|
+
<xsl:apply-templates mode="mProcessInstance880">
|
|
403
|
+
<xsl:with-param name="recordid" select="$recordid"/>
|
|
404
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
405
|
+
<xsl:with-param name="pInstanceType" select="$vInstanceType"/>
|
|
406
|
+
</xsl:apply-templates>
|
|
407
|
+
</xsl:otherwise>
|
|
408
|
+
</xsl:choose>
|
|
409
|
+
</xsl:when>
|
|
410
|
+
<xsl:otherwise>
|
|
411
|
+
<bf:hasInstance>
|
|
412
|
+
<xsl:attribute name="rdf:resource"><xsl:value-of select="$recordid"/>#Instance</xsl:attribute>
|
|
413
|
+
</bf:hasInstance>
|
|
414
|
+
</xsl:otherwise>
|
|
415
|
+
</xsl:choose>
|
|
416
|
+
</bf:Work>
|
|
417
|
+
</xsl:when>
|
|
418
|
+
</xsl:choose>
|
|
419
|
+
|
|
420
|
+
<!-- generate main Instance entity (except for MTA Hub records) -->
|
|
421
|
+
<xsl:if test="$vInstanceType != 'Hub'">
|
|
422
|
+
<xsl:choose>
|
|
423
|
+
<xsl:when test="$serialization = 'rdfxml'">
|
|
424
|
+
<bf:Instance>
|
|
425
|
+
<xsl:attribute name="rdf:about"><xsl:value-of select="$recordid"/>#Instance</xsl:attribute>
|
|
426
|
+
<!-- pass fields through conversion specs for Instance properties -->
|
|
427
|
+
<xsl:choose>
|
|
428
|
+
<xsl:when test="$vCount880 = 0">
|
|
429
|
+
<xsl:apply-templates mode="instance">
|
|
430
|
+
<xsl:with-param name="recordid" select="$recordid"/>
|
|
431
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
432
|
+
<xsl:with-param name="pInstanceType" select="$vInstanceType"/>
|
|
433
|
+
</xsl:apply-templates>
|
|
434
|
+
</xsl:when>
|
|
435
|
+
<xsl:otherwise>
|
|
436
|
+
<xsl:apply-templates mode="mProcessInstance880">
|
|
437
|
+
<xsl:with-param name="recordid" select="$recordid"/>
|
|
438
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
439
|
+
<xsl:with-param name="pInstanceType" select="$vInstanceType"/>
|
|
440
|
+
</xsl:apply-templates>
|
|
441
|
+
</xsl:otherwise>
|
|
442
|
+
</xsl:choose>
|
|
443
|
+
<xsl:choose>
|
|
444
|
+
<xsl:when test="marc:datafield[
|
|
445
|
+
@tag='758' and
|
|
446
|
+
marc:subfield[@code='4']='http://id.loc.gov/ontologies/bibframe/instanceOf' and
|
|
447
|
+
contains(marc:subfield[@code='1'], $baseuri)
|
|
448
|
+
]">
|
|
449
|
+
<bf:instanceOf>
|
|
450
|
+
<xsl:attribute name="rdf:resource"><xsl:value-of select="marc:datafield[@tag='758']/marc:subfield[@code='1']"/></xsl:attribute>
|
|
451
|
+
</bf:instanceOf>
|
|
452
|
+
</xsl:when>
|
|
453
|
+
<xsl:otherwise>
|
|
454
|
+
<bf:instanceOf>
|
|
455
|
+
<xsl:attribute name="rdf:resource"><xsl:value-of select="$recordid"/>#Work</xsl:attribute>
|
|
456
|
+
</bf:instanceOf>
|
|
457
|
+
</xsl:otherwise>
|
|
458
|
+
</xsl:choose>
|
|
459
|
+
<!-- generate hasItem properties -->
|
|
460
|
+
<xsl:if test="marc:datafield[@tag='051'] or
|
|
461
|
+
marc:datafield[@tag='541'] or
|
|
462
|
+
marc:datafield[@tag='880' and substring(marc:subfield[@code='6'],1,3)='541'] or
|
|
463
|
+
($localfields and marc:datafield[marc:subfield[@code='5']='DLC'])">
|
|
464
|
+
<bf:hasItem>
|
|
465
|
+
<bf:Item>
|
|
466
|
+
<xsl:attribute name="rdf:about">
|
|
467
|
+
<xsl:value-of select="concat($recordid,'#Item')"/>
|
|
468
|
+
</xsl:attribute>
|
|
469
|
+
<bf:heldBy>
|
|
470
|
+
<xsl:attribute name="rdf:resource"><xsl:value-of select="concat($organizations,'dlc')"/></xsl:attribute>
|
|
471
|
+
</bf:heldBy>
|
|
472
|
+
<xsl:choose>
|
|
473
|
+
<xsl:when test="$vCount880 = 0">
|
|
474
|
+
<xsl:apply-templates select="marc:datafield[marc:subfield[@code='5']='DLC']" mode="work">
|
|
475
|
+
<xsl:with-param name="recordid" select="$recordid"/>
|
|
476
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
477
|
+
<xsl:with-param name="pInstanceType" select="$vInstanceType"/>
|
|
478
|
+
<xsl:with-param name="pHasItem" select="true()"/>
|
|
479
|
+
</xsl:apply-templates>
|
|
480
|
+
</xsl:when>
|
|
481
|
+
<xsl:otherwise>
|
|
482
|
+
<xsl:apply-templates select="marc:datafield[marc:subfield[@code='5']='DLC']" mode="mProcessWork880">
|
|
483
|
+
<xsl:with-param name="recordid" select="$recordid"/>
|
|
484
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
485
|
+
<xsl:with-param name="pInstanceType" select="$vInstanceType"/>
|
|
486
|
+
<xsl:with-param name="pHasItem" select="true()"/>
|
|
487
|
+
</xsl:apply-templates>
|
|
488
|
+
</xsl:otherwise>
|
|
489
|
+
</xsl:choose>
|
|
490
|
+
<xsl:choose>
|
|
491
|
+
<xsl:when test="$vCount880 = 0">
|
|
492
|
+
<xsl:apply-templates select="marc:datafield[marc:subfield[@code='5']='DLC']" mode="instance">
|
|
493
|
+
<xsl:with-param name="recordid" select="$recordid"/>
|
|
494
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
495
|
+
<xsl:with-param name="pInstanceType" select="$vInstanceType"/>
|
|
496
|
+
<xsl:with-param name="pHasItem" select="true()"/>
|
|
497
|
+
</xsl:apply-templates>
|
|
498
|
+
</xsl:when>
|
|
499
|
+
<xsl:otherwise>
|
|
500
|
+
<xsl:apply-templates select="marc:datafield[marc:subfield[@code='5']='DLC']" mode="mProcessInstance880">
|
|
501
|
+
<xsl:with-param name="recordid" select="$recordid"/>
|
|
502
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
503
|
+
<xsl:with-param name="pInstanceType" select="$vInstanceType"/>
|
|
504
|
+
<xsl:with-param name="pHasItem" select="true()"/>
|
|
505
|
+
</xsl:apply-templates>
|
|
506
|
+
</xsl:otherwise>
|
|
507
|
+
</xsl:choose>
|
|
508
|
+
<xsl:apply-templates select="marc:datafield" mode="item">
|
|
509
|
+
<xsl:with-param name="recordid" select="$recordid"/>
|
|
510
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
511
|
+
<xsl:with-param name="pInstanceType" select="$vInstanceType"/>
|
|
512
|
+
<xsl:with-param name="pHasItem" select="true()"/>
|
|
513
|
+
</xsl:apply-templates>
|
|
514
|
+
<bf:itemOf>
|
|
515
|
+
<xsl:attribute name="rdf:resource"><xsl:value-of select="$recordid"/>#Instance</xsl:attribute>
|
|
516
|
+
</bf:itemOf>
|
|
517
|
+
</bf:Item>
|
|
518
|
+
</bf:hasItem>
|
|
519
|
+
</xsl:if>
|
|
520
|
+
|
|
521
|
+
<xsl:choose>
|
|
522
|
+
<xsl:when test="$vCount880 = 0">
|
|
523
|
+
<xsl:apply-templates mode="hasItem">
|
|
524
|
+
<xsl:with-param name="recordid" select="$recordid"/>
|
|
525
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
526
|
+
</xsl:apply-templates>
|
|
527
|
+
</xsl:when>
|
|
528
|
+
<xsl:otherwise>
|
|
529
|
+
<xsl:apply-templates mode="mProcessItem880">
|
|
530
|
+
<xsl:with-param name="recordid" select="$recordid"/>
|
|
531
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
532
|
+
</xsl:apply-templates>
|
|
533
|
+
</xsl:otherwise>
|
|
534
|
+
</xsl:choose>
|
|
535
|
+
|
|
536
|
+
<!--
|
|
537
|
+
<xsl:choose>
|
|
538
|
+
<xsl:when test="$vCount880 = 0">
|
|
539
|
+
<xsl:apply-templates mode="hasItem">
|
|
540
|
+
<xsl:with-param name="recordid" select="$recordid"/>
|
|
541
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
542
|
+
</xsl:apply-templates>
|
|
543
|
+
</xsl:when>
|
|
544
|
+
<xsl:otherwise>
|
|
545
|
+
<xsl:apply-templates mode="mProcessItem880">
|
|
546
|
+
<xsl:with-param name="recordid" select="$recordid"/>
|
|
547
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
548
|
+
</xsl:apply-templates>
|
|
549
|
+
</xsl:otherwise>
|
|
550
|
+
</xsl:choose>
|
|
551
|
+
<!-\- special LoC processing for $5 -\->
|
|
552
|
+
<!-\- link all properties from fields with $5=DLC to a single Item -\->
|
|
553
|
+
<xsl:if test="$localfields and
|
|
554
|
+
not(marc:datafield[@tag='051']) and
|
|
555
|
+
marc:datafield[marc:subfield[@code='5']='DLC']">
|
|
556
|
+
<bf:hasItem>
|
|
557
|
+
<bf:Item>
|
|
558
|
+
<xsl:attribute name="rdf:about">
|
|
559
|
+
<xsl:value-of select="concat($recordid,'#Item-DLC')"/>
|
|
560
|
+
</xsl:attribute>
|
|
561
|
+
<bf:heldBy>
|
|
562
|
+
<bf:Agent>
|
|
563
|
+
<xsl:attribute name="rdf:about"><xsl:value-of select="concat($organizations,'dlc')"/></xsl:attribute>
|
|
564
|
+
<bf:code>DLC</bf:code>
|
|
565
|
+
</bf:Agent>
|
|
566
|
+
</bf:heldBy>
|
|
567
|
+
<xsl:apply-templates select="marc:datafield[marc:subfield[@code='5']='DLC']" mode="work">
|
|
568
|
+
<xsl:with-param name="recordid" select="$recordid"/>
|
|
569
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
570
|
+
<xsl:with-param name="pHasItem" select="true()"/>
|
|
571
|
+
</xsl:apply-templates>
|
|
572
|
+
<xsl:apply-templates select="marc:datafield[marc:subfield[@code='5']='DLC']" mode="instance">
|
|
573
|
+
<xsl:with-param name="recordid" select="$recordid"/>
|
|
574
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
575
|
+
<xsl:with-param name="pHasItem" select="true()"/>
|
|
576
|
+
</xsl:apply-templates>
|
|
577
|
+
<!-\- generate Item properties from 541/561/563/583 -\->
|
|
578
|
+
<xsl:apply-templates select="marc:datafield[(((@tag='541' or @tag='561' or @tag='563' or @tag='583') and not(marc:subfield[@code='6'])) or (@tag='880' and (substring(marc:subfield[@code='6'],1,3)='541' or substring(marc:subfield[@code='6'],1,3)='561' or substring(marc:subfield[@code='6'],1,3)='563' or substring(marc:subfield[@code='6'],1,3)='583'))) and (marc:subfield[@code='5']='DLC' or not(marc:subfield[@code='5']))]" mode="item5XX">
|
|
579
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
580
|
+
</xsl:apply-templates>
|
|
581
|
+
</bf:Item>
|
|
582
|
+
</bf:hasItem>
|
|
583
|
+
</xsl:if>
|
|
584
|
+
-->
|
|
585
|
+
</bf:Instance>
|
|
586
|
+
</xsl:when>
|
|
587
|
+
</xsl:choose>
|
|
588
|
+
</xsl:if>
|
|
589
|
+
|
|
590
|
+
</xsl:template>
|
|
591
|
+
|
|
592
|
+
<!-- suppress text from unmatched nodes -->
|
|
593
|
+
<xsl:template match="text()" mode="adminmetadata"/>
|
|
594
|
+
<xsl:template match="text()" mode="work"/>
|
|
595
|
+
<xsl:template match="text()" mode="instance"/>
|
|
596
|
+
<xsl:template match="text()" mode="item"/>
|
|
597
|
+
<xsl:template match="text()" mode="hasItem"/>
|
|
598
|
+
|
|
599
|
+
<!-- warn about other elements -->
|
|
600
|
+
<xsl:template match="*">
|
|
601
|
+
|
|
602
|
+
<xsl:message terminate="no">
|
|
603
|
+
<xsl:text>WARNING: Unmatched element: </xsl:text><xsl:value-of select="name()"/>
|
|
604
|
+
</xsl:message>
|
|
605
|
+
|
|
606
|
+
<xsl:apply-templates/>
|
|
607
|
+
|
|
608
|
+
</xsl:template>
|
|
609
|
+
|
|
610
|
+
</xsl:stylesheet>
|