Embedded RDF improvements

- Don't skip save if title and type not set via META tags (just use doc title)
- Include access date
- Save abstract from DC.Description.Abstract
- Save date from DC.Date.Issued
- Save dcterms.issued to date field in all item types (and not just in patents)
This commit is contained in:
Dan Stillman 2009-05-27 05:01:24 +00:00
parent 53d798c345
commit 3fa10bc0fc
2 changed files with 16 additions and 8 deletions

View file

@ -31,13 +31,10 @@ function doWeb(doc, url) {
var translator = Zotero.loadTranslator("import");
translator.setTranslator("5e3ad958-ac79-463d-812b-a86a9235c28f");
translator.setHandler("itemDone", function(obj, newItem) {
// use document title if none given in dublin core
if(!newItem.title) {
newItem.title = doc.title;
}
// add attachment
newItem.attachments.push({document:doc});
// add url
// add access date and url
newItem.accessDate = 'CURRENT_TIMESTAMP';
newItem.url = doc.location.href;
newItem.repository = false;
newItem.complete();
@ -61,6 +58,9 @@ function doWeb(doc, url) {
}
}
if (!foundTitle) {
rdf.Zotero.RDF.addStatement(url, dc + "title", doc.title, true);
}
rdf.defaultUnknownType = "webpage";
rdf.doImport();
}

View file

@ -274,7 +274,7 @@ function importItem(newItem, node, type) {
// check to see if we recognize the type in the fs or dc namespaces
var zoteroType = getFirstResults(node, [n.z+"itemType", n.z+"type", n.dc+"type"], true);
if(Zotero.Utilities.itemTypeExists(zoteroType)) {
if(zoteroType && Zotero.Utilities.itemTypeExists(zoteroType)) {
newItem.itemType = zoteroType;
}
@ -383,13 +383,18 @@ function importItem(newItem, node, type) {
// date
newItem.date = getFirstResults(node, [n.dc+"date"], true);
if (!newItem.date) {
newItem.date = getFirstResults(node, [n.dc+"date.issued"], true);
if (!newItem.date) {
newItem.date = getFirstResults(node, [n.dcterms+"issued"], true);
}
}
// accessDate
newItem.accessDate = getFirstResults(node, [n.dcterms+"dateSubmitted"], true);
// issueDate
newItem.issueDate = getFirstResults(node, [n.dcterms+"issued"], true);
// lastModified
newItem.lastModified = getFirstResults(node, [n.dcterms+"modified"], true);
// identifier
var identifiers = getFirstResults(node, [n.dc+"identifier"]);
if(container) {
@ -434,6 +439,9 @@ function importItem(newItem, node, type) {
// abstract
newItem.abstractNote = getFirstResults(node, [n.dcterms+"abstract"], true);
if (!newItem.abstractNote) {
newItem.abstractNote = getFirstResults(node, [n.dc+"description.abstract"], true);
}
// type
var type = getFirstResults(node, [n.dc+"type"], true);