www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit ea767e5647cc6859b3238fbd7240a62f939893ad
parent 53d336681bf498700b69babaefc218a490e440c0
Author: aurimasv <aurimas.dev@gmail.com>
Date:   Thu, 26 Apr 2012 17:36:17 -0500

Set up environment for RDF parser

Diffstat:
Mchrome/content/zotero/xpcom/rdf.js | 10++++++----
Achrome/content/zotero/xpcom/rdf/init.js | 33+++++++++++++++++++++++++++++++++
Mchrome/content/zotero/xpcom/translation/translate.js | 2+-
Mcomponents/zotero-service.js | 1+
4 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/chrome/content/zotero/xpcom/rdf.js b/chrome/content/zotero/xpcom/rdf.js @@ -1,6 +1,7 @@ // Tweaks to get the Tabulator RDF library to work without Tabulator. All of this happens in the // Zotero.RDF.AJAW namespace. -var kb = new RDFIndexedFormula(); -var tabulator = {log:{debug:function(arg) { - Zotero.debug(arg, 4); -}}}; +$rdf.RDFIndexedFormula = $rdf.IndexedFormula; +$rdf.RDFSymbol = $rdf.Symbol; +$rdf.RDFBlankNode = $rdf.BlankNode; + +Zotero.RDF.AJAW = $rdf; +\ No newline at end of file diff --git a/chrome/content/zotero/xpcom/rdf/init.js b/chrome/content/zotero/xpcom/rdf/init.js @@ -0,0 +1,32 @@ +/* Set up the environment before loading the rest of the files into Zotero */ +var $rdf = { + Util: { + ArrayIndexOf: function (arr, item, i) { + //supported in all browsers except IE<9 + return arr.indexOf(item, i); + }, + RDFArrayRemove: function(a, x) { //removes all statements equal to x from a + for(var i=0; i<a.length; i++) { + //TODO: This used to be the following, which didnt always work..why + //if(a[i] == x) + if (a[i].subject.sameTerm( x.subject ) && + a[i].predicate.sameTerm( x.predicate ) && + a[i].object.sameTerm( x.object ) && + a[i].why.sameTerm( x.why )) { + a.splice(i,1); + return; + } + } + throw "RDFArrayRemove: Array did not contain " + x; + }, + }, +}; + +var tabulator = { + log: { + debug: Zotero.debug, + warn: Zotero.debug + } +}; + +var alert = tabulator.log.warn; +\ No newline at end of file diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js @@ -2311,7 +2311,7 @@ Zotero.Translate.IO._RDFSandbox.prototype = { * Serializes the current RDF to a string */ "serialize":function(dataMode) { - var serializer = Serializer(); + var serializer = Zotero.RDF.AJAW.Serializer(this._dataStore); for(var prefix in this._dataStore.namespaces) { serializer.suggestPrefix(prefix, this._dataStore.namespaces[prefix]); diff --git a/components/zotero-service.js b/components/zotero-service.js @@ -234,6 +234,7 @@ function makeZoteroContext(isConnector) { // Load RDF files into Zotero.RDF.AJAW namespace (easier than modifying all of the references) const rdfXpcomFiles = [ + 'rdf/init', 'rdf/uri', 'rdf/term', 'rdf/identity',