Skip to content

Commit 8db4be7

Browse files
author
Dan Scott
committed
Treat OCLC Work identifiers as bf:Work bf:Identifiers
The OCLC Work identifier URIs are intended to group like works together, thus if found they should be turned into an Identifier at the level of a bf:Work instead of at the bf:Instance level. Signed-off-by: Dan Scott <dscott@laurentian.ca>
1 parent 786c218 commit 8db4be7

3 files changed

Lines changed: 66 additions & 43 deletions

File tree

test/ConvSpec-010-048.xspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
<x:expect label="$q creates a qualifier property of the Identifier" test="//bf:Instance[1]/bf:identifiedBy[16]/bf:Ismn/bf:qualifier[2] = 'sewn'"/>
7777
<x:expect label="$z creates a status/Status property of the Identifier with rdfs:label 'invalid'" test="//bf:Instance[1]/bf:identifiedBy[15]/bf:Upc/bf:status/bf:Status/rdfs:label = 'invalid'"/>
7878
<x:expect label="$2 creates an rdfs:label property of the Identifier" test="//bf:Instance[1]/bf:identifiedBy[19]/bf:Istc/rdfs:label = 'istc'"/>
79+
<x:expect label="might be identified by an OCLC Work Identifier" test="//bf:Work[1]/bf:identifiedBy[3]/bf:Identifier/@rdf:about = 'http://worldcat.org/entity/work/id/762673833'"/>
7980
</x:scenario>
8081

8182
<x:scenario label="025 - OVERSEAS ACQUISITION NUMBER">

test/data/ConvSpec-010-048/marc.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@
7474
<datafield tag="024" ind1="8" ind2=" ">
7575
<subfield code="a">12345678</subfield>
7676
</datafield>
77+
<datafield tag="024" ind1="7" ind2=" ">
78+
<subfield code="a">http://worldcat.org/entity/work/id/762673833</subfield>
79+
<subfield code="2">uri</subfield>
80+
</datafield>
7781
<datafield tag="025" ind1=" " ind2=" ">
7882
<subfield code="a">LACAP72-1719</subfield>
7983
</datafield>

xsl/ConvSpec-010-048.xsl

Lines changed: 61 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,22 @@
323323
</xsl:choose>
324324
</xsl:template>
325325

326+
<xsl:template match="marc:datafield[@tag='024']" mode="work">
327+
<xsl:if test='starts-with(marc:subfield[@code="a"], "http://worldcat.org/entity/work/")' >
328+
<xsl:choose>
329+
<xsl:when test="$serialization = 'rdfxml'">
330+
<xsl:for-each select="marc:subfield[@code='a']">
331+
<bf:identifiedBy>
332+
<bf:Identifier>
333+
<xsl:attribute name="rdf:about"><xsl:value-of select="."/></xsl:attribute>
334+
</bf:Identifier>
335+
</bf:identifiedBy>
336+
</xsl:for-each>
337+
</xsl:when>
338+
</xsl:choose>
339+
</xsl:if>
340+
</xsl:template>
341+
326342
<xsl:template match="marc:datafield[@tag='033']" mode="work">
327343
<xsl:param name="serialization" select="'rdfxml'"/>
328344
<xsl:variable name="vDate">
@@ -862,52 +878,54 @@
862878
</xsl:apply-templates>
863879
</xsl:when>
864880
<xsl:when test="@tag='024'">
865-
<xsl:variable name="vIdentifier">
881+
<xsl:if test='not(starts-with(marc:subfield[@code="a"], "http://worldcat.org/entity/work/"))' >
882+
<xsl:variable name="vIdentifier">
883+
<xsl:choose>
884+
<xsl:when test="@ind1 = '0'">bf:Isrc</xsl:when>
885+
<xsl:when test="@ind1 = '1'">bf:Upc</xsl:when>
886+
<xsl:when test="@ind1 = '2'">bf:Ismn</xsl:when>
887+
<xsl:when test="@ind1 = '3'">bf:Ean</xsl:when>
888+
<xsl:when test="@ind1 = '4'">bf:Sici</xsl:when>
889+
<xsl:when test="@ind1 = '7'">
890+
<xsl:choose>
891+
<xsl:when test="marc:subfield[@code='2' and text()='ansi']">bf:Ansi</xsl:when>
892+
<xsl:when test="marc:subfield[@code='2' and text()='doi']">bf:Doi</xsl:when>
893+
<xsl:when test="marc:subfield[@code='2' and text()='hdl']">bf:Hdl</xsl:when>
894+
<xsl:when test="marc:subfield[@code='2' and text()='isan']">bf:Isan</xsl:when>
895+
<xsl:when test="marc:subfield[@code='2' and text()='isni']">bf:Isni</xsl:when>
896+
<xsl:when test="marc:subfield[@code='2' and text()='iso']">bf:Iso</xsl:when>
897+
<xsl:when test="marc:subfield[@code='2' and text()='istc']">bf:Istc</xsl:when>
898+
<xsl:when test="marc:subfield[@code='2' and text()='iswc']">bf:Iswc</xsl:when>
899+
<xsl:when test="marc:subfield[@code='2' and text()='matrix-number']">bf:MatrixNumber</xsl:when>
900+
<xsl:when test="marc:subfield[@code='2' and text()='music-plate']">bf:MusicPlate</xsl:when>
901+
<xsl:when test="marc:subfield[@code='2' and text()='music-publisher']">bf:MusicPublisherNumber</xsl:when>
902+
<xsl:when test="marc:subfield[@code='2' and text()='stock-number']">bf:StockNumber</xsl:when>
903+
<xsl:when test="marc:subfield[@code='2' and text()='urn']">bf:Urn</xsl:when>
904+
<xsl:when test="marc:subfield[@code='2' and text()='videorecording-identifier']">bf:VideoRecordingNumber</xsl:when>
905+
<xsl:otherwise>bf:Identifier</xsl:otherwise>
906+
</xsl:choose>
907+
</xsl:when>
908+
<xsl:otherwise>bf:Identifier</xsl:otherwise>
909+
</xsl:choose>
910+
</xsl:variable>
866911
<xsl:choose>
867-
<xsl:when test="@ind1 = '0'">bf:Isrc</xsl:when>
868-
<xsl:when test="@ind1 = '1'">bf:Upc</xsl:when>
869-
<xsl:when test="@ind1 = '2'">bf:Ismn</xsl:when>
870-
<xsl:when test="@ind1 = '3'">bf:Ean</xsl:when>
871-
<xsl:when test="@ind1 = '4'">bf:Sici</xsl:when>
872-
<xsl:when test="@ind1 = '7'">
873-
<xsl:choose>
874-
<xsl:when test="marc:subfield[@code='2' and text()='ansi']">bf:Ansi</xsl:when>
875-
<xsl:when test="marc:subfield[@code='2' and text()='doi']">bf:Doi</xsl:when>
876-
<xsl:when test="marc:subfield[@code='2' and text()='hdl']">bf:Hdl</xsl:when>
877-
<xsl:when test="marc:subfield[@code='2' and text()='isan']">bf:Isan</xsl:when>
878-
<xsl:when test="marc:subfield[@code='2' and text()='isni']">bf:Isni</xsl:when>
879-
<xsl:when test="marc:subfield[@code='2' and text()='iso']">bf:Iso</xsl:when>
880-
<xsl:when test="marc:subfield[@code='2' and text()='istc']">bf:Istc</xsl:when>
881-
<xsl:when test="marc:subfield[@code='2' and text()='iswc']">bf:Iswc</xsl:when>
882-
<xsl:when test="marc:subfield[@code='2' and text()='matrix-number']">bf:MatrixNumber</xsl:when>
883-
<xsl:when test="marc:subfield[@code='2' and text()='music-plate']">bf:MusicPlate</xsl:when>
884-
<xsl:when test="marc:subfield[@code='2' and text()='music-publisher']">bf:MusicPublisherNumber</xsl:when>
885-
<xsl:when test="marc:subfield[@code='2' and text()='stock-number']">bf:StockNumber</xsl:when>
886-
<xsl:when test="marc:subfield[@code='2' and text()='urn']">bf:Urn</xsl:when>
887-
<xsl:when test="marc:subfield[@code='2' and text()='videorecording-identifier']">bf:VideoRecordingNumber</xsl:when>
888-
<xsl:otherwise>bf:Identifier</xsl:otherwise>
889-
</xsl:choose>
912+
<xsl:when test="$serialization='rdfxml'">
913+
<xsl:for-each select="marc:subfield[@code='c']">
914+
<bf:acquisitionTerms>
915+
<xsl:call-template name="chopPunctuation">
916+
<xsl:with-param name="chopString"><xsl:value-of select="."/></xsl:with-param>
917+
<xsl:with-param name="punctuation"><xsl:text>:,;/ </xsl:text></xsl:with-param>
918+
</xsl:call-template>
919+
</bf:acquisitionTerms>
920+
</xsl:for-each>
890921
</xsl:when>
891-
<xsl:otherwise>bf:Identifier</xsl:otherwise>
892922
</xsl:choose>
893-
</xsl:variable>
894-
<xsl:choose>
895-
<xsl:when test="$serialization='rdfxml'">
896-
<xsl:for-each select="marc:subfield[@code='c']">
897-
<bf:acquisitionTerms>
898-
<xsl:call-template name="chopPunctuation">
899-
<xsl:with-param name="chopString"><xsl:value-of select="."/></xsl:with-param>
900-
<xsl:with-param name="punctuation"><xsl:text>:,;/ </xsl:text></xsl:with-param>
901-
</xsl:call-template>
902-
</bf:acquisitionTerms>
903-
</xsl:for-each>
904-
</xsl:when>
905-
</xsl:choose>
906-
<xsl:apply-templates select="." mode="instanceId">
907-
<xsl:with-param name="serialization" select="$serialization"/>
908-
<xsl:with-param name="pIdentifier"><xsl:value-of select="$vIdentifier"/></xsl:with-param>
909-
<xsl:with-param name="pInvalidLabel">invalid</xsl:with-param>
910-
</xsl:apply-templates>
923+
<xsl:apply-templates select="." mode="instanceId">
924+
<xsl:with-param name="serialization" select="$serialization"/>
925+
<xsl:with-param name="pIdentifier"><xsl:value-of select="$vIdentifier"/></xsl:with-param>
926+
<xsl:with-param name="pInvalidLabel">invalid</xsl:with-param>
927+
</xsl:apply-templates>
928+
</xsl:if>
911929
</xsl:when>
912930
<xsl:when test="@tag='025'">
913931
<xsl:apply-templates select="." mode="instanceId">

0 commit comments

Comments
 (0)