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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -2
  3. data/docs/superpowers/plans/2026-09-09-marc-conversion.md +537 -0
  4. data/docs/superpowers/specs/2026-09-09-marc-conversion-design.md +110 -0
  5. data/lib/bibframe_ruby/marc_converter.rb +67 -0
  6. data/lib/bibframe_ruby/parser.rb +4 -2
  7. data/lib/bibframe_ruby/version.rb +1 -1
  8. data/lib/bibframe_ruby.rb +7 -0
  9. data/vendor/marc2bibframe2/xsl/ConvSpec-001-007.xsl +2276 -0
  10. data/vendor/marc2bibframe2/xsl/ConvSpec-006,008.xsl +1295 -0
  11. data/vendor/marc2bibframe2/xsl/ConvSpec-010-048.xsl +1712 -0
  12. data/vendor/marc2bibframe2/xsl/ConvSpec-050-088.xsl +713 -0
  13. data/vendor/marc2bibframe2/xsl/ConvSpec-1XX,7XX,8XX-names.xsl +1141 -0
  14. data/vendor/marc2bibframe2/xsl/ConvSpec-200-247not240-Titles.xsl +771 -0
  15. data/vendor/marc2bibframe2/xsl/ConvSpec-240andX30-UnifTitle.xsl +535 -0
  16. data/vendor/marc2bibframe2/xsl/ConvSpec-250-270.xsl +283 -0
  17. data/vendor/marc2bibframe2/xsl/ConvSpec-3XX.xsl +2245 -0
  18. data/vendor/marc2bibframe2/xsl/ConvSpec-460-468-SeriesTreat.xsl +135 -0
  19. data/vendor/marc2bibframe2/xsl/ConvSpec-490-510-Links.xsl +145 -0
  20. data/vendor/marc2bibframe2/xsl/ConvSpec-5XX.xsl +1448 -0
  21. data/vendor/marc2bibframe2/xsl/ConvSpec-600-662.xsl +1417 -0
  22. data/vendor/marc2bibframe2/xsl/ConvSpec-720+740to755.xsl +333 -0
  23. data/vendor/marc2bibframe2/xsl/ConvSpec-758.xsl +102 -0
  24. data/vendor/marc2bibframe2/xsl/ConvSpec-760-788-Links.xsl +771 -0
  25. data/vendor/marc2bibframe2/xsl/ConvSpec-841-887.xsl +328 -0
  26. data/vendor/marc2bibframe2/xsl/ConvSpec-880.xsl +119 -0
  27. data/vendor/marc2bibframe2/xsl/ConvSpec-ControlSubfields.xsl +495 -0
  28. data/vendor/marc2bibframe2/xsl/ConvSpec-LDR.xsl +183 -0
  29. data/vendor/marc2bibframe2/xsl/ConvSpec-Preprocess0-Splitting.xsl +765 -0
  30. data/vendor/marc2bibframe2/xsl/ConvSpec-Process6-Series.xsl +627 -0
  31. data/vendor/marc2bibframe2/xsl/ConvSpec-Process8-ProvAct.xsl +1021 -0
  32. data/vendor/marc2bibframe2/xsl/conf/abbreviations.xml +13 -0
  33. data/vendor/marc2bibframe2/xsl/conf/code-to-script.xml +399 -0
  34. data/vendor/marc2bibframe2/xsl/conf/codeMaps.xml +723 -0
  35. data/vendor/marc2bibframe2/xsl/conf/exclusions.xml +4 -0
  36. data/vendor/marc2bibframe2/xsl/conf/iso6392-to-1.xml +615 -0
  37. data/vendor/marc2bibframe2/xsl/conf/languageCrosswalk.xml +1503 -0
  38. data/vendor/marc2bibframe2/xsl/conf/map880.xml +175 -0
  39. data/vendor/marc2bibframe2/xsl/conf/scriptCrosswalk.xml +210 -0
  40. data/vendor/marc2bibframe2/xsl/conf/subjectThesaurus.xml +29 -0
  41. data/vendor/marc2bibframe2/xsl/marc2bibframe2.xsl +610 -0
  42. data/vendor/marc2bibframe2/xsl/naco-normalize.xsl +205 -0
  43. data/vendor/marc2bibframe2/xsl/utils.xsl +963 -0
  44. data/vendor/marc2bibframe2/xsl/variables.xsl +108 -0
  45. metadata +68 -1
@@ -0,0 +1,283 @@
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
+ exclude-result-prefixes="xsl marc">
11
+
12
+ <!-- Conversion specs for 250-270 -->
13
+
14
+ <xsl:template match="marc:datafield[@tag='254' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='254')]" mode="instance">
15
+ <xsl:param name="serialization" select="'rdfxml'"/>
16
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
17
+ <xsl:choose>
18
+ <xsl:when test="$serialization = 'rdfxml'">
19
+ <bf:editionStatement>
20
+ <xsl:if test="$vXmlLang != ''">
21
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
22
+ </xsl:if>
23
+ <xsl:call-template name="tChopPunct">
24
+ <xsl:with-param name="pString" select="marc:subfield[@code='a']"/>
25
+ </xsl:call-template>
26
+ </bf:editionStatement>
27
+ </xsl:when>
28
+ </xsl:choose>
29
+ </xsl:template>
30
+
31
+ <xsl:template match="marc:datafield[@tag='255' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='255')]" mode="work">
32
+ <xsl:param name="serialization" select="'rdfxml'"/>
33
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
34
+ <xsl:variable name="vCoordinates">
35
+ <xsl:call-template name="tChopPunct">
36
+ <xsl:with-param name="pString" select="marc:subfield[@code='c']"/>
37
+ <xsl:with-param name="pChopParens" select="true()"/>
38
+ <xsl:with-param name="pForceTerm" select="true()"/>
39
+ </xsl:call-template>
40
+ </xsl:variable>
41
+ <xsl:variable name="vZone">
42
+ <xsl:call-template name="tChopPunct">
43
+ <xsl:with-param name="pString" select="marc:subfield[@code='d']"/>
44
+ <xsl:with-param name="pChopParens" select="true()"/>
45
+ <xsl:with-param name="pForceTerm" select="true()"/>
46
+ </xsl:call-template>
47
+ </xsl:variable>
48
+ <xsl:variable name="vEquinox">
49
+ <xsl:call-template name="tChopPunct">
50
+ <xsl:with-param name="pString" select="marc:subfield[@code='e']"/>
51
+ <xsl:with-param name="pChopParens" select="true()"/>
52
+ <xsl:with-param name="pForceTerm" select="true()"/>
53
+ </xsl:call-template>
54
+ </xsl:variable>
55
+ <xsl:choose>
56
+ <xsl:when test="$serialization = 'rdfxml'">
57
+ <xsl:for-each select="marc:subfield[@code='a']">
58
+ <bf:scale>
59
+ <bf:Scale>
60
+ <rdfs:label>
61
+ <xsl:if test="$vXmlLang != ''">
62
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
63
+ </xsl:if>
64
+ <xsl:call-template name="tChopPunct">
65
+ <xsl:with-param name="pString" select="."/>
66
+ </xsl:call-template>
67
+ </rdfs:label>
68
+ </bf:Scale>
69
+ </bf:scale>
70
+ </xsl:for-each>
71
+ <xsl:if test="marc:subfield[@code='b' or @code='c' or @code='d' or @code='f' or @code='g']">
72
+ <bf:cartographicAttributes>
73
+ <bf:Cartographic>
74
+ <xsl:for-each select="marc:subfield[@code='b']">
75
+ <bf:projection>
76
+ <bf:Projection>
77
+ <rdfs:label>
78
+ <xsl:if test="$vXmlLang != ''">
79
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
80
+ </xsl:if>
81
+ <xsl:call-template name="tChopPunct">
82
+ <xsl:with-param name="pString" select="."/>
83
+ </xsl:call-template>
84
+ </rdfs:label>
85
+ </bf:Projection>
86
+ </bf:projection>
87
+ </xsl:for-each>
88
+ <xsl:if test="$vCoordinates != ''">
89
+ <bf:coordinates>
90
+ <xsl:if test="$vXmlLang != ''">
91
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
92
+ </xsl:if>
93
+ <xsl:value-of select="$vCoordinates"/>
94
+ </bf:coordinates>
95
+ </xsl:if>
96
+ <xsl:if test="$vZone != ''">
97
+ <bf:ascensionAndDeclination>
98
+ <xsl:if test="$vXmlLang != ''">
99
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
100
+ </xsl:if>
101
+ <xsl:value-of select="$vZone"/>
102
+ </bf:ascensionAndDeclination>
103
+ </xsl:if>
104
+ <xsl:if test="$vEquinox != ''">
105
+ <bf:equinox>
106
+ <xsl:if test="$vXmlLang != ''">
107
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
108
+ </xsl:if>
109
+ <xsl:value-of select="$vEquinox"/>
110
+ </bf:equinox>
111
+ </xsl:if>
112
+ <xsl:for-each select="marc:subfield[@code='f']">
113
+ <bf:outerGRing>
114
+ <xsl:if test="$vXmlLang != ''">
115
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
116
+ </xsl:if>
117
+ <xsl:call-template name="tChopPunct">
118
+ <xsl:with-param name="pString" select="."/>
119
+ </xsl:call-template>
120
+ </bf:outerGRing>
121
+ </xsl:for-each>
122
+ <xsl:for-each select="marc:subfield[@code='g']">
123
+ <bf:exclusionGRing>
124
+ <xsl:if test="$vXmlLang != ''">
125
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
126
+ </xsl:if>
127
+ <xsl:call-template name="tChopPunct">
128
+ <xsl:with-param name="pString" select="."/>
129
+ </xsl:call-template>
130
+ </bf:exclusionGRing>
131
+ </xsl:for-each>
132
+ </bf:Cartographic>
133
+ </bf:cartographicAttributes>
134
+ </xsl:if>
135
+ </xsl:when>
136
+ </xsl:choose>
137
+ </xsl:template>
138
+
139
+ <xsl:template match="marc:datafield[@tag='257' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='257')]" mode="instance">
140
+ <xsl:param name="serialization" select="'rdfxml'"/>
141
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
142
+ <xsl:choose>
143
+ <xsl:when test="$serialization='rdfxml'">
144
+ <xsl:for-each select="marc:subfield[@code='a']">
145
+ <bf:originPlace>
146
+ <bf:Place>
147
+ <rdfs:label>
148
+ <xsl:if test="$vXmlLang != ''">
149
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
150
+ </xsl:if>
151
+ <xsl:call-template name="tChopPunct">
152
+ <xsl:with-param name="pString" select="."/>
153
+ </xsl:call-template>
154
+ </rdfs:label>
155
+ <xsl:apply-templates select="../marc:subfield[@code='2']" mode="subfield2">
156
+ <xsl:with-param name="serialization" select="$serialization"/>
157
+ </xsl:apply-templates>
158
+ </bf:Place>
159
+ </bf:originPlace>
160
+ </xsl:for-each>
161
+ </xsl:when>
162
+ </xsl:choose>
163
+ </xsl:template>
164
+
165
+ <xsl:template match="marc:datafield[@tag='250' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='250')]" mode="instance">
166
+ <xsl:param name="serialization" select="'rdfxml'"/>
167
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
168
+ <xsl:variable name="vEditionStatementRaw">
169
+ <xsl:apply-templates select="marc:subfield[@code='a' or @code='b']" mode="concat-nodes-space"/>
170
+ </xsl:variable>
171
+ <xsl:variable name="vEditionStatement">
172
+ <xsl:call-template name="tChopPunct">
173
+ <xsl:with-param name="pString" select="$vEditionStatementRaw"/>
174
+ </xsl:call-template>
175
+ </xsl:variable>
176
+ <xsl:choose>
177
+ <xsl:when test="$serialization = 'rdfxml'">
178
+ <bf:editionStatement>
179
+ <xsl:if test="$vXmlLang != ''">
180
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
181
+ </xsl:if>
182
+ <xsl:value-of select="$vEditionStatement"/>
183
+ </bf:editionStatement>
184
+ </xsl:when>
185
+ </xsl:choose>
186
+ </xsl:template>
187
+
188
+ <xsl:template match="marc:datafield[@tag='256' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='256')]" mode="instance">
189
+ <xsl:param name="serialization" select="'rdfxml'"/>
190
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
191
+ <xsl:choose>
192
+ <xsl:when test="$serialization = 'rdfxml'">
193
+ <bf:note>
194
+ <bf:Note>
195
+ <rdf:type>
196
+ <xsl:attribute name="rdf:resource">http://id.loc.gov/vocabulary/mnotetype/computer</xsl:attribute>
197
+ </rdf:type>
198
+ <rdfs:label>
199
+ <xsl:if test="$vXmlLang != ''">
200
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
201
+ </xsl:if>
202
+ <xsl:call-template name="tChopPunct">
203
+ <xsl:with-param name="pString" select="marc:subfield[@code='a']"/>
204
+ </xsl:call-template>
205
+ </rdfs:label>
206
+ </bf:Note>
207
+ </bf:note>
208
+ </xsl:when>
209
+ </xsl:choose>
210
+ </xsl:template>
211
+
212
+ <xsl:template match="marc:datafield[@tag='260']" mode="instance">
213
+ <xsl:variable name="vTag">
214
+ <xsl:choose>
215
+ <xsl:when test="@tag='880'"><xsl:value-of select="substring(marc:subfield[@code='6'],1,3)"/></xsl:when>
216
+ <xsl:otherwise><xsl:value-of select="@tag"/></xsl:otherwise>
217
+ </xsl:choose>
218
+ </xsl:variable>
219
+ <xsl:variable name="v880Occurrence">
220
+ <xsl:value-of select="substring(substring-after(marc:subfield[@code='6'],'-'),1,2)"/>
221
+ </xsl:variable>
222
+ <xsl:for-each select="marc:subfield[@code = 'd']">
223
+ <xsl:variable name="vLinkedValue">
224
+ <xsl:if test="$v880Occurrence and $v880Occurrence != '00'">
225
+ <xsl:value-of
226
+ select="../../marc:datafield[@tag = '880' and substring(marc:subfield[@code = '6'], 1, 3) = $vTag and substring(substring-after(marc:subfield[@code = '6'], '-'), 1, 2) = $v880Occurrence]/marc:subfield[@code = 'd'][position()]"
227
+ />
228
+ </xsl:if>
229
+ </xsl:variable>
230
+ <bf:identifiedBy>
231
+ <bf:PublisherNumber>
232
+ <rdf:value>
233
+ <xsl:value-of select="."/>
234
+ </rdf:value>
235
+ <xsl:if test="$vLinkedValue != ''">
236
+ <rdf:value>
237
+ <xsl:value-of select="$vLinkedValue"/>
238
+ </rdf:value>
239
+ </xsl:if>
240
+ </bf:PublisherNumber>
241
+ </bf:identifiedBy>
242
+ </xsl:for-each>
243
+ </xsl:template>
244
+
245
+ <xsl:template match="marc:datafield[@tag='263' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='263')]" mode="instance">
246
+ <xsl:param name="serialization" select="'rdfxml'"/>
247
+ <xsl:choose>
248
+ <xsl:when test="$serialization = 'rdfxml'">
249
+ <xsl:for-each select="marc:subfield[@code='a']">
250
+ <bflc:projectedProvisionDate>
251
+ <xsl:call-template name="tChopPunct">
252
+ <xsl:with-param name="pString" select="."/>
253
+ </xsl:call-template>
254
+ </bflc:projectedProvisionDate>
255
+ </xsl:for-each>
256
+ </xsl:when>
257
+ </xsl:choose>
258
+ </xsl:template>
259
+
260
+ <xsl:template match="marc:datafield[@tag='265' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='265')]" mode="instance">
261
+ <xsl:param name="serialization" select="'rdfxml'"/>
262
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
263
+ <xsl:choose>
264
+ <xsl:when test="$serialization = 'rdfxml'">
265
+ <xsl:for-each select="marc:subfield[@code='a']">
266
+ <bf:acquisitionSource>
267
+ <bf:AcquisitionSource>
268
+ <rdfs:label>
269
+ <xsl:if test="$vXmlLang != ''">
270
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
271
+ </xsl:if>
272
+ <xsl:call-template name="tChopPunct">
273
+ <xsl:with-param name="pString" select="."/>
274
+ </xsl:call-template>
275
+ </rdfs:label>
276
+ </bf:AcquisitionSource>
277
+ </bf:acquisitionSource>
278
+ </xsl:for-each>
279
+ </xsl:when>
280
+ </xsl:choose>
281
+ </xsl:template>
282
+
283
+ </xsl:stylesheet>