[librecat-dev] Camandu, data lookup

Patrick Hochstenbach Patrick.Hochstenbach at UGent.be
Tue Jan 7 16:32:47 CET 2020


First create a file lookup.csv:

name,value
foo,bar
bla,blo
test,rest

Now you can process your marc with this fix:

do marc_each()
  if marc_has(372a)
    marc_map(372a,tmp)
    lookup(tmp,”lookup.csv",delete:1)
    if exists(tmp)
        marc_set(3720,$.tmp)
    end
  end
end

The ‘do marc_each’ will make sure this fix is executed for each seperate field  in the marc (and supports repeated fields). This fix will not work when you want to set the value of another MARC fields at a different place in the MARC record.

Patrick

> On 7 Jan 2020, at 13:48, Uldis Bojars <captsolo at gmail.com> wrote:
> 
> Hi all,
> 
> How can I use Catmandu to look up values in a MARC subfield (e.g. 372 $a) in a database and add information found in the database to this MARC field (in subfield $0 in this case)?
> 
> The list of values to look up comes from the a MARC authority file: system numbers (fld. 001) and labels (fld. 150 $a) of MARC 150 records.
> 
> It makes sense to preprocess the MARC file and extract the fields to look up (system number, label) but what is the best practice for storing and looking up this information using Catmandu?
> 
> Best regards,
> Uldis
> 
> _______________________________________________
> librecat-dev mailing list
> - send list mails to librecat-dev at lists.uni-bielefeld.de
> - to unsubscribe or change options, visit https://lists.uni-bielefeld.de/mailman2/cgi/unibi/listinfo/librecat-dev
> - project website: http://librecat.org/




More information about the librecat-dev mailing list