From 83e261930ebb9d8ec7c4f202663d4e22088e030e Mon Sep 17 00:00:00 2001 From: Aurimas Vinckevicius Date: Sat, 8 Feb 2014 20:29:41 -0600 Subject: [PATCH 1/2] [rdflib.js] Literals with attributes should be added as rdf:value nodes --- chrome/content/zotero/xpcom/rdf/rdfparser.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chrome/content/zotero/xpcom/rdf/rdfparser.js b/chrome/content/zotero/xpcom/rdf/rdfparser.js index bbfa0f10e5..b88cd641ef 100644 --- a/chrome/content/zotero/xpcom/rdf/rdfparser.js +++ b/chrome/content/zotero/xpcom/rdf/rdfparser.js @@ -337,6 +337,11 @@ $rdf.RDFParser = function (store) { if(dom['nodeType'] == RDFParser['nodeType']['TEXT'] || dom['nodeType'] == RDFParser['nodeType']['CDATA_SECTION']) { //we have a literal + if(frame['parent']['nodeType'] == frame['NODE']) { + //must have had attributes, store as rdf:value + frame['addArc'](RDFParser['ns']['RDF'] + 'value'); + frame = this['buildFrame'](frame); + } frame['addLiteral'](dom['nodeValue']) } else if(elementURI(dom) != RDFParser['ns']['RDF'] + "RDF") { // not root From 89782e78bf68b44bb1513681908ac0806a41a958 Mon Sep 17 00:00:00 2001 From: Aurimas Vinckevicius Date: Sat, 8 Feb 2014 20:31:09 -0600 Subject: [PATCH 2/2] Zotero.Translate.IO._RDFSandbox.getResourceURI should return the contents of rdf:value where available --- chrome/content/zotero/xpcom/translation/translate.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index ca827f8062..d6b34e52ef 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -2639,6 +2639,11 @@ Zotero.Translate.IO._RDFSandbox.prototype = { */ "getResourceURI":function(resource) { if(typeof(resource) == "string") return resource; + + const rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; + var values = this.getTargets(resource, rdf + 'value'); + if(values && values.length) return this.getResourceURI(values[0]); + if(resource.uri) return resource.uri; if(resource.toNT == undefined) throw new Error("Zotero.RDF: getResourceURI called on invalid resource"); return resource.toNT();