Print

Print


My guess is that you aren't going to find anything ready-made, but instead, will have to glue parts together to make what you want.  For example, this how MarcEdit would do this (though, to be fair, one of the parts of this isn't documented because it's more for my internal research usage).  In MarcEdit's case, you would stack parts together -- so that it looks something like this (using the command-line):

*********
>>%MARCEDIT_PATH%\cmarcedit.exe -s data.mrc -d data_mods.xml -xslt %MARCEDIT_XSLT_PATH%\MARC21slim2MODS3-6.xml" -marctoxml && %MARCEDIT_PATH%\cmarcedit.exe -s data_mods.xml -d data_mod.json -xml2json

Beginning Process...
35 records have been processed in 3.904557 seconds.

Beginning Process...
Records have been processed in 0.246327 seconds.
*********

Essentially, this glues the two functions together -- processing MARC 2 MODS utilizing the MODS 3.6 XSLT and then utilizing a json library to serial the mods to json -- producing a mods array that would look something like this:

  {
        "@version": "3.6",
        "titleInfo": [
          {
            "@altRepGroup": "02",
            "@script": "Latn",
            "title": "Aṣdāf taḥjibu al-ḥajar",
            "subTitle": "dīwān shiʻr"
          },
          {
            "@altRepGroup": "02",
            "@script": "Arab",
            "title": "اصداف تحجب الحجر",
            "subTitle": "ديوان شعر"
          }
        ],
        "name": [
          {
            "@type": "personal",
            "@usage": "primary",
            "@altRepGroup": "01",
            "@script": "Latn",
            "namePart": "ʻAmrāwī, ʻAbd al-Khāliq."
          },
          {
            "@type": "personal",
            "@usage": "primary",
            "@altRepGroup": "01",
            "@script": "Arab",
            "namePart": "عمراوي، عبد الخالق."
          }
        ],
        "typeOfResource": "text",
        "genre": {
          "@authority": "rdacontent",
          "#text": "text"
        },
        "originInfo": [
          {
            "@script": "Latn",
            "place": {
              "placeTerm": {
                "@type": "code",
                "@authority": "marccountry",
                "#text": "mr"
              }
            },
            "dateIssued": {
              "@encoding": "marc",
              "#text": "2016"
            },
            "issuance": "monographic"
          },
          {
            "@eventType": "publication",
            "@altRepGroup": "03",
            "@script": "Latn",
            "place": {
              "placeTerm": {
                "@type": "text",
                "#text": "al-Rabāṭ :"
              }
            },
            "publisher": "Maṭbaʻat al-Umnīyah,",
            "dateIssued": "2016."
          }
        ],
        "language": {
          "languageTerm": {
            "@authority": "iso639-2b",
            "@type": "code",
            "#text": "ara"
          }
        },
        "physicalDescription": {
          "form": [
            {
              "@authority": "marcform",
              "#text": "print"
            },
            {
              "@type": "media",
              "@authority": "rdamedia",
              "#text": "unmediated"
            },
            {
              "@type": "carrier",
              "@authority": "rdacarrier",
              "#text": "volume"
            }
          ],
          "extent": "72 pages ; 21 cm."
        },
        "note": [
          {
            "@type": "statement of responsibility",
            "@altRepGroup": "00",
            "@script": "Latn",
            "#text": "ʻAbd al-Khāliq ʻAmrāwī."
          },
          "Poems.",
          {
            "@type": "statement of responsibility",
            "@altRepGroup": "00",
            "@script": "Arab",
            "#text": "عبد الخالق عمراوي."
          }
        ],
        "identifier": {
          "@type": "isbn",
          "#text": "9789954370933"
        },
        "recordInfo": {
          "descriptionStandard": "aacr",
          "recordContentSource": {
            "@authority": "marcorg",
            "#text": "HLS"
          },
          "recordCreationDate": {
            "@encoding": "marc",
            "#text": "190302"
          },
          "recordChangeDate": {
            "@encoding": "iso8601",
            "#text": "20160601161743.0"
          },
          "recordIdentifier": "990147033240203941",
          "recordOrigin": "Converted from MARCXML to MODS version 3.6 using MARC21slim2MODS3-6.xsl\r\n\t\t\t\t(Revision 1.117 2017/02/14)",
          "languageOfCataloging": {
            "languageTerm": {
              "@authority": "iso639-2b",
              "@type": "code",
              "#text": "eng"
            }
          }
        }
      }

Of course, this may or may not be what you are looking for - and in this case, since it's utilizing things like XSLT for xml document serialization, you'd need to track file sizes (I would guess this would work well on files up to ~150 mb).  If this is close to what you need it would likely be relatively trivial to code up if you are familiar with python, utilizing tools like PyMARC, an XSLT processor like saxon, and then either the built-in python json parsing library.

--tr

-----Original Message-----
From: Code for Libraries <[log in to unmask]> On Behalf Of Goodwin, Shawn
Sent: Monday, March 4, 2019 5:12 PM
To: [log in to unmask]
Subject: Re: [CODE4LIB] MARC21 to MODS

It look like MarcEdit or XLST are not good solutions for this. My goal is to create an small relational database project from some Marc records, and I am looking to have human readable names for the columns and tables. 

I was hoping there was a downloadable datastructure for Marc to Mods, either as a JSON file or a python library. 


-- 
Shawn Goodwin 
Metadata Control Analyst | ATLA
300 South Wacker Drive, Suite 2100 
Chicago, IL 60606 
 

On 3/4/19, 3:49 PM, "Code for Libraries on behalf of Tod Olson" <[log in to unmask] on behalf of [log in to unmask]> wrote:

    You can also do a pipeline of MARC to MARCXML with yaz-marcdump or marc4j, then transform MARCXML to MODS via the XSLT at http://www.loc.gov/standards/marcxml/
    
    -Tod
    
    On Mar 4, 2019, at 2:50 PM, McDonald, Stephen <[log in to unmask]<mailto:[log in to unmask]>> wrote:
    
    I don't know about a Python library or json converter.  But MarcEdit can do it.
    
    Steve McDonald
    [log in to unmask]<mailto:[log in to unmask]>
    
    
    -----Original Message-----
    From: Code for Libraries <[log in to unmask]> On Behalf Of Goodwin, Shawn
    Sent: Monday, March 4, 2019 3:03 PM
    To: [log in to unmask]
    Subject: [CODE4LIB] MARC21 to MODS
    
    Hi All,
    
    I was looking at this website: https://www.loc.gov/standards/mods/mods-mapping.html#mapping
    
    Is there a python library (or even just a JSON file) that transforms MARC to MODS?
    
    --
    Shawn Goodwin
    Metadata Control Analyst | ATLA<http://www.atla.com/>
    300 South Wacker Drive, Suite 2100
    Chicago, IL 60606