Skip to content

Commit

Permalink
Partial fix for #237; other issues may have been solved earlier.
Browse files Browse the repository at this point in the history
  • Loading branch information
kefo committed Aug 30, 2024
1 parent 37954ce commit 17bd816
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 23 deletions.
6 changes: 3 additions & 3 deletions test/ConvSpec-1XX,7XX,8XX-names.xspec
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@
<x:expect label="$1 becomes Agent URI" test="//bf:Work[1]/bf:contribution[8]/bf:Contribution/bf:agent/bf:Agent/@rdf:about='http://id.loc.gov/rwo/agents/n83170323'"/>
<x:expect label="...$0 becomes isIdentifiedByAuthority" test="//bf:Work[1]/bf:contribution[8]/bf:Contribution/bf:agent/bf:Agent/madsrdf:isIdentifiedByAuthority/@rdf:resource='http://id.loc.gov/authorities/names/n83170323'"/>

<x:expect label="Subject $0 becomes isIdentifiedByAuthority" test="//bf:Work[1]/bf:subject[1]/bf:Agent/madsrdf:isIdentifiedByAuthority/@rdf:resource='http://id.loc.gov/authorities/names/n79027239'"/>
<x:expect label="Subject $0 becomes isIdentifiedByAuthority" test="//bf:Work[1]/bf:subject[1]/bf:Agent/madsrdf:isIdentifiedByAuthority/madsrdf:PersonalName/@rdf:about='http://id.loc.gov/authorities/names/n79027239'"/>
<x:expect label="...And creates $1 from ID Authorities URI" test="//bf:Work[1]/bf:subject[1]/bf:Agent/@rdf:about='http://id.loc.gov/rwo/agents/n79027239'"/>

<x:expect label="Subject $1 becomes rdf:about" test="//bf:Work[1]/bf:subject[2]/bf:Agent/@rdf:about='http://id.loc.gov/rwo/agents/n79022244'"/>
<x:expect label="...And creates $0 from ID RWO URI" test="//bf:Work[1]/bf:subject[2]/bf:Agent/madsrdf:isIdentifiedByAuthority/@rdf:resource='http://id.loc.gov/authorities/names/n79022244'"/>
<x:expect label="...And creates $0 from ID RWO URI" test="//bf:Work[1]/bf:subject[2]/bf:Agent/madsrdf:isIdentifiedByAuthority/madsrdf:PersonalName/@rdf:about='http://id.loc.gov/authorities/names/n79022244'"/>

<x:expect label="Subject $1 becomes Agent URI" test="//bf:Work[1]/bf:subject[3]/bf:Agent/@rdf:about='https://viaf.org/viaf/76349832/'"/>
<x:expect label="No $0 so no isIdentifiedByAuthority" test="count(//bf:Work[1]/bf:subject[3]/bf:Agent/madsrdf:isIdentifiedByAuthority)=0"/>

<x:expect label="Subject $1 becomes Agent URI" test="//bf:Work[1]/bf:subject[4]/bf:Agent/@rdf:about='http://viaf.org/viaf/92989169'"/>
<x:expect label="...$0 becomes isIdentifiedByAuthority" test="//bf:Work[1]/bf:subject[4]/bf:Agent/madsrdf:isIdentifiedByAuthority/@rdf:resource='http://example.org/names/n80005801'"/>
<x:expect label="...$0 becomes isIdentifiedByAuthority" test="//bf:Work[1]/bf:subject[4]/bf:Agent/madsrdf:isIdentifiedByAuthority/madsrdf:PersonalName/@rdf:about='http://example.org/names/n80005801'"/>

</x:scenario>

Expand Down
12 changes: 0 additions & 12 deletions test/marc2bibframe2.xspec
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,6 @@
<bf:subject>
<bf:Agent rdf:about="http://example.org/12149120#Agent610-22">
<rdf:type rdf:resource="http://id.loc.gov/ontologies/bibframe/Organization" />
<rdf:type rdf:resource="http://www.loc.gov/mads/rdf/v1#CorporateName" />
<madsrdf:authoritativeLabel>White House (Washington, D.C.)</madsrdf:authoritativeLabel>
<madsrdf:isMemberOfMADSScheme rdf:resource="http://id.loc.gov/authorities/subjects" />
<rdfs:label>White House (Washington, D.C.)</rdfs:label>
<bflc:marcKey>61020$aWhite House (Washington, D.C.)</bflc:marcKey>
<bf:source rdf:resource="http://id.loc.gov/authorities/subjects" />
Expand All @@ -588,9 +585,6 @@
<bf:subject>
<bf:Agent rdf:about="http://example.org/12149120#Agent610-23">
<rdf:type rdf:resource="http://id.loc.gov/ontologies/bibframe/Jurisdiction" />
<rdf:type rdf:resource="http://www.loc.gov/mads/rdf/v1#CorporateName" />
<madsrdf:authoritativeLabel>United States. Executive Office of the President.</madsrdf:authoritativeLabel>
<madsrdf:isMemberOfMADSScheme rdf:resource="http://id.loc.gov/authorities/subjects" />
<rdfs:label>United States. Executive Office of the President.</rdfs:label>
<bflc:marcKey>61010$aUnited States.$bExecutive Office of the President.</bflc:marcKey>
<bf:source rdf:resource="http://id.loc.gov/authorities/subjects" />
Expand All @@ -599,9 +593,6 @@
<bf:subject>
<bf:Agent rdf:about="http://example.org/12149120#Agent610-24">
<rdf:type rdf:resource="http://id.loc.gov/ontologies/bibframe/Jurisdiction" />
<rdf:type rdf:resource="http://www.loc.gov/mads/rdf/v1#CorporateName" />
<madsrdf:authoritativeLabel>United States. Office of the Vice President.</madsrdf:authoritativeLabel>
<madsrdf:isMemberOfMADSScheme rdf:resource="http://id.loc.gov/authorities/subjects" />
<rdfs:label>United States. Office of the Vice President.</rdfs:label>
<bflc:marcKey>61010$aUnited States.$bOffice of the Vice President.</bflc:marcKey>
<bf:source rdf:resource="http://id.loc.gov/authorities/subjects" />
Expand All @@ -610,9 +601,6 @@
<bf:subject>
<bf:Agent rdf:about="http://example.org/12149120#Agent610-25">
<rdf:type rdf:resource="http://id.loc.gov/ontologies/bibframe/Jurisdiction" />
<rdf:type rdf:resource="http://www.loc.gov/mads/rdf/v1#CorporateName" />
<madsrdf:authoritativeLabel>United States. Office of the First Lady.</madsrdf:authoritativeLabel>
<madsrdf:isMemberOfMADSScheme rdf:resource="http://id.loc.gov/authorities/subjects" />
<rdfs:label>United States. Office of the First Lady.</rdfs:label>
<bflc:marcKey>61010$aUnited States.$bOffice of the First Lady.</bflc:marcKey>
<bf:source rdf:resource="http://id.loc.gov/authorities/subjects" />
Expand Down
91 changes: 83 additions & 8 deletions xsl/ConvSpec-1XX,7XX,8XX-names.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@
<rdf:type><xsl:attribute name="rdf:resource"><xsl:value-of select="$bflc"/>Uncontrolled</xsl:attribute></rdf:type>
</xsl:if>
<xsl:if test="substring($tag,1,1)='6'">
<!--
<xsl:if test="$pMADSClass != ''">
<rdf:type>
<xsl:attribute name="rdf:resource"><xsl:value-of select="concat($madsrdf,$pMADSClass)"/></xsl:attribute>
Expand All @@ -665,6 +666,7 @@
</madsrdf:isMemberOfMADSScheme>
</xsl:for-each>
</xsl:if>
-->
<xsl:if test="not(marc:subfield[@code='t'])">
<xsl:choose>
<xsl:when test="substring($tag,2,2)='11'">
Expand Down Expand Up @@ -766,18 +768,91 @@
contains(marc:subfield[@code='1'], 'id.loc.gov/rwo/') and
not(marc:subfield[@code='0' or @code='w'][starts-with(text(),'(uri)') or starts-with(text(),'http')])">
<madsrdf:isIdentifiedByAuthority>
<xsl:attribute name="rdf:resource">
<xsl:apply-templates mode="generateUriFrom0" select=".">
<xsl:with-param name="pEntity">bf:Agent</xsl:with-param>
</xsl:apply-templates>
</xsl:attribute>
<xsl:choose>
<xsl:when test="substring($tag,1,1)='6' and $pMADSClass != ''">
<xsl:element name="{concat('madsrdf:', $pMADSClass)}">
<xsl:attribute name="rdf:about">
<xsl:apply-templates mode="generateUriFrom0" select=".">
<xsl:with-param name="pEntity">bf:Agent</xsl:with-param>
</xsl:apply-templates>
</xsl:attribute>
<xsl:if test="$pMADSLabel != ''">
<madsrdf:authoritativeLabel>
<xsl:if test="$vXmlLang != ''">
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
</xsl:if>
<xsl:call-template name="tChopPunct">
<xsl:with-param name="pString" select="$pMADSLabel"/>
</xsl:call-template>
</madsrdf:authoritativeLabel>
</xsl:if>
<!--
<xsl:for-each select="$subjectThesaurus/subjectThesaurus/subject[@ind2=current()/@ind2]/madsscheme">
<madsrdf:isMemberOfMADSScheme>
<xsl:attribute name="rdf:resource"><xsl:value-of select="."/></xsl:attribute>
</madsrdf:isMemberOfMADSScheme>
</xsl:for-each>
-->
<madsrdf:isMemberOfMADSScheme rdf:resource="http://id.loc.gov/authorities/names" />
</xsl:element>
</xsl:when>
<xsl:otherwise>
<madsrdf:isIdentifiedByAuthority>
<xsl:attribute name="rdf:resource">
<xsl:apply-templates mode="generateUriFrom0" select=".">
<xsl:with-param name="pEntity">bf:Agent</xsl:with-param>
</xsl:apply-templates>
</xsl:attribute>
</madsrdf:isIdentifiedByAuthority>
</xsl:otherwise>
</xsl:choose>
</madsrdf:isIdentifiedByAuthority>
</xsl:if>
<xsl:for-each select="marc:subfield[@code='0' or @code='w'][starts-with(text(),'(uri)') or starts-with(text(),'http')]">
<xsl:if test="position() = 1">
<xsl:apply-templates mode="subfield0orw" select=".">
<xsl:with-param name="serialization" select="$serialization"/>
</xsl:apply-templates>
<xsl:choose>
<xsl:when test="substring($tag,1,1)='6' and $pMADSClass != ''">
<madsrdf:isIdentifiedByAuthority>
<xsl:element name="{concat('madsrdf:', $pMADSClass)}">
<xsl:choose>
<xsl:when test="starts-with(text(),'http')">
<xsl:attribute name="rdf:about">
<xsl:value-of select="text()" />
</xsl:attribute>
</xsl:when>
<xsl:when test="starts-with(text(),'(uri)')">
<xsl:attribute name="rdf:about">
<xsl:value-of select="substring-after(text(),'(uri)')" />
</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:if test="$pMADSLabel != ''">
<madsrdf:authoritativeLabel>
<xsl:if test="$vXmlLang != ''">
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
</xsl:if>
<xsl:call-template name="tChopPunct">
<xsl:with-param name="pString" select="$pMADSLabel"/>
</xsl:call-template>
</madsrdf:authoritativeLabel>
</xsl:if>
<!--
<xsl:for-each select="$subjectThesaurus/subjectThesaurus/subject[@ind2=current()/@ind2]/madsscheme">
<madsrdf:isMemberOfMADSScheme>
<xsl:attribute name="rdf:resource"><xsl:value-of select="."/></xsl:attribute>
</madsrdf:isMemberOfMADSScheme>
</xsl:for-each>
-->
<madsrdf:isMemberOfMADSScheme rdf:resource="http://id.loc.gov/authorities/names" />
</xsl:element>
</madsrdf:isIdentifiedByAuthority>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="subfield0orw" select=".">
<xsl:with-param name="serialization" select="$serialization"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="marc:subfield[@code='0' or @code='w']">
Expand Down

0 comments on commit 17bd816

Please sign in to comment.