{
"translatorID": "2c05e2d1-a533-448f-aa20-e919584864cb",
"label": "DSpace Intermediate Metadata",
"creator": "Sebastian Karcher",
"target": "xml",
"minVersion": "5.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 1,
"lastUpdated": "2022-12-24 19:29:02"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2022 Sebastian Karcher
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see .
***** END LICENSE BLOCK *****
*/
function detectImport() {
var text = Zotero.read(1000);
return text.includes("http://www.dspace.org/xmlns/dspace/dim");
}
function getType(string) {
string = string.toLowerCase();
if (string.includes("book_section") || string.includes("chapter")) {
return "bookSection";
}
else if (string.includes("book") || string.includes("monograph")) {
return "book";
}
else if (string.includes("report")) {
return "report";
}
else if (string.includes("proceedings") || string.includes("conference")) {
return "conferencePaper";
}
else {
return "journalArticle"; // default -- most of the catalog
}
}
function doImport() {
var xml = Zotero.getXML();
var ns = {
dim: 'http://www.dspace.org/xmlns/dspace/dim',
mets: 'http://www.loc.gov/METS/',
xlink: 'http://www.w3.org/TR/xlink/'
};
let type = ZU.xpathText(xml, '//dim:field[@element="type"]', ns);
var item = new Zotero.Item("journalArticle");
if (type) {
item.itemType = getType(type);
}
item.title = ZU.trimInternal(ZU.xpathText(xml, '//dim:field[@element="title"]', ns));
let abstract = ZU.xpath(xml, '//dim:field[@qualifier="abstract"]', ns);
if (abstract.length) {
item.abstractNote = abstract[0].textContent;
}
item.date = ZU.xpathText(xml, '//dim:field[@element="date" and @qualifier="issued"]', ns);
item.language = ZU.xpathText(xml, '//dim:field[@element="language"]', ns);
item.issue = ZU.xpathText(xml, '//dim:field[@element="bibliographicCitation" and @qualifier="issue"]', ns);
item.volume = ZU.xpathText(xml, '//dim:field[@element="bibliographicCitation" and @qualifier="volume"]', ns);
item.publicationTitle = ZU.xpathText(xml, '//dim:field[@element="title" and @qualifier="parent"]', ns);
if (!item.publicationTitle) {
item.publicationTitle = ZU.xpathText(xml, '//dim:field[@element="bibliographicCitation" and @qualifier="title"]', ns);
}
item.conferenceName = ZU.xpathText(xml, '//dim:field[@element="bibliographicCitation" and @qualifier="conferencename"]', ns);
item.publisher = ZU.xpathText(xml, '//dim:field[@element="publisher" and not(@qualifier="place")]', ns);
item.place = ZU.xpathText(xml, '//dim:field[@element="publisher" and @qualifier="place"]', ns);
item.series = ZU.xpathText(xml, '//dim:field[@element="relation" and @qualifier="ispartofseries"]', ns);
item.ISSN = ZU.xpathText(xml, '//dim:field[@element="identifier" and @qualifier="issn"]', ns);
let pages = ZU.xpathText(xml, '//dim:field[@element="format" and @qualifier="pagerange"]', ns);
if (pages) {
item.pages = pages.replace(/pp?\./i, "");
}
else if (ZU.xpathText(xml, '//dim:field[@element="bibliographicCitation" and @qualifier="stpage"]', ns)) {
item.pages = ZU.xpathText(xml, '//dim:field[@element="bibliographicCitation" and @qualifier="stpage"]', ns)
+ "-" + ZU.xpathText(xml, '//dim:field[@element="bibliographicCitation" and @qualifier="endpage"]', ns);
}
let numPages = ZU.xpathText(xml, '//dim:field[@element="format" and @qualifier="pages"]', ns);
if (numPages) {
item.numPages = numPages.replace(/pp?\.?/i, "");
}
item.url = ZU.xpathText(xml, '//dim:field[@element="identifier" and @qualifier="uri"]', ns); // using the handle
let authors = ZU.xpath(xml, '//dim:field[@element="contributor" and @qualifier="author"]', ns);
for (let author of authors) {
item.creators.push(ZU.cleanAuthor(author.textContent, "author", true));
}
let tags = ZU.xpath(xml, '//dim:field[@element="subject"]', ns);
for (let tag of tags) {
item.tags.push(tag.textContent);
}
// getting only the first PDF
let pdfURL = ZU.xpathText(xml, '//mets:file[@MIMETYPE="application/pdf"][1]/mets:FLocat/@xlink:href', ns);
if (pdfURL) {
item.attachments.push({ url: pdfURL, title: "Full Text PDF", mimeType: "application/pdf" });
}
item.complete();
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "import",
"input": "\r\n \r\n \r\n \r\n \r\n \r\n Schittone, Joe\r\n Franklin, Erik C.\r\n Hudson, J. Harold\r\n Anderson, Jeff\r\n 2021-06-24T15:18:40Z\r\n 2021-06-24T15:18:40Z\r\n 2006\r\n http://hdl.handle.net/1834/20117\r\n This document presents the results of the monitoring of a repaired coral reef injured by the M/V Connected vessel grounding incident of March 27, 2001. This groundingoccurred in Florida state waters within the boundaries of the Florida Keys National Marine Sanctuary (FKNMS). The National Oceanic and Atmospheric Administration (NOAA) and the Board of Trustees of the Internal Improvement Trust Fund of the State of Florida, (“State of Florida” or “state”) are the co-trustees for the natural resourceswithin the FKNMS and, thus, are responsible for mediating the restoration of the damaged marine resources and monitoring the outcome of the restoration actions. Therestoration monitoring program tracks patterns of biological recovery, determines the success of restoration measures, and assesses the resiliency to environmental andanthropogenic disturbances of the site over time.The monitoring program at the Connected site was to have included an assessment of the structural stability of installed restoration modules and biological condition of reattached corals performed on the following schedule: immediately (i.e., baseline), 1, 3, and 6 years after restoration and following a catastrophic event. Restoration of this site was completed on July 20, 2001. Due to unavoidable delays in the settlement of the case, the“baseline” monitoring event for this site occurred in July 2004. The catastrophic monitoring event occurred on August 31, 2004, some 2 ½ weeks after the passage of Hurricane Charley which passed nearby, almost directly over the Dry Tortugas. In September 2005, the year one monitoring event occurred shortly after the passage of Hurricane Katrina, some 70 km to the NW. This report presents the results of all three monitoring events. (PDF contains 37 pages.)\r\n application/pdf\r\n application/pdf\r\n en\r\n NOAA/National Ocean Service/National Marine Sanctuary Program\r\n Marine Sanctuaries Conservation Series\r\n http://sanctuaries.noaa.gov/science/conservation/pdfs/connected.pdf\r\n Ecology\r\n Management\r\n Environment\r\n Florida Keys National Marine Sanctuary\r\n Coral\r\n Grounding\r\n Restoration\r\n Monitoring\r\n Hurricane Charley\r\n Hurricane Katrina\r\n Acropora palmata\r\n M/V CONNECTED Coral Reef Restoration Monitoring Report,\r\n Monitoring Events 2004-2005. Florida Keys National Marine Sanctuary Monroe County, Florida\r\n monograph\r\n NMSP-0\r\n Silver Spring, MD\r\n 2021-06-24T15:18:40Z\r\n http://aquaticcommons.org/id/eprint/2312\r\n 403\r\n 2011-09-29 19:16:51\r\n 2312\r\n United States National Ocean Service\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n ",
"items": [
{
"itemType": "book",
"title": "M/V CONNECTED Coral Reef Restoration Monitoring Report, Monitoring Events 2004-2005. Florida Keys National Marine Sanctuary Monroe County, Florida",
"creators": [
{
"firstName": "Joe",
"lastName": "Schittone",
"creatorType": "author"
},
{
"firstName": "Erik C.",
"lastName": "Franklin",
"creatorType": "author"
},
{
"firstName": "J. Harold",
"lastName": "Hudson",
"creatorType": "author"
},
{
"firstName": "Jeff",
"lastName": "Anderson",
"creatorType": "author"
}
],
"date": "2006",
"abstractNote": "This document presents the results of the monitoring of a repaired coral reef injured by the M/V Connected vessel grounding incident of March 27, 2001. This groundingoccurred in Florida state waters within the boundaries of the Florida Keys National Marine Sanctuary (FKNMS). The National Oceanic and Atmospheric Administration (NOAA) and the Board of Trustees of the Internal Improvement Trust Fund of the State of Florida, (“State of Florida” or “state”) are the co-trustees for the natural resourceswithin the FKNMS and, thus, are responsible for mediating the restoration of the damaged marine resources and monitoring the outcome of the restoration actions. Therestoration monitoring program tracks patterns of biological recovery, determines the success of restoration measures, and assesses the resiliency to environmental andanthropogenic disturbances of the site over time.The monitoring program at the Connected site was to have included an assessment of the structural stability of installed restoration modules and biological condition of reattached corals performed on the following schedule: immediately (i.e., baseline), 1, 3, and 6 years after restoration and following a catastrophic event. Restoration of this site was completed on July 20, 2001. Due to unavoidable delays in the settlement of the case, the“baseline” monitoring event for this site occurred in July 2004. The catastrophic monitoring event occurred on August 31, 2004, some 2 ½ weeks after the passage of Hurricane Charley which passed nearby, almost directly over the Dry Tortugas. In September 2005, the year one monitoring event occurred shortly after the passage of Hurricane Katrina, some 70 km to the NW. This report presents the results of all three monitoring events. (PDF contains 37 pages.)",
"language": "en",
"place": "Silver Spring, MD",
"publisher": "NOAA/National Ocean Service/National Marine Sanctuary Program",
"series": "Marine Sanctuaries Conservation Series",
"url": "http://hdl.handle.net/1834/20117",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [
{
"tag": "Acropora palmata"
},
{
"tag": "Coral"
},
{
"tag": "Ecology"
},
{
"tag": "Environment"
},
{
"tag": "Florida Keys National Marine Sanctuary"
},
{
"tag": "Grounding"
},
{
"tag": "Hurricane Charley"
},
{
"tag": "Hurricane Katrina"
},
{
"tag": "Management"
},
{
"tag": "Monitoring"
},
{
"tag": "Restoration"
}
],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/