Bug 14863 - Koha authorities update linking authorities in subfield '0'
Summary: Koha authorities update linking authorities in subfield '0'
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Galen Charlton
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-21 11:52 UTC by Eugene Espinoza
Modified: 2020-11-30 21:45 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Espinoza 2015-09-21 11:52:09 UTC
In current iteration of Koha ILS, given the following marc authorities in marcxml format: 

The first record: 
<record>
  <leader>01877nz  a2200433o  4500</leader>
  <controlfield tag="001">1</controlfield>
      .... 
  </datafield>
  <datafield tag="151" ind1=" " ind2=" ">
    <subfield code="a">Borneo</subfield>
  </datafield>
  <datafield tag="550" ind1=" " ind2=" ">
    <subfield code="w">g</subfield>
    <subfield code="a">South East Asia</subfield>
    <subfield code="c">c_7260</subfield>
  </datafield>
</record>

The second record: 
<record>
  <leader>02462nz  a2200553o  4500</leader>
  <controlfield tag="001">2</controlfield>
       ... 
  <datafield tag="151" ind1=" " ind2=" ">
    <subfield code="a">South East Asia</subfield>
  </datafield>
  <datafield tag="550" ind1=" " ind2=" ">
    <subfield code="w">h</subfield>
    <subfield code="a">Borneo</subfield>
    <subfield code="c">c_1017</subfield>
  </datafield>
  
</record>

There is no automatic way in linking Borneo with Southeast Asia and vice versa? Such that the control no. (subfield 9) is added in 550 tag like below: 

Authority Record no. 1: 
  <datafield tag="151" ind1=" " ind2=" ">
    <subfield code="a">Borneo</subfield>
  </datafield>
  <datafield tag="550" ind1=" " ind2=" ">
    <subfield code="w">g</subfield>
    <subfield code="a">South East Asia</subfield>
    <subfield code="c">c_7260</subfield>
    <subfield code="9">2</subfield>
  </datafield>

Authority Record no. 2: 
  <datafield tag="151" ind1=" " ind2=" ">
    <subfield code="a">South East Asia</subfield>
  </datafield>
  <datafield tag="550" ind1=" " ind2=" ">
    <subfield code="w">h</subfield>
    <subfield code="a">Borneo</subfield>
    <subfield code="c">c_1017</subfield>
    <subfield code="9">1</subfield>

Or if this was in MARC: 

=001  1 
=035  \\$ac_1017 
=151  \\$aBorneo 
=550  \\$wg$aSouth East Asia$cc_7260$92 

=LDR  02462nz  a2200553o  4500 
=001  2 
=035  \\$ac_7260 
=151  \\$aSouth East Asia 
=550  \\$wh$aBorneo$cc_1017$91 

Outside of Koha ILS, I was able to do transform the records using below XSLT, however it will be better if this can be done inside Koha or through a migration tool script, but will be better if done inside Koha:


<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"  xmlns:dc="http://purl.org/dc/elements/1.1/"   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="rdf dc marc">
 <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
 <xsl:key name="term" match="datafield[@tag='151']|datafield[@tag='150']" use="subfield[@code='a']" />

 <xsl:template match="datafield[@tag='550'][subfield[@code='a']]">
   <xsl:variable name="t550a" select="subfield[@code='a']" />
   <xsl:copy>
     <xsl:apply-templates select="@*|node()"/>
     <xsl:for-each select="key('term',$t550a)">
       <subfield code="9">
         <xsl:value-of select="../controlfield[@tag='001']" />
       </subfield>
      </xsl:for-each>
    </xsl:copy>
 </xsl:template>

 <xsl:template match="@*|node()">
  <xsl:copy>
   <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
 </xsl:template>    
</xsl:stylesheet>
Comment 1 Katrin Fischer 2019-11-24 21:36:50 UTC
Hi Eugene, I am not sure if I am understanding correctly, but there is the  link_bibs_to_authorities.pl for linking records with authorities in Koha. Marking RESOLVED, please reopen with more information on the problem if I am mistaken.