{ "translatorID": "14763d24-8ba0-45df-8f52-b8d1108e7ac9", "translatorType": 2, "label": "Zotero RDF", "creator": "Simon Kornblith", "target": "rdf", "minVersion": "1.0.0b4.r1", "maxVersion": "", "priority": 25, "configOptions": { "getCollections": "true", "dataMode": "rdf/xml" }, "displayOptions": { "exportNotes": true, "exportFileData": false }, "inRepository": true, "lastUpdated": "2021-01-25 06:49:57" } var addedCollections = new Set(); var item; var rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; var n = { bib:"http://purl.org/net/biblio#", dc:"http://purl.org/dc/elements/1.1/", dcterms:"http://purl.org/dc/terms/", prism:"http://prismstandard.org/namespaces/1.2/basic/", foaf:"http://xmlns.com/foaf/0.1/", vcard:"http://nwalsh.com/rdf/vCard#", vcard2:"http://www.w3.org/2006/vcard/ns#", // currently used only for NSF, but is probably // very similar to the nwalsh vcard ontology in a // different namespace link:"http://purl.org/rss/1.0/modules/link/", z:"http://www.zotero.org/namespaces/export#" }; function generateRelations(resource, relations) { for (let predicate in relations) { if (predicate == 'dc:relation') { for (let uri of relations[predicate]) { if (itemResources[uri]) { Zotero.RDF.addStatement(resource, n.dc + "relation", itemResources[uri], false); } } } } } function generateTags(resource, tags) { Zotero.debug("processing tags"); for (var i=0; i 3) { displayTitle += " et al."; } } return displayTitle+"]"; } if (item.itemType == "case" && item.title && item.reporter) { // 'case' itemTypeID return item.title+' (' + item.reporter + ')'; } return null; } function generateItem(item, zoteroType, resource) { var container = null; var containerElement = null; /** CORE FIELDS **/ // type var type = null; if (zoteroType == "book") { type = n.bib+"Book"; } else if (zoteroType == "bookSection") { type = n.bib+"BookSection"; container = n.bib+"Book"; } else if (zoteroType == "journalArticle") { type = n.bib+"Article"; container = n.bib+"Journal"; } else if (zoteroType == "magazineArticle") { type = n.bib+"Article"; container = n.bib+"Periodical"; } else if (zoteroType == "newspaperArticle") { type = n.bib+"Article"; container = n.bib+"Newspaper"; } else if (zoteroType == "thesis") { type = n.bib+"Thesis"; } else if (zoteroType == "letter") { type = n.bib+"Letter"; } else if (zoteroType == "manuscript") { type = n.bib+"Manuscript"; } else if (zoteroType == "interview") { type = n.bib+"Interview"; } else if (zoteroType == "film") { type = n.bib+"MotionPicture"; } else if (zoteroType == "artwork") { type = n.bib+"Illustration"; } else if (zoteroType == "webpage") { type = n.bib+"Document"; container = n.z+"Website"; } else if (zoteroType == "note") { type = n.bib+"Memo"; if (!Zotero.getOption("exportNotes")) { return; } } else if (zoteroType == "attachment") { type = n.z+"Attachment"; } else if (zoteroType == "report") { type = n.bib+"Report"; } else if (zoteroType == "bill") { type = n.bib+"Legislation"; } else if (zoteroType == "case") { type = n.bib+"Document"; // ?? container = n.bib+"CourtReporter"; } else if (zoteroType == "hearing") { type = n.bib+"Report"; } else if (zoteroType == "patent") { type = n.bib+"Patent"; } else if (zoteroType == "statute") { type = n.bib+"Legislation"; } else if (zoteroType == "email") { type = n.bib+"Letter"; } else if (zoteroType == "map") { type = n.bib+"Image"; } else if (zoteroType == "blogPost") { type = n.bib+"Document"; container = n.z+"Blog"; } else if (zoteroType == "instantMessage") { type = n.bib+"Letter"; } else if (zoteroType == "forumPost") { type = n.bib+"Document"; container = n.z+"Forum"; } else if (zoteroType == "audioRecording") { type = n.bib+"Recording"; } else if (zoteroType == "presentation") { type = n.bib+"ConferenceProceedings"; } else if (zoteroType == "videoRecording") { type = n.bib+"Recording"; } else if (zoteroType == "tvBroadcast") { type = n.bib+"Recording"; } else if (zoteroType == "radioBroadcast") { type = n.bib+"Recording"; } else if (zoteroType == "podcast") { type = n.bib+"Recording"; } else if (zoteroType == "computerProgram") { type = n.bib+"Data"; } else if (zoteroType == "encyclopediaArticle" || zoteroType == "dictionaryEntry") { container = n.bib+"Book"; } else if (zoteroType == "conferencePaper") { container = n.bib+"Journal"; } if (type) { Zotero.RDF.addStatement(resource, rdf+"type", type, false); } Zotero.RDF.addStatement(resource, n.z+"itemType", zoteroType, true); // generate section if (item.section) { var section = Zotero.RDF.newResource(); // set section type Zotero.RDF.addStatement(section, rdf+"type", n.bib+"Part", false); // set section title Zotero.RDF.addStatement(section, n.dc+"title", item.section, true); // add relationship to resource Zotero.RDF.addStatement(resource, n.dcterms+"isPartOf", section, false); } // generate container if (container) { var testISSN = "urn:issn:"+encodeURI(item.ISSN); if (item.ISSN && !Zotero.RDF.getArcsIn(testISSN)) { // use ISSN as container URI if no other item is containerElement = testISSN; } else { containerElement = Zotero.RDF.newResource(); } // attach container to section (if exists) or resource Zotero.RDF.addStatement((section ? section : resource), n.dcterms+"isPartOf", containerElement, false); // add container type Zotero.RDF.addStatement(containerElement, rdf+"type", container, false); } // generate series if (item.series || item.seriesTitle || item.seriesText || item.seriesNumber) { var series = Zotero.RDF.newResource(); // set series type Zotero.RDF.addStatement(series, rdf+"type", n.bib+"Series", false); // add relationship to resource Zotero.RDF.addStatement((containerElement ? containerElement : resource), n.dcterms+"isPartOf", series, false); } // generate publisher // BEGIN NSF if (zoteroType == "nsfReviewer") { var organization = Zotero.RDF.newResource(); Zotero.RDF.addStatement(organization, rdf+"type", n.vcard2+"Organization", false); Zotero.RDF.addStatement(resource, n.vcard2+"org", organization, false); } else { // END NSF if (item.publisher || item.distributor || item.label || item.company || item.institution || item.place) { var organization = Zotero.RDF.newResource(); // set organization type Zotero.RDF.addStatement(organization, rdf+"type", n.foaf+"Organization", false); // add relationship to resource Zotero.RDF.addStatement(resource, n.dc+"publisher", organization, false); } } var typeProperties = ["reportType", "videoRecordingType", "letterType", "manuscriptType", "mapType", "thesisType", "websiteType", "audioRecordingType", "presentationType", "postType", "audioFileType"]; var ignoreProperties = ["itemID", "itemType", "firstCreator", "dateAdded", "dateModified", "section", "sourceItemID"]; // creators if (item.creators) { // authors/editors/contributors var creatorContainers = new Object(); // not yet in biblio var biblioCreatorTypes = ["author", "editor", "contributor"]; for (var j in item.creators) { var creator = Zotero.RDF.newResource(); Zotero.RDF.addStatement(creator, rdf+"type", n.foaf+"Person", false); // gee. an entire vocabulary for describing people, and these aren't even // standardized in it. oh well. using them anyway. Zotero.RDF.addStatement(creator, n.foaf+"surname", item.creators[j].lastName, true); if (item.creators[j].firstName) { Zotero.RDF.addStatement(creator, n.foaf+"givenName", item.creators[j].firstName, true); } if (biblioCreatorTypes.indexOf(item.creators[j].creatorType) != -1) { var cTag = n.bib+item.creators[j].creatorType+"s"; } else { var cTag = n.z+item.creators[j].creatorType+"s"; } if (!creatorContainers[cTag]) { var creatorResource = Zotero.RDF.newResource(); // create new seq for author type creatorContainers[cTag] = Zotero.RDF.newContainer("seq", creatorResource); // attach container to resource Zotero.RDF.addStatement(resource, cTag, creatorResource, false); } Zotero.RDF.addContainerElement(creatorContainers[cTag], creator, false); } } // notes if (item.notes && Zotero.getOption("exportNotes")) { for (let note of item.notes) { let noteResource = itemResources[note.itemID]; // add note tag Zotero.RDF.addStatement(noteResource, rdf+"type", n.bib+"Memo", false); // add note item.notes Zotero.RDF.addStatement(noteResource, rdf + "value", note.note, true); // add relationship between resource and note Zotero.RDF.addStatement(resource, n.dcterms+"isReferencedBy", noteResource, false); // Add note relations to RDF if (note.relations) generateRelations(noteResource, note.relations); generateTags(noteResource, note.tags); } } // child attachments if (item.attachments) { for (var i=0; i