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,333 @@
|
|
|
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
|
+
<!--
|
|
13
|
+
Conversion specs for 720, 740-754
|
|
14
|
+
-->
|
|
15
|
+
|
|
16
|
+
<!-- Processing of 720 is handled in ConvSpec-1XX,6XX,7XX,8XX-names.xsl -->
|
|
17
|
+
|
|
18
|
+
<xsl:template match="marc:datafield[@tag='740' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='740')]" mode="work">
|
|
19
|
+
<xsl:param name="serialization" select="'rdfxml'"/>
|
|
20
|
+
<xsl:param name="recordid"/>
|
|
21
|
+
<xsl:param name="pPosition" select="position()"/>
|
|
22
|
+
<xsl:param name="pHasItem" select="false()"/>
|
|
23
|
+
<!-- note special $5 processing for LoC below -->
|
|
24
|
+
<xsl:if test="$pHasItem or not($localfields and marc:subfield[@code='5'])">
|
|
25
|
+
<xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
|
|
26
|
+
<xsl:variable name="vWorkUri">
|
|
27
|
+
<xsl:value-of select="$recordid"/>#Work<xsl:value-of select="@tag"/>-<xsl:value-of select="$pPosition"/>
|
|
28
|
+
</xsl:variable>
|
|
29
|
+
<xsl:variable name="vNFI">
|
|
30
|
+
<xsl:choose>
|
|
31
|
+
<xsl:when test="translate(@ind1,'0123456789','')=''"><xsl:value-of select="@ind1"/></xsl:when>
|
|
32
|
+
<xsl:otherwise>0</xsl:otherwise>
|
|
33
|
+
</xsl:choose>
|
|
34
|
+
</xsl:variable>
|
|
35
|
+
<xsl:variable name="vProperty">
|
|
36
|
+
<xsl:choose>
|
|
37
|
+
<xsl:when test="@ind2='2'">http://id.loc.gov/vocabulary/relationship/part</xsl:when>
|
|
38
|
+
<xsl:otherwise>http://id.loc.gov/vocabulary/relationship/relatedwork</xsl:otherwise>
|
|
39
|
+
</xsl:choose>
|
|
40
|
+
</xsl:variable>
|
|
41
|
+
<xsl:variable name="vmainTitle">
|
|
42
|
+
<xsl:call-template name="tChopPunct">
|
|
43
|
+
<xsl:with-param name="pString">
|
|
44
|
+
<xsl:value-of select="substring(marc:subfield[@code='a'],$vNFI+1)"/>
|
|
45
|
+
</xsl:with-param>
|
|
46
|
+
</xsl:call-template>
|
|
47
|
+
</xsl:variable>
|
|
48
|
+
|
|
49
|
+
<!-- generate Title properties from linked 880 -->
|
|
50
|
+
|
|
51
|
+
<xsl:variable name="vOccurrence">
|
|
52
|
+
<xsl:if test="marc:subfield[@code='6'] and not(contains(marc:subfield[@code='6'], '-00'))">
|
|
53
|
+
<xsl:value-of select="substring(substring-after(marc:subfield[@code='6'],'-'),1,2)"/>
|
|
54
|
+
</xsl:if>
|
|
55
|
+
</xsl:variable>
|
|
56
|
+
<xsl:variable name="vRelated880" select="../marc:datafield[@tag='880' and substring(marc:subfield[@code='6'],1,3)='740' and substring(substring-after(marc:subfield[@code='6'],'-'),1,2)=$vOccurrence]" />
|
|
57
|
+
<xsl:variable name="v880XmlLang"><xsl:apply-templates select="$vRelated880" mode="xmllang"/></xsl:variable>
|
|
58
|
+
<xsl:choose>
|
|
59
|
+
<xsl:when test="$serialization='rdfxml'">
|
|
60
|
+
<bf:relation>
|
|
61
|
+
<bf:Relation>
|
|
62
|
+
<bf:relationship>
|
|
63
|
+
<xsl:attribute name="rdf:resource"><xsl:value-of select="$vProperty"/></xsl:attribute>
|
|
64
|
+
</bf:relationship>
|
|
65
|
+
<bf:associatedResource>
|
|
66
|
+
<bf:Work>
|
|
67
|
+
<xsl:attribute name="rdf:about"><xsl:value-of select="$vWorkUri"/></xsl:attribute>
|
|
68
|
+
<rdf:type>
|
|
69
|
+
<xsl:attribute name="rdf:resource">
|
|
70
|
+
<xsl:value-of select="concat($bflc,'Uncontrolled')"/>
|
|
71
|
+
</xsl:attribute>
|
|
72
|
+
</rdf:type>
|
|
73
|
+
<xsl:if test="marc:subfield[@code='a']">
|
|
74
|
+
<bf:title>
|
|
75
|
+
<bf:Title>
|
|
76
|
+
<bflc:nonSortNum>
|
|
77
|
+
<xsl:if test="$vXmlLang != ''">
|
|
78
|
+
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
|
|
79
|
+
</xsl:if>
|
|
80
|
+
<xsl:value-of select="$vNFI" />
|
|
81
|
+
</bflc:nonSortNum>
|
|
82
|
+
<bf:mainTitle><xsl:value-of select="$vmainTitle" /></bf:mainTitle>
|
|
83
|
+
<xsl:if test="$vRelated880/marc:subfield[@code='a']">
|
|
84
|
+
<xsl:variable name="vNFI880">
|
|
85
|
+
<xsl:choose>
|
|
86
|
+
<xsl:when test="translate($vRelated880/@ind1,'0123456789','')=''"><xsl:value-of select="$vRelated880/@ind1"/></xsl:when>
|
|
87
|
+
<xsl:otherwise>0</xsl:otherwise>
|
|
88
|
+
</xsl:choose>
|
|
89
|
+
</xsl:variable>
|
|
90
|
+
<xsl:variable name="vmainTitle880">
|
|
91
|
+
<xsl:call-template name="tChopPunct">
|
|
92
|
+
<xsl:with-param name="pString">
|
|
93
|
+
<xsl:value-of select="substring($vRelated880/marc:subfield[@code='a'],$vNFI880+1)"/>
|
|
94
|
+
</xsl:with-param>
|
|
95
|
+
</xsl:call-template>
|
|
96
|
+
</xsl:variable>
|
|
97
|
+
<bflc:nonSortNum>
|
|
98
|
+
<xsl:if test="$v880XmlLang != ''">
|
|
99
|
+
<xsl:attribute name="xml:lang"><xsl:value-of select="$v880XmlLang"/></xsl:attribute>
|
|
100
|
+
</xsl:if>
|
|
101
|
+
<xsl:value-of select="$vNFI880" />
|
|
102
|
+
</bflc:nonSortNum>
|
|
103
|
+
<bf:mainTitle>
|
|
104
|
+
<xsl:if test="$v880XmlLang != ''">
|
|
105
|
+
<xsl:attribute name="xml:lang"><xsl:value-of select="$v880XmlLang"/></xsl:attribute>
|
|
106
|
+
</xsl:if>
|
|
107
|
+
<xsl:value-of select="$vmainTitle880" />
|
|
108
|
+
</bf:mainTitle>
|
|
109
|
+
</xsl:if>
|
|
110
|
+
</bf:Title>
|
|
111
|
+
</bf:title>
|
|
112
|
+
</xsl:if>
|
|
113
|
+
<xsl:for-each select="marc:subfield[@code='n']">
|
|
114
|
+
<bf:partNumber>
|
|
115
|
+
<xsl:call-template name="tChopPunct">
|
|
116
|
+
<xsl:with-param name="pString" select="."/>
|
|
117
|
+
</xsl:call-template>
|
|
118
|
+
</bf:partNumber>
|
|
119
|
+
</xsl:for-each>
|
|
120
|
+
<xsl:for-each select="$vRelated880/marc:subfield[@code='n']">
|
|
121
|
+
<bf:partNumber>
|
|
122
|
+
<xsl:if test="$v880XmlLang != ''">
|
|
123
|
+
<xsl:attribute name="xml:lang"><xsl:value-of select="$v880XmlLang"/></xsl:attribute>
|
|
124
|
+
</xsl:if>
|
|
125
|
+
<xsl:call-template name="tChopPunct">
|
|
126
|
+
<xsl:with-param name="pString" select="."/>
|
|
127
|
+
</xsl:call-template>
|
|
128
|
+
</bf:partNumber>
|
|
129
|
+
</xsl:for-each>
|
|
130
|
+
<xsl:for-each select="marc:subfield[@code='p']">
|
|
131
|
+
<bf:partName>
|
|
132
|
+
<xsl:call-template name="tChopPunct">
|
|
133
|
+
<xsl:with-param name="pString" select="."/>
|
|
134
|
+
</xsl:call-template>
|
|
135
|
+
</bf:partName>
|
|
136
|
+
</xsl:for-each>
|
|
137
|
+
<xsl:for-each select="$vRelated880/marc:subfield[@code='p']">
|
|
138
|
+
<bf:partName>
|
|
139
|
+
<xsl:if test="$v880XmlLang != ''">
|
|
140
|
+
<xsl:attribute name="xml:lang"><xsl:value-of select="$v880XmlLang"/></xsl:attribute>
|
|
141
|
+
</xsl:if>
|
|
142
|
+
<xsl:call-template name="tChopPunct">
|
|
143
|
+
<xsl:with-param name="pString" select="."/>
|
|
144
|
+
</xsl:call-template>
|
|
145
|
+
</bf:partName>
|
|
146
|
+
</xsl:for-each>
|
|
147
|
+
<xsl:apply-templates select="marc:subfield[@code='5']" mode="subfield5">
|
|
148
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
149
|
+
</xsl:apply-templates>
|
|
150
|
+
</bf:Work>
|
|
151
|
+
</bf:associatedResource>
|
|
152
|
+
</bf:Relation>
|
|
153
|
+
</bf:relation>
|
|
154
|
+
</xsl:when>
|
|
155
|
+
</xsl:choose>
|
|
156
|
+
</xsl:if>
|
|
157
|
+
</xsl:template>
|
|
158
|
+
|
|
159
|
+
<xsl:template match="marc:datafield[@tag='752' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='752')]" mode="work">
|
|
160
|
+
<xsl:param name="serialization" select="'rdfxml'"/>
|
|
161
|
+
<xsl:param name="recordid"/>
|
|
162
|
+
<xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
|
|
163
|
+
<xsl:variable name="vLabel">
|
|
164
|
+
<xsl:call-template name="tChopPunct">
|
|
165
|
+
<xsl:with-param name="pEndPunct"><xsl:text>-</xsl:text></xsl:with-param>
|
|
166
|
+
<xsl:with-param name="pString">
|
|
167
|
+
<xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c' or @code='d' or @code='f' or @code='g' or @code='h']">
|
|
168
|
+
<xsl:value-of select="concat(.,'--')"/>
|
|
169
|
+
</xsl:for-each>
|
|
170
|
+
</xsl:with-param>
|
|
171
|
+
</xsl:call-template>
|
|
172
|
+
</xsl:variable>
|
|
173
|
+
<xsl:variable name="vPlaceUri">
|
|
174
|
+
<xsl:apply-templates mode="generateUri" select="."/>
|
|
175
|
+
</xsl:variable>
|
|
176
|
+
<xsl:choose>
|
|
177
|
+
<xsl:when test="$serialization='rdfxml'">
|
|
178
|
+
<bf:place>
|
|
179
|
+
<bf:Place>
|
|
180
|
+
<xsl:if test="$vPlaceUri != ''">
|
|
181
|
+
<xsl:attribute name="rdf:about"><xsl:value-of select="$vPlaceUri"/></xsl:attribute>
|
|
182
|
+
</xsl:if>
|
|
183
|
+
<rdf:type>
|
|
184
|
+
<xsl:attribute name="rdf:resource"><xsl:value-of select="concat($madsrdf,'HierarchicalGeographic')"/></xsl:attribute>
|
|
185
|
+
</rdf:type>
|
|
186
|
+
<rdfs:label><xsl:value-of select="$vLabel"/></rdfs:label>
|
|
187
|
+
<madsrdf:componentList rdf:parseType="Collection">
|
|
188
|
+
<xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c' or @code='d' or @code='f' or @code='g' or @code='h']">
|
|
189
|
+
<xsl:variable name="vResource">
|
|
190
|
+
<xsl:choose>
|
|
191
|
+
<xsl:when test="@code='a'">madsrdf:Country</xsl:when>
|
|
192
|
+
<xsl:when test="@code='b'">madsrdf:State</xsl:when>
|
|
193
|
+
<xsl:when test="@code='c'">madsrdf:County</xsl:when>
|
|
194
|
+
<xsl:when test="@code='d'">madsrdf:City</xsl:when>
|
|
195
|
+
<xsl:when test="@code='f'">madsrdf:CitySection</xsl:when>
|
|
196
|
+
<xsl:when test="@code='g'">madsrdf:Region</xsl:when>
|
|
197
|
+
<xsl:when test="@code='h'">madsrdf:ExtraterrestrialArea</xsl:when>
|
|
198
|
+
</xsl:choose>
|
|
199
|
+
</xsl:variable>
|
|
200
|
+
<xsl:element name="{$vResource}">
|
|
201
|
+
<rdfs:label>
|
|
202
|
+
<xsl:if test="$vXmlLang != ''">
|
|
203
|
+
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
|
|
204
|
+
</xsl:if>
|
|
205
|
+
<xsl:call-template name="tChopPunct">
|
|
206
|
+
<xsl:with-param name="pString" select="."/>
|
|
207
|
+
</xsl:call-template>
|
|
208
|
+
</rdfs:label>
|
|
209
|
+
</xsl:element>
|
|
210
|
+
</xsl:for-each>
|
|
211
|
+
</madsrdf:componentList>
|
|
212
|
+
<xsl:for-each select="marc:subfield[@code='0' or @code='w'][starts-with(text(),'(uri)') or starts-with(text(),'http')]">
|
|
213
|
+
<xsl:if test="position() != 1">
|
|
214
|
+
<xsl:apply-templates mode="subfield0orw" select=".">
|
|
215
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
216
|
+
</xsl:apply-templates>
|
|
217
|
+
</xsl:if>
|
|
218
|
+
</xsl:for-each>
|
|
219
|
+
<xsl:for-each select="marc:subfield[@code='0' or @code='w']">
|
|
220
|
+
<xsl:if test="substring(text(),1,5) != '(uri)' and substring(text(),1,4) != 'http'">
|
|
221
|
+
<xsl:apply-templates mode="subfield0orw" select=".">
|
|
222
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
223
|
+
</xsl:apply-templates>
|
|
224
|
+
</xsl:if>
|
|
225
|
+
</xsl:for-each>
|
|
226
|
+
<xsl:apply-templates select="marc:subfield[@code='2']" mode="subfield2">
|
|
227
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
228
|
+
</xsl:apply-templates>
|
|
229
|
+
<xsl:apply-templates select="marc:subfield[@code='e']" mode="contributionRole">
|
|
230
|
+
<xsl:with-param name="pMode">relationship</xsl:with-param>
|
|
231
|
+
<xsl:with-param name="pRelatedTo"><xsl:value-of select="$recordid"/>#Work</xsl:with-param>
|
|
232
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
233
|
+
</xsl:apply-templates>
|
|
234
|
+
<xsl:for-each select="marc:subfield[@code='4']">
|
|
235
|
+
<xsl:variable name="encoded">
|
|
236
|
+
<xsl:call-template name="url-encode">
|
|
237
|
+
<xsl:with-param name="str" select="normalize-space(substring(.,1,3))"/>
|
|
238
|
+
</xsl:call-template>
|
|
239
|
+
</xsl:variable>
|
|
240
|
+
<bf:relation>
|
|
241
|
+
<bf:Relation>
|
|
242
|
+
<bf:relationship>
|
|
243
|
+
<bf:Relationship>
|
|
244
|
+
<xsl:attribute name="rdf:about"><xsl:value-of select="concat($relators,$encoded)"/></xsl:attribute>
|
|
245
|
+
</bf:Relationship>
|
|
246
|
+
</bf:relationship>
|
|
247
|
+
<bf:associatedResource>
|
|
248
|
+
<xsl:attribute name="rdf:resource"><xsl:value-of select="$recordid"/>#Work</xsl:attribute>
|
|
249
|
+
</bf:associatedResource>
|
|
250
|
+
</bf:Relation>
|
|
251
|
+
</bf:relation>
|
|
252
|
+
</xsl:for-each>
|
|
253
|
+
</bf:Place>
|
|
254
|
+
</bf:place>
|
|
255
|
+
</xsl:when>
|
|
256
|
+
</xsl:choose>
|
|
257
|
+
</xsl:template>
|
|
258
|
+
|
|
259
|
+
<xsl:template match="marc:datafield[@tag='753' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='753')]" mode="instance">
|
|
260
|
+
<xsl:param name="serialization" select="$serialization"/>
|
|
261
|
+
<xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
|
|
262
|
+
<xsl:choose>
|
|
263
|
+
<xsl:when test="$serialization = 'rdfxml'">
|
|
264
|
+
<xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c']">
|
|
265
|
+
<xsl:variable name="vCurrentNode" select="generate-id(.)"/>
|
|
266
|
+
<xsl:variable name="vCurrentNodeUri">
|
|
267
|
+
<xsl:for-each select="following-sibling::marc:subfield[@code='0' and generate-id(preceding-sibling::marc:subfield[@code != '0'][1])=$vCurrentNode and contains(text(),'://')]">
|
|
268
|
+
<xsl:if test="position() = 1">
|
|
269
|
+
<xsl:choose>
|
|
270
|
+
<xsl:when test="starts-with(.,'(uri)')">
|
|
271
|
+
<xsl:value-of select="substring-after(.,'(uri)')"/>
|
|
272
|
+
</xsl:when>
|
|
273
|
+
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
|
|
274
|
+
</xsl:choose>
|
|
275
|
+
</xsl:if>
|
|
276
|
+
</xsl:for-each>
|
|
277
|
+
</xsl:variable>
|
|
278
|
+
<xsl:variable name="vResource">
|
|
279
|
+
<xsl:choose>
|
|
280
|
+
<xsl:when test="@code='a'">bflc:MachineModel</xsl:when>
|
|
281
|
+
<xsl:when test="@code='b'">bflc:ProgrammingLanguage</xsl:when>
|
|
282
|
+
<xsl:when test="@code='c'">bflc:OperatingSystem</xsl:when>
|
|
283
|
+
</xsl:choose>
|
|
284
|
+
</xsl:variable>
|
|
285
|
+
<bf:systemRequirement>
|
|
286
|
+
<xsl:element name="{$vResource}">
|
|
287
|
+
<xsl:if test="$vCurrentNodeUri != ''">
|
|
288
|
+
<xsl:attribute name="rdf:about"><xsl:value-of select="$vCurrentNodeUri"/></xsl:attribute>
|
|
289
|
+
</xsl:if>
|
|
290
|
+
<rdfs:label>
|
|
291
|
+
<xsl:if test="$vXmlLang != ''">
|
|
292
|
+
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
|
|
293
|
+
</xsl:if>
|
|
294
|
+
<xsl:call-template name="tChopPunct">
|
|
295
|
+
<xsl:with-param name="pString" select="."/>
|
|
296
|
+
</xsl:call-template>
|
|
297
|
+
</rdfs:label>
|
|
298
|
+
<xsl:for-each select="following-sibling::marc:subfield[@code='0' and generate-id(preceding-sibling::marc:subfield[@code != '0'][1])=$vCurrentNode and contains(text(),'://')]">
|
|
299
|
+
<xsl:variable name="the0">
|
|
300
|
+
<xsl:choose>
|
|
301
|
+
<xsl:when test="starts-with(.,'(uri)')">
|
|
302
|
+
<xsl:value-of select="substring-after(.,'(uri)')"/>
|
|
303
|
+
</xsl:when>
|
|
304
|
+
<xsl:otherwise>
|
|
305
|
+
<xsl:value-of select="."/>
|
|
306
|
+
</xsl:otherwise>
|
|
307
|
+
</xsl:choose>
|
|
308
|
+
</xsl:variable>
|
|
309
|
+
<xsl:if test="$the0 != $vCurrentNodeUri">
|
|
310
|
+
<madsrdf:hasRelatedAuthority>
|
|
311
|
+
<xsl:attribute name="rdf:resource">
|
|
312
|
+
<xsl:value-of select="$the0"/>
|
|
313
|
+
</xsl:attribute>
|
|
314
|
+
</madsrdf:hasRelatedAuthority>
|
|
315
|
+
</xsl:if>
|
|
316
|
+
</xsl:for-each>
|
|
317
|
+
<xsl:apply-templates select="following-sibling::marc:subfield[@code='0' and generate-id(preceding-sibling::marc:subfield[@code != '0'][1])=$vCurrentNode and not(contains(text(),'://'))]" mode="subfield0orw">
|
|
318
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
319
|
+
</xsl:apply-templates>
|
|
320
|
+
<xsl:apply-templates select="following-sibling::marc:subfield[@code='0' and generate-id(preceding-sibling::marc:subfield[@code != '0'][1])=$vCurrentNode and not(contains(text(),'://'))]" mode="subfield0orw">
|
|
321
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
322
|
+
</xsl:apply-templates>
|
|
323
|
+
<xsl:apply-templates select="../marc:subfield[@code='2']" mode="subfield2">
|
|
324
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
325
|
+
</xsl:apply-templates>
|
|
326
|
+
</xsl:element>
|
|
327
|
+
</bf:systemRequirement>
|
|
328
|
+
</xsl:for-each>
|
|
329
|
+
</xsl:when>
|
|
330
|
+
</xsl:choose>
|
|
331
|
+
</xsl:template>
|
|
332
|
+
|
|
333
|
+
</xsl:stylesheet>
|
|
@@ -0,0 +1,102 @@
|
|
|
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
|
+
<!--
|
|
13
|
+
Conversion specs for 758
|
|
14
|
+
-->
|
|
15
|
+
<xsl:template match="marc:datafield[
|
|
16
|
+
@tag='758' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='758') and
|
|
17
|
+
not(marc:subfield[@code='4']='http://id.loc.gov/ontologies/bibframe/instanceOf')]" mode="work">
|
|
18
|
+
<xsl:param name="serialization" select="'rdfxml'"/>
|
|
19
|
+
<xsl:param name="recordid"/>
|
|
20
|
+
<xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
|
|
21
|
+
<xsl:variable name="vLabel"><xsl:value-of select="marc:subfield[@code='a']" /></xsl:variable>
|
|
22
|
+
|
|
23
|
+
<!-- Sorry. Hacky thing for LC. -->
|
|
24
|
+
<xsl:variable name="baseuri-minus-REPLACE">
|
|
25
|
+
<xsl:choose>
|
|
26
|
+
<xsl:when test="contains($recordid, '/REPLACE/')">
|
|
27
|
+
<xsl:value-of select="substring-before($recordid, '/REPLACE/')"/>
|
|
28
|
+
</xsl:when>
|
|
29
|
+
<xsl:otherwise>http://may.this/never/exist/</xsl:otherwise>
|
|
30
|
+
</xsl:choose>
|
|
31
|
+
</xsl:variable>
|
|
32
|
+
<xsl:choose>
|
|
33
|
+
<xsl:when test="not(contains(marc:subfield[@code='1'][1], $baseuri-minus-REPLACE)) and not(marc:subfield[@code='i']) and not(marc:subfield[@code='4'])">
|
|
34
|
+
<bf:relation>
|
|
35
|
+
<bf:Relation>
|
|
36
|
+
<bf:relationship rdf:resource="http://id.loc.gov/ontologies/bibframe/hasEquivalent" />
|
|
37
|
+
<xsl:for-each select="marc:subfield[@code='0' or @code='1'][starts-with(text(),'(uri)') or starts-with(text(),'http')]">
|
|
38
|
+
<xsl:apply-templates select="." mode="df758subfield0or1" />
|
|
39
|
+
</xsl:for-each>
|
|
40
|
+
</bf:Relation>
|
|
41
|
+
</bf:relation>
|
|
42
|
+
</xsl:when>
|
|
43
|
+
<xsl:when test="not(contains(marc:subfield[@code='1'][1], $baseuri-minus-REPLACE)) and marc:subfield[@code='4'] and not(contains(marc:subfield[@code='4'], 'rdaregistry'))">
|
|
44
|
+
<bf:relation>
|
|
45
|
+
<bf:Relation>
|
|
46
|
+
<xsl:for-each select="marc:subfield[@code='4']">
|
|
47
|
+
<xsl:choose>
|
|
48
|
+
<xsl:when test="starts-with(text(),'http')">
|
|
49
|
+
<bf:relationship>
|
|
50
|
+
<xsl:attribute name="rdf:resource"><xsl:value-of select="text()"/></xsl:attribute>
|
|
51
|
+
</bf:relationship>
|
|
52
|
+
</xsl:when>
|
|
53
|
+
<xsl:otherwise>
|
|
54
|
+
<bf:relationship>
|
|
55
|
+
<bf:Relationship>
|
|
56
|
+
<rdfs:label><xsl:value-of select="text()" /></rdfs:label>
|
|
57
|
+
</bf:Relationship>
|
|
58
|
+
</bf:relationship>
|
|
59
|
+
</xsl:otherwise>
|
|
60
|
+
</xsl:choose>
|
|
61
|
+
</xsl:for-each>
|
|
62
|
+
<xsl:for-each select="marc:subfield[@code='0' or @code='1'][starts-with(text(),'(uri)') or starts-with(text(),'http')]">
|
|
63
|
+
<xsl:apply-templates select="." mode="df758subfield0or1" />
|
|
64
|
+
</xsl:for-each>
|
|
65
|
+
</bf:Relation>
|
|
66
|
+
</bf:relation>
|
|
67
|
+
</xsl:when>
|
|
68
|
+
<xsl:when test="not(contains(marc:subfield[@code='1'][1], $baseuri-minus-REPLACE)) and marc:subfield[@code='i']">
|
|
69
|
+
<bf:relation>
|
|
70
|
+
<bf:Relation>
|
|
71
|
+
<xsl:for-each select="marc:subfield[@code='i']">
|
|
72
|
+
<bf:relationship>
|
|
73
|
+
<bf:Relationship>
|
|
74
|
+
<rdfs:label><xsl:value-of select="text()" /></rdfs:label>
|
|
75
|
+
</bf:Relationship>
|
|
76
|
+
</bf:relationship>
|
|
77
|
+
</xsl:for-each>
|
|
78
|
+
<xsl:for-each select="marc:subfield[@code='0' or @code='1'][starts-with(text(),'(uri)') or starts-with(text(),'http')]">
|
|
79
|
+
<xsl:apply-templates select="." mode="df758subfield0or1" />
|
|
80
|
+
</xsl:for-each>
|
|
81
|
+
</bf:Relation>
|
|
82
|
+
</bf:relation>
|
|
83
|
+
</xsl:when>
|
|
84
|
+
</xsl:choose>
|
|
85
|
+
</xsl:template>
|
|
86
|
+
|
|
87
|
+
<!--
|
|
88
|
+
create a bf:identifiedBy property from a subfield $0 or $w
|
|
89
|
+
-->
|
|
90
|
+
<xsl:template match="marc:subfield" mode="df758subfield0or1">
|
|
91
|
+
<xsl:param name="serialization" select="'rdfxml'"/>
|
|
92
|
+
<xsl:variable name="relatedUri">
|
|
93
|
+
<xsl:choose>
|
|
94
|
+
<xsl:when test="starts-with(text(),'(uri)')"><xsl:value-of select="substring-after(text(),'(uri)')" /></xsl:when>
|
|
95
|
+
<xsl:otherwise><xsl:value-of select="text()" /></xsl:otherwise>
|
|
96
|
+
</xsl:choose>
|
|
97
|
+
</xsl:variable>
|
|
98
|
+
<bf:associatedResource>
|
|
99
|
+
<xsl:attribute name="rdf:resource"><xsl:value-of select="$relatedUri"/></xsl:attribute>
|
|
100
|
+
</bf:associatedResource>
|
|
101
|
+
</xsl:template>
|
|
102
|
+
</xsl:stylesheet>
|