Page tree
Skip to end of metadata
Go to start of metadata

This document describes how to create a generic template example for OpenRefine data to a modsCollection XML file and is based on the UTK data dictionary.

This is just an example. You will need to write your own template based on the data inside your OpenRefine project. For more practical examples, see recent digital project repositories in the UTKcataloging github organization (/cleaned_data/remediation_files/open_refine_template.md).

For other examples, check out OpenRefine recipes.

 

modsCollection Export

You will need to 1. remove 'null' elements created by the OpenRefine templating to XML process (using replace of regex in whatever method/tool/script you prefer) and 2. break the modsCollection single file to multiple mods files if desired. Note, the resultant document (stored automatically by OpenRefine as .txt - just change file extension to .xml).

Regex for empty elements: <([^</>"=]+?)>(\s*?)</(.+?)>

Regex for null elements: <([^</>"=]+?)>(null?)</(.+?)>

Prefix:

<?xml version="1.0" encoding="UTF-8"?>
<modsCollection xmlns="http://www.loc.gov/mods/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instancexmlns:xlink="http://www.w3.org/1999/xlinkxsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-5.xsd">

Row Template Example:

Row Template
<mods xmlns="http://www.loc.gov/mods/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-5.xsd">
  <abstract>{{cells["abstract"].value}}</abstract>
  <abstract>{{cells["abstract 1"].value}}</abstract>
  <abstract>{{cells["abstract 2"].value}}</abstract>
  <relatedItem displayLabel="Collection" type="host">
    <titleInfo>
      <title>{{cells["collection"].value}}</title>
    </titleInfo>
    <identifier>{{cells["collection_identifier"].value}}</identifier>
  </relatedItem>
  <relatedItem displayLabel="Project" type="host">
    <titleInfo>
      <title>{{cells["project_title"].value}}</title>
    </titleInfo>
  </relatedItem>
  <genre>{{cells["genre"].value}}</genre>
  <genre>{{cells["genre 1"].value}}</genre>
  <genre>{{cells["genre 2"].value}}</genre>
  <relatedItem type="host">
    <titleInfo>
      <title>{{cells["host_title"].value}}</title>
    </titleInfo>
  </relatedItem>
  <identifier>{{cells["identifier"].value}}</identifier>
  <identifier>{{cells["identifier 2"].value}}</identifier>
  <identifier type="filename">{{cells["identifier_file"].value}}</identifier>
  <identifier type="filename">{{cells["identifier_file 2"].value}}</identifier>
  <identifier type="opac">{{cells["identifier_opac"].value}}</identifier>
  <typeOfResource>{{cells["item_type"].value.toLowercase()}}</typeOfResource>
  <language>
    <languageTerm type="code" authority="iso639-2b">{{cells["language"].value}}</languageTerm>
  </language>
  <language>
    <languageTerm type="code" authority="iso639-2b">{{cells["language 1"].value}}</languageTerm>
  </language>
  <language>
    <languageTerm type="code" authority="iso639-2b">{{cells["language 2"].value}}</languageTerm>
  </language>
  <recordInfo>
    <recordIdentifier>{{'record_'+cells["identifier_file"].value}}</recordIdentifier>
    <recordContentSource>University of Tennessee, Knoxville. Libraries</recordContentSource>
    <languageOfCataloging>
      <languageTerm type="code" authority="iso639-2b">eng</languageTerm>
    </languageOfCataloging>
    <recordOrigin>Created and edited in general conformance to MODS Guidelines (Version 3.5).</recordOrigin>
   </recordInfo>
  <location>
    <physicalLocation>{{cells["repository"].value}}</physicalLocation>
    <holdingSimple>
      <copyInformation>
        <shelfLocator>{{cells["shelf_locator"].value}}</shelfLocator>
      </copyInformation>
    </holdingSimple>
  </location>
  <titleInfo>
    <title>{{cells["title"].value}}</title>
  </titleInfo>
  <titleInfo type="alternative">
    <title>{{cells["title 2"].value}}</title>
  </titleInfo>
  <name>
    <namePart>{{cells["name"].value}}</namePart>
    <role>
      <roleTerm>{{cells["name_role"].value}}</roleTerm>
    </role>
  </name>
  <name>
    <namePart>{{cells["name 1"].value}}</namePart>
    <role>
      <roleTerm>{{cells["name_role 1"].value}}</roleTerm>
    </role>
  </name>
  <name>
    <namePart>{{cells["name 2"].value}}</namePart>
    <role>
      <roleTerm>{{cells["name_role 2"].value}}</roleTerm>
    </role>
  </name>
  <name>
    <namePart>{{cells["name 3"].value}}</namePart>
    <role>
      <roleTerm>{{cells["name_role 3"].value}}</roleTerm>
    </role>
  </name>
  <name>
    <namePart>{{cells["name 4"].value}}</namePart>
    <role>
      <roleTerm>{{cells["name_role 4"].value}}</roleTerm>
    </role>
  </name>
  <subject>
    <topic>{{cells["subject_topical"].value}}</topic>
  </subject>
  <subject>
    <topic>{{cells["subject_topical 1"].value}}</topic>
  </subject>
  <subject>
    <topic>{{cells["subject_topical 2"].value}}</topic>
  </subject>
  <subject>
    <topic>{{cells["subject_topical 3"].value}}</topic>
  </subject>
  <subject>
    <topic>{{cells["subject_topical 4"].value}}</topic>
  </subject>
  <subject>
    <topic>{{cells["subject_topical 5"].value}}</topic>
  </subject>
  <subject>
    <geographic>{{cells["subject_geographic"].value}}</geographic>
  </subject>
  <subject>
    <geographic>{{cells["subject_geographic 1"].value}}</geographic>
  </subject>
  <subject>
    <geographic>{{cells["subject_geographic 2"].value}}</geographic>
  </subject>
  <subject>
    <geographic>{{cells["subject_geographic 3"].value}}</geographic>
  </subject>
  <subject>
    <geographic>{{cells["subject_geographic 4"].value}}</geographic>
  </subject>
  <subject>
    <geographic>{{cells["subject_geographic 5"].value}}</geographic>
  </subject>
  <subject>
    <name>
      <namePart>{{cells["subject_name"].value}}</namePart>
    </name>
  </subject>
  <subject>
    <name>
      <namePart>{{cells["subject_name 1"].value}}</namePart>
    </name>
  </subject>
  <subject>
    <name>
      <namePart>{{cells["subject_name 2"].value}}</namePart>
    </name>
  </subject>
  <subject>
    <name>
      <namePart>{{cells["subject_name 3"].value}}</namePart>
    </name>
  </subject>
  <subject>
    <name>
      <namePart>{{cells["subject_name 4"].value}}</namePart>
    </name>
  </subject>
  <subject>
    <name>
      <namePart>{{cells["subject_name 5"].value}}</namePart>
    </name>
  </subject>
  <note>{{cells["public_note"].value}}</note>
  <note>{{cells["public_note 1"].value}}</note>
  <note>{{cells["public_note 2"].value}}</note>
  <note type="ownership">{{cells["note_provenance"].value}}</note>
  <originInfo>
    <publisher>{{cells["publisher"].value}}</publisher>
    <dateCreated>{{cells["date_text"].value}}</dateCreated>
    <dateCreated keyDate="yes" encoding="edtf">{{cells["date_key"].value}}</dateCreated>
    <place>
      <placeTerm type="text">{{cells["place_of_origin"].value}}</placeTerm>
    </place>
    <place>
      <placeTerm type="text">{{cells["place_of_origin 1"].value}}</placeTerm>
    </place>
    <place>
      <placeTerm type="text">{{cells["place_of_origin 2"].value}}</placeTerm>
    </place>
  </originInfo>
  <physicalDescription>
    <extent>{{cells["extent"].value}}</extent>
    <digitalOrigin>reformatted digital</digitalOrigin>
    <form>{{cells["form"].value}}</form>
    <form>{{cells["form 1"].value}}</form>
    <form>{{cells["form 2"].value}}</form>
  </physicalDescription>
  <accessCondition>{{cells["rights"].value}}</accessCondition>
</mods>

Row Separator:

(leave blank)

Suffix:

</modsCollection>

Simple XML Export (for MODS XSLT application):

You will need to 1. remove 'null' elements created by the OpenRefine templating to XML process (using replace of regex in whatever method/tool/script you prefer) and 2. run this XSLT against the resultant document (stored automatically by OpenRefine as .txt - just change file extension to .xml). (Previously used, full XSLT stored for documentation purposes).

Regex for empty elements: <([^</>"=]+?)>(\s*?)</(.+?)>

Regex for null elements: <([^</>"=]+?)>(null?)</(.+?)>


Prefix:

<root>
  <row>

Row Template:

Row Template
 <abstract>{{cells["abstract"].value}}</abstract>
 <abstract>{{cells["abstract 1"].value}}</abstract>
 <abstract>{{cells["abstract 2"].value}}</abstract>
 <collection>{{cells["collection"].value}}</collection>
 <collection_identifier>{{cells["collection_identifier"].value}}</collection_identifier>
 <date_text>{{cells["date_text"].value}}</date_text>
 <date_key>{{cells["date_key"].value}}</date_key>
 <date_qualifier>{{cells["date_qualifier"].value}}</date_qualifier>
 <digital_origin>{{cells["digital_origin"].value}}</digital_origin>
 <extent>{{cells["extent"].value}}</extent>
 <identifier_file>{{cells["identifier_file"].value}}</identifier_file>
 <identifier_file>{{cells["identifier_file 1"].value}}</identifier_file>
 <identifier_file>{{cells["identifier_file 2"].value}}</identifier_file>
 <form>{{cells["form"].value}}</form>
 <form>{{cells["form 1"].value}}</form>
 <form>{{cells["form 2"].value}}</form>
 <genre>{{cells["genre"].value}}</genre>
 <genre>{{cells["genre 1"].value}}</genre>
 <genre>{{cells["genre 2"].value}}</genre>
 <host_title>{{cells["host_title"].value}}</host_title>
 <identifier>{{cells["identifier"].value}}</identifier>
 <identifier_opac>{{cells["identifier_opac"].value}}</identifier_opac>
 <item_type>{{cells["item_type"].value}}</item_type>
 <language>{{cells["language"].value}}</language>
 <language>{{cells["language 1"].value}}</language>
 <language>{{cells["language 2"].value}}</language>
 <name>{{cells["name"].value}}</name>
 <name_1>{{cells["name 1"].value}}</name_1>
 <name_2>{{cells["name 2"].value}}</name_2>
 <name_3>{{cells["name 3"].value}}</name_3>
 <name_4>{{cells["name 4"].value}}</name_4>
 <name_5>{{cells["name 5"].value}}</name_5>
 <name_role>{{cells["name_role"].value}}</name_role>
 <name_role_1>{{cells["name_role 1"].value}}</name_role_1>
 <name_role_2>{{cells["name_role 2"].value}}</name_role_2>
 <name_role_3>{{cells["name_role 3"].value}}</name_role_3>
 <name_role_4>{{cells["name_role 4"].value}}</name_role_4>
 <name_role_5>{{cells["name_role 5"].value}}</name_role_5>
 <note_provenance>{{cells["note_provenance"].value}}</note_provenance>
 <place_of_origin>{{cells["place_of_origin"].value}}</place_of_origin>
 <project_title>{{cells["project_title"].value}}</project_title>
 <public_note>{{cells["public_note"].value}}</public_note>
 <public_note>{{cells["public_note 1"].value}}</public_note>
 <public_note>{{cells["public_note 2"].value}}</public_note>
 <publisher>{{cells["publisher"].value}}</publisher>
 <repository>{{cells["repository"].value}}</repository>
 <rights>{{cells["rights"].value}}</rights>
 <shelf_locator>{{cells["shelf_locator"].value}}</shelf_locator>
 <subject_geographic>{{cells["subject_geographic"].value}}</subject_geographic>
 <subject_geographic>{{cells["subject_geographic 1"].value}}</subject_geographic>
 <subject_geographic>{{cells["subject_geographic 2"].value}}</subject_geographic>
 <subject_geographic>{{cells["subject_geographic 3"].value}}</subject_geographic>
 <subject_geographic>{{cells["subject_geographic 4"].value}}</subject_geographic>
 <subject_geographic>{{cells["subject_geographic 5"].value}}</subject_geographic>
 <subject_name>{{cells["subject_name"].value}}</subject_name>
 <subject_name>{{cells["subject_name 1"].value}}</subject_name>
 <subject_name>{{cells["subject_name 2"].value}}</subject_name>
 <subject_name>{{cells["subject_name 3"].value}}</subject_name>
 <subject_name>{{cells["subject_name 4"].value}}</subject_name>
 <subject_name>{{cells["subject_name 5"].value}}</subject_name>
 <subject_topical>{{cells["subject_topical"].value}}</subject_topical>
 <subject_topical>{{cells["subject_topical 1"].value}}</subject_topical>
 <subject_topical>{{cells["subject_topical 2"].value}}</subject_topical>
 <subject_topical>{{cells["subject_topical 3"].value}}</subject_topical>
 <subject_topical>{{cells["subject_topical 4"].value}}</subject_topical>
 <subject_topical>{{cells["subject_topical 5"].value}}</subject_topical>
 <title>{{cells["title"].value}}</title>
 <title 2>{{cells["title 2"].value}}</title 2>

Row Separator:


</row>
<row>

 

Suffix:


</row>
</root>

  • No labels