Importing MARCXML from WorldCat API

109 views
Skip to first unread message

William Potter

unread,
Feb 7, 2020, 3:54:47 PM2/7/20
to zotero-dev
Hello all,

I have a set of records in MARCXML that were returned from the Worldcat Search API. (https://www.oclc.org/developer/develop/web-services/worldcat-search-api/bibliographic-resource.en.html). Here is an (abbreviated) example record:

<collection xmlns="http://www.loc.gov/MARC21/slim">
  <record>
    <leader>00000cam a2200000 a 4500</leader>
    <controlfield tag="001">50148048</controlfield>
    <controlfield tag="008">020710s2002    riuab    b    000 0 eng c</controlfield>
    <datafield ind1=" " ind2=" " tag="010">
      <subfield code="a">  2007555698</subfield>
    </datafield>
    <datafield ind1=" " ind2=" " tag="020">
      <subfield code="a">1887829466</subfield>
    </datafield>
    <datafield ind1=" " ind2=" " tag="020">
      <subfield code="a">9781887829465</subfield>
    </datafield>
    <datafield ind1="0" ind2="4" tag="245">
      <subfield code="a">The aqueducts of Israel /</subfield>
      <subfield code="c">edited by David Amit, Joseph Patrich, and Yizhar Hirschfeld.</subfield>
    </datafield>
    <datafield ind1=" " ind2=" " tag="260">
      <subfield code="a">Portsmouth, R.I. :</subfield>
      <subfield code="b">Journal of Roman Archaeology,</subfield>
      <subfield code="c">2002.</subfield>
    </datafield>
    <datafield ind1=" " ind2=" " tag="300">
      <subfield code="a">459 pages :</subfield>
      <subfield code="b">illustrations, maps (1 color) ;</subfield>
      <subfield code="c">29 cm.</subfield>
    </datafield>
    <datafield ind1="1" ind2=" " tag="490">
      <subfield code="a">Journal of Roman archaeology. Supplementary series,</subfield>
      <subfield code="x">1063-4304 ;</subfield>
      <subfield code="v">no. 46</subfield>
    </datafield>
    <datafield ind1=" " ind2=" " tag="500">
      <subfield code="a">Folded, colored map in pocket.</subfield>
    </datafield>
<!--etc....-->
  </record>
</collection>

Using the Zotero importer works fine, save for one issue. I would like to retain the OCLC number, preferably as a key-value pair in the "Extra" field (e.g., "OCLC: 50148048"). The trouble is, the WorldCat API return stores this OCLC number in marc:record/marc:controlfield[@tag="001"], which the Zotero importer doesn't seem to recognize. (I'm assuming it only looks at the marc:datafield elements?).

My questions are thus as follows:

1. Is there a way to tell the Zotero importer how to handle the controlfield containing the OCLC number? Alternatively, is there a marc:datafield/@tag attribute value that Zotero already associates with the "Extra" field (in which case I could just have my API query script move the OCLC number into that field before saving the MARCXML record for import)?
2. Is there perhaps a better way to handle batch import of MARCXML records into Zotero than using the importer?

Thanks in advance for your help and insight!

William Potter

unread,
Feb 19, 2020, 11:20:06 AM2/19/20
to zotero-dev
FYI for anyone who might use the Worldcat API in the future, we got this working by adapting the MARCXML.js translator. You can see our version here: https://github.com/wsalesky/translators/blob/master/Srophe%20MARCXML.js#L100-L102

This saves the OCLC number as a child note of the Zotero record. If you want it to appear in the "extra" field, simply change the line

newItem.notes.push({note:oclc});

to

newItem.extra = oclc;

As far as batch import, make sure to nest your returns as a sequence of marc:record elements inside a marc:collection, stored as a single file. (Zotero desktop cannot import more than one file at a time, but it can create multiple Zotero records from a single marc:collection file).
Reply all
Reply to author
Forward
0 new messages