[OPEN-ILS-DEV] Help with authority.merge_records

Whalen, Liam Liam.Whalen at NRCan-RNCan.gc.ca
Wed Sep 28 12:03:13 EDT 2011


Our Authority merging process is not working properly.  Here is my situation: I have two bib records linked to two separate authority records.  Lets say Bib1 is Linked to Auth1 and Bib2 is linked to Auth2.  If I merge Auth2 into Auth1, the new Auth1 record displays as having 2 records associated with it, so I assume the linking in authority.bib_linking is happening correctly.  However, when I examine the MARC in Bib2, the authority link is still listed as $a Auth2.  However, the $0 code is correctly updated.  So if Bib1 has a 650 with $a Auth1 $0 (NRCAN-RNCAN) 1, and Bib2 had a 650 with $a Auth2 $0 (NRCAN-RNCAN) 2, then after the update Bib1 would still be the same but Bib2 would have a 650 like so: $a Auth2 $0 (NRCAN-RNCAN) 1 (It should be $a Auth1 $0 (NRCAN-RNCAN) 1 after the update).

I have tracked the code that is changing the (NRCAN-RNCAN) 2 into (NRCAN-RNCAN) 1 to the authority.merge_records function.

Inside this function we see section 1, which is doing the update just mentioned.

  -- 1. Update all bib records with the ID from target_record in their $0
    FOR bib_rec IN SELECT bre.* FROM biblio.record_entry bre
      INNER JOIN authority.bib_linking abl ON abl.bib = bre.id
      WHERE abl.authority = source_record LOOP

        UPDATE biblio.record_entry
          SET marc = REGEXP_REPLACE(marc,
            E'(<subfield\\s+code="0"\\s*>[^<]*?\\))' || source_record || '<',
            E'\\1' || target_record || '<', 'g')
          WHERE id = bib_rec.id;

          moved_objects := moved_objects + 1;
    END LOOP;

Then in step 2 and 3 some flags are checked and set if necessary
....

Finally in step 4 there is this section

    -- 4. Make a harmless update to target_record to trigger auto-update
    --    in linked bibliographic records
    UPDATE authority.record_entry
      SET deleted = FALSE
      WHERE id = target_record;

I assume this update is supposed to trigger some function somewhere else that should change Bib2 from having a 650 with $a Auth2 $0 (NRCAN-RNCAN) 1 to having a 650 with $a Auth1 $0 (NRCAN-RNCAN) 1.
Is this what is supposed to happen with the auto-update in linked bibliographic records?  If it is, what function is responsible for changing the $a value of the 650 entry?  I cannot follow the code to where this update is supposed to occur.  I am assuming because the authority isn't updated in the MARC, that somewhere along the way our database isn't performing the proper update, and although our two bib records are now linked with the appropriate auth record in authority.bib_linking, the MARC still displays Bib2's old Auth2 record which is not desirable.

Any pointers would be greatly appreciated,

Liam

    -
Natural Resources Canada Library / Bibliothèque de Ressources naturelles Canada
615 rue Booth Street, 121, Ottawa, ON, Canada
K1A 0E9
Telephone / Téléphone : 613-995-4180
lwhalen at nrcan-rncan.gc.ca
Web: http://www.nrcan.gc.ca/library/ 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libmail.georgialibraries.org/pipermail/open-ils-dev/attachments/20110928/425b9f2c/attachment.htm>


More information about the Open-ils-dev mailing list