Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat OCLC Work identifiers as bf:Work bf:Identifiers #101

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/ConvSpec-010-048.xspec
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<x:expect label="$q creates a qualifier property of the Identifier" test="//bf:Instance[1]/bf:identifiedBy[16]/bf:Ismn/bf:qualifier[2] = 'sewn'"/>
<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'"/>
<x:expect label="$2 creates an rdfs:label property of the Identifier" test="//bf:Instance[1]/bf:identifiedBy[19]/bf:Istc/rdfs:label = 'istc'"/>
<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'"/>
</x:scenario>

<x:scenario label="025 - OVERSEAS ACQUISITION NUMBER">
Expand Down
4 changes: 4 additions & 0 deletions test/data/ConvSpec-010-048/marc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
<datafield tag="024" ind1="8" ind2=" ">
<subfield code="a">12345678</subfield>
</datafield>
<datafield tag="024" ind1="7" ind2=" ">
<subfield code="a">http://worldcat.org/entity/work/id/762673833</subfield>
<subfield code="2">uri</subfield>
</datafield>
<datafield tag="025" ind1=" " ind2=" ">
<subfield code="a">LACAP72-1719</subfield>
</datafield>
Expand Down
104 changes: 61 additions & 43 deletions xsl/ConvSpec-010-048.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,22 @@
</xsl:choose>
</xsl:template>

<xsl:template match="marc:datafield[@tag='024']" mode="work">
<xsl:if test='starts-with(marc:subfield[@code="a"], "http://worldcat.org/entity/work/")' >
<xsl:choose>
<xsl:when test="$serialization = 'rdfxml'">
<xsl:for-each select="marc:subfield[@code='a']">
<bf:identifiedBy>
<bf:Identifier>
<xsl:attribute name="rdf:about"><xsl:value-of select="."/></xsl:attribute>
</bf:Identifier>
</bf:identifiedBy>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template>

<xsl:template match="marc:datafield[@tag='033']" mode="work">
<xsl:param name="serialization" select="'rdfxml'"/>
<xsl:variable name="vDate">
Expand Down Expand Up @@ -862,52 +878,54 @@
</xsl:apply-templates>
</xsl:when>
<xsl:when test="@tag='024'">
<xsl:variable name="vIdentifier">
<xsl:if test='not(starts-with(marc:subfield[@code="a"], "http://worldcat.org/entity/work/"))' >
<xsl:variable name="vIdentifier">
<xsl:choose>
<xsl:when test="@ind1 = '0'">bf:Isrc</xsl:when>
<xsl:when test="@ind1 = '1'">bf:Upc</xsl:when>
<xsl:when test="@ind1 = '2'">bf:Ismn</xsl:when>
<xsl:when test="@ind1 = '3'">bf:Ean</xsl:when>
<xsl:when test="@ind1 = '4'">bf:Sici</xsl:when>
<xsl:when test="@ind1 = '7'">
<xsl:choose>
<xsl:when test="marc:subfield[@code='2' and text()='ansi']">bf:Ansi</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='doi']">bf:Doi</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='hdl']">bf:Hdl</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='isan']">bf:Isan</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='isni']">bf:Isni</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='iso']">bf:Iso</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='istc']">bf:Istc</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='iswc']">bf:Iswc</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='matrix-number']">bf:MatrixNumber</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='music-plate']">bf:MusicPlate</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='music-publisher']">bf:MusicPublisherNumber</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='stock-number']">bf:StockNumber</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='urn']">bf:Urn</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='videorecording-identifier']">bf:VideoRecordingNumber</xsl:when>
<xsl:otherwise>bf:Identifier</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>bf:Identifier</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="@ind1 = '0'">bf:Isrc</xsl:when>
<xsl:when test="@ind1 = '1'">bf:Upc</xsl:when>
<xsl:when test="@ind1 = '2'">bf:Ismn</xsl:when>
<xsl:when test="@ind1 = '3'">bf:Ean</xsl:when>
<xsl:when test="@ind1 = '4'">bf:Sici</xsl:when>
<xsl:when test="@ind1 = '7'">
<xsl:choose>
<xsl:when test="marc:subfield[@code='2' and text()='ansi']">bf:Ansi</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='doi']">bf:Doi</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='hdl']">bf:Hdl</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='isan']">bf:Isan</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='isni']">bf:Isni</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='iso']">bf:Iso</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='istc']">bf:Istc</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='iswc']">bf:Iswc</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='matrix-number']">bf:MatrixNumber</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='music-plate']">bf:MusicPlate</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='music-publisher']">bf:MusicPublisherNumber</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='stock-number']">bf:StockNumber</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='urn']">bf:Urn</xsl:when>
<xsl:when test="marc:subfield[@code='2' and text()='videorecording-identifier']">bf:VideoRecordingNumber</xsl:when>
<xsl:otherwise>bf:Identifier</xsl:otherwise>
</xsl:choose>
<xsl:when test="$serialization='rdfxml'">
<xsl:for-each select="marc:subfield[@code='c']">
<bf:acquisitionTerms>
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString"><xsl:value-of select="."/></xsl:with-param>
<xsl:with-param name="punctuation"><xsl:text>:,;/ </xsl:text></xsl:with-param>
</xsl:call-template>
</bf:acquisitionTerms>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>bf:Identifier</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$serialization='rdfxml'">
<xsl:for-each select="marc:subfield[@code='c']">
<bf:acquisitionTerms>
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString"><xsl:value-of select="."/></xsl:with-param>
<xsl:with-param name="punctuation"><xsl:text>:,;/ </xsl:text></xsl:with-param>
</xsl:call-template>
</bf:acquisitionTerms>
</xsl:for-each>
</xsl:when>
</xsl:choose>
<xsl:apply-templates select="." mode="instanceId">
<xsl:with-param name="serialization" select="$serialization"/>
<xsl:with-param name="pIdentifier"><xsl:value-of select="$vIdentifier"/></xsl:with-param>
<xsl:with-param name="pInvalidLabel">invalid</xsl:with-param>
</xsl:apply-templates>
<xsl:apply-templates select="." mode="instanceId">
<xsl:with-param name="serialization" select="$serialization"/>
<xsl:with-param name="pIdentifier"><xsl:value-of select="$vIdentifier"/></xsl:with-param>
<xsl:with-param name="pInvalidLabel">invalid</xsl:with-param>
</xsl:apply-templates>
</xsl:if>
</xsl:when>
<xsl:when test="@tag='025'">
<xsl:apply-templates select="." mode="instanceId">
Expand Down