diff --git a/example/example.js b/example/example.js
index 4d42b72..30e8ab0 100755
--- a/example/example.js
+++ b/example/example.js
@@ -1,46 +1,48 @@
-var rdf2json = require("../lib/rdf2json");
-var sys = require("sys");
-rdf2json.convertFileIntoRDFJSON("./test/wine.rdf", "flat", function(err, rdfjson){
- var obj = eval("("+ rdfjson +")");
- sys.puts(JSON.stringify(obj));
-});
-
-rdf2json.convertURLIntoRDFJSON("http://www.w3.org/TR/owl-guide/wine.rdf", "sparql", function(err, rdfjson){
- var obj = eval("("+ rdfjson +")");
- sys.puts(JSON.stringify(obj));
-});
-
-rdf2json.convertStringIntoRDFJSON("" +
- "" +
- " " +
- " " +
- " " +
- " " +
- "]>" +
- "" +
- "" +
- " " +
- " An example OWL ontology" +
- " " +
- " " +
- " " +
- " " +
- " Derived from the DAML Wine ontology at " +
- " http://ontolingua.stanford.edu/doc/chimaera/ontologies/wines.daml" +
- " Substantially changed, in particular the Region based relations." +
- " " +
- " Wine Ontology" +
- " " +
- "", "talis", function(err, rdfjson){
- var obj = eval("("+ rdfjson +")");
- sys.puts(JSON.stringify(obj));
+var rdf2json = require("../lib/rdf2json");
+var sys = require("sys");
+rdf2json.convertFileIntoRDFJSON("./test/wine.rdf", "flat", function(err, rdfjson){
+ if(err) sys.puts("Something wrong here ...");
+ var obj = eval("("+ rdfjson +")");
+ sys.puts(JSON.stringify(obj));
+});
+
+rdf2json.convertURLIntoRDFJSON("http://www.w3.org/TR/owl-guide/wine.rdf", "sparql", function(err, rdfjson){
+ if(err) sys.puts("Something wrong here ...");
+ var obj = eval("("+ rdfjson +")");
+ sys.puts(JSON.stringify(obj));
+});
+
+rdf2json.convertStringIntoRDFJSON("" +
+ "" +
+ " " +
+ " " +
+ " " +
+ " " +
+ "]>" +
+ "" +
+ "" +
+ " " +
+ " An example OWL ontology" +
+ " " +
+ " " +
+ " " +
+ " " +
+ " Derived from the DAML Wine ontology at " +
+ " http://ontolingua.stanford.edu/doc/chimaera/ontologies/wines.daml" +
+ " Substantially changed, in particular the Region based relations." +
+ " " +
+ " Wine Ontology" +
+ " " +
+ "", "talis", function(err, rdfjson){
+ var obj = eval("("+ rdfjson +")");
+ sys.puts(JSON.stringify(obj));
});
\ No newline at end of file
diff --git a/lib/rdf2json/index.js b/lib/rdf2json/index.js
index 05c6c2d..da0f2f8 100755
--- a/lib/rdf2json/index.js
+++ b/lib/rdf2json/index.js
@@ -1,2 +1,2 @@
-var rdf2json = require("./node-rdf2json");
+var rdf2json = require("./node-rdf2json");
module.exports = rdf2json;
\ No newline at end of file
diff --git a/lib/rdf2json/node-rdf2json.js b/lib/rdf2json/node-rdf2json.js
index 702266e..48bd5ad 100755
--- a/lib/rdf2json/node-rdf2json.js
+++ b/lib/rdf2json/node-rdf2json.js
@@ -1,150 +1,149 @@
-var http = require("http");
-var sys = require("sys");
-var RDF = require("../vendor/rdf-parser/parser").RDF;
-var fs = require("fs");
-
-function generateFlatRDFJSONString(triples) {
- var rdfjson = "";
- for ( var i = 0; i < triples.length; i++) {
- rdfjson += "{";
- var subject = triples[i].subject.toString();
- var predicate = triples[i].predicate.toString();
- var object = triples[i].object == undefined ? undefined
- : triples[i].object.toString();
- var lang = triples[i].lang ? triples[i].lang.toString() : "";
- var datatype = triples[i].datatype ? triples[i].datatype.toString()
- : "";
- if (triples[i].type == "resource") {
- rdfjson += "\"s\" : { \"type\" : \"uri\", \"uri\" : \"" + subject
- + "\" },";
- rdfjson += "\"p\" : \"" + predicate + "\",";
- rdfjson += "\"o\" : { \"type\" : \"uri\", \"uri\" : \"" + object
- + "\" }";
- } else {
- rdfjson += "\"s\" : { \"type\" : \"uri\", \"uri\" : \"" + subject
- + "\" },";
- rdfjson += "\"p\" : \"" + predicate + "\",";
- rdfjson += "\"o\" : { \"type\" : \"literal\", \"val\" : \""
- + object + "\" , \"lang\" : \"" + lang
- + "\", \"datatype\" : \"" + datatype + "\"}";
- }
- if (i != (triples.length - 1)) {
- rdfjson += "},";
- } else {
- rdfjson += "}";
- }
- }
- return rdfjson;
-}
-
-function _toRDFJSON(rdf, type, callback) {
- var rdfjson = "";
- if (type.toLowerCase() == "flat") {
- var triples = rdf.Match(null, null, null, null);
- rdfjson += "{ \"data\" : [";
- rdfjson += generateFlatRDFJSONString(triples);
- rdfjson += "]}";
- } else if (type.toLowerCase() == "sparql") {
- var triples = rdf.Match(null, null, null, null);
- rdfjson += "{ \"head\" : { \"vars\" : [\"s\", \"p\", \"o\"]},";
- rdfjson += "\"results\" : { \"bindings\" : [";
- rdfjson += generateFlatRDFJSONString(triples);
- rdfjson += "]}}";
- } else if (type.toLowerCase() == "talis") {
- var triples = rdf.Match(null, null, null, null);
- sys.puts(sys.inspect(triples));
- var subjects = new Array();
- for ( var i = 0; i < triples.length; i++) {
- if (subjects.indexOf(triples[i].subject) != -1) {
- continue;
- } else {
- subjects.push(triples[i].subject);
- }
- }
- rdfjson += "{";
- for ( var i = 0; i < subjects.length; i++) {
- rdfjson += " \"" + subjects[i] + "\" : {";
- var groupSubjects = rdf.Match(null, subjects[i], null, null);
- var predicates = new Array();
- for ( var j = 0; j < groupSubjects.length; j++) {
- if (predicates.indexOf(groupSubjects[j].predicate) != -1) {
- continue;
- } else {
- predicates.push(groupSubjects[j].predicate);
- }
- }
- for ( var j = 0; j < predicates.length; j++) {
- rdfjson += "\"" + predicates[j] + "\" : [";
- groupObjects = rdf
- .Match(null, subjects[i], predicates[j], null);
- for ( var k = 0; k < groupObjects.length; k++) {
- var object = groupObjects[k].object;
- if (!groupObjects[k].type)
- continue;// TODO If the parsing result is correct,
- // each statement should always have this
- // type info.
- if (groupObjects[k].type.toString() == "literal") {
- rdfjson += "{ \"value\" : \"" + object.toString()
- + "\", \"type\" : \"uri\"";
- if (groupObjects[k].datatype) {
- rdfjson += ", \"datatype\" : \""
- + groupObjects[k].datatype.toString()
- + "\"";
- }
- if (groupObjects[k].lang) {
- rdfjson += ", \"lang\" : \""
- + groupObjects[k].lang.toString() + "\"";
- }
- rdfjson += "}";
- } else if (groupObjects[k].type.toString() == "resource") {
- if (object.toString().substr(0, 2) == "_:n") {
- rdfjson += "{ \"value\" : \"" + object.toString()
- + "\", \"type\" : \"bnode\"}";
- } else {
- rdfjson += "{ \"value\" : \"" + object.toString()
- + "\", \"type\" : \"uri\"}";
- }
- }
- if (k < groupObjects.length - 1) {
- rdfjson += ",";
- }
- }
- rdfjson += "]";
- if (j < predicates.length - 1)
- rdfjson += ",";
- }
- rdfjson += "}";
- if (i < subjects.length - 1)
- rdfjson += ",";
- }
- rdfjson += "}";
- }
- callback(null, rdfjson);
-}
-
-exports.convertStringIntoRDFJSON = function(rdfxml, type, callback) {
- var rdf = new RDF();
- rdf.loadRDFXML(rdfxml);
- _toRDFJSON(rdf, type, function(err, rdfjson) {
- callback(null, rdfjson);
- });
-};
-
-exports.convertFileIntoRDFJSON = function(filepath, type, callback) {
- var self = this;
- var rdf = new RDF();
- fs.readFile(filepath, function(err, data) {
- self.convertStringIntoRDFJSON(data, type, function(err, rdfjson) {
- callback(null, rdfjson);
- });
- });
-};
-
-exports.convertURLIntoRDFJSON = function(url, type, callback) {
- var rdf = new RDF();
- rdf.getRDFURL(url, function() {
- _toRDFJSON(rdf, type, function(err, rdfjson) {
- callback(null, rdfjson);
- });
- });
+var sys = require("sys");
+var RDF = require("../vendor/rdf-parser/parser").RDF;
+var fs = require("fs");
+
+function generateFlatRDFJSONString(triples) {
+ var rdfjson = "";
+ for ( var i = 0; i < triples.length; i++) {
+ rdfjson += "{";
+ var subject = triples[i].subject.toString();
+ var predicate = triples[i].predicate.toString();
+ var object = triples[i].object == undefined ? undefined
+ : triples[i].object.toString();
+ var lang = triples[i].lang ? triples[i].lang.toString() : "";
+ var datatype = triples[i].datatype ? triples[i].datatype.toString()
+ : "";
+ if (triples[i].type == "resource") {
+ rdfjson += "\"s\" : { \"type\" : \"uri\", \"uri\" : \"" + subject
+ + "\" },";
+ rdfjson += "\"p\" : \"" + predicate + "\",";
+ rdfjson += "\"o\" : { \"type\" : \"uri\", \"uri\" : \"" + object
+ + "\" }";
+ } else {
+ rdfjson += "\"s\" : { \"type\" : \"uri\", \"uri\" : \"" + subject
+ + "\" },";
+ rdfjson += "\"p\" : \"" + predicate + "\",";
+ rdfjson += "\"o\" : { \"type\" : \"literal\", \"val\" : \""
+ + object + "\" , \"lang\" : \"" + lang
+ + "\", \"datatype\" : \"" + datatype + "\"}";
+ }
+ if (i != (triples.length - 1)) {
+ rdfjson += "},";
+ } else {
+ rdfjson += "}";
+ }
+ }
+ return rdfjson;
+}
+
+function _toRDFJSON(rdf, type, callback) {
+ var rdfjson = "";
+ if (type.toLowerCase() == "flat") {
+ var triples = rdf.Match(null, null, null, null);
+ rdfjson += "{ \"data\" : [";
+ rdfjson += generateFlatRDFJSONString(triples);
+ rdfjson += "]}";
+ } else if (type.toLowerCase() == "sparql") {
+ var triples = rdf.Match(null, null, null, null);
+ rdfjson += "{ \"head\" : { \"vars\" : [\"s\", \"p\", \"o\"]},";
+ rdfjson += "\"results\" : { \"bindings\" : [";
+ rdfjson += generateFlatRDFJSONString(triples);
+ rdfjson += "]}}";
+ } else if (type.toLowerCase() == "talis") {
+ var triples = rdf.Match(null, null, null, null);
+ sys.puts(sys.inspect(triples));
+ var subjects = new Array();
+ for ( var i = 0; i < triples.length; i++) {
+ if (subjects.indexOf(triples[i].subject) != -1) {
+ continue;
+ } else {
+ subjects.push(triples[i].subject);
+ }
+ }
+ rdfjson += "{";
+ for ( var i = 0; i < subjects.length; i++) {
+ rdfjson += " \"" + subjects[i] + "\" : {";
+ var groupSubjects = rdf.Match(null, subjects[i], null, null);
+ var predicates = new Array();
+ for ( var j = 0; j < groupSubjects.length; j++) {
+ if (predicates.indexOf(groupSubjects[j].predicate) != -1) {
+ continue;
+ } else {
+ predicates.push(groupSubjects[j].predicate);
+ }
+ }
+ for ( var j = 0; j < predicates.length; j++) {
+ rdfjson += "\"" + predicates[j] + "\" : [";
+ groupObjects = rdf
+ .Match(null, subjects[i], predicates[j], null);
+ for ( var k = 0; k < groupObjects.length; k++) {
+ var object = groupObjects[k].object;
+ if (!groupObjects[k].type)
+ continue;// TODO If the parsing result is correct,
+ // each statement should always have this
+ // type info.
+ if (groupObjects[k].type.toString() == "literal") {
+ rdfjson += "{ \"value\" : \"" + object.toString()
+ + "\", \"type\" : \"uri\"";
+ if (groupObjects[k].datatype) {
+ rdfjson += ", \"datatype\" : \""
+ + groupObjects[k].datatype.toString()
+ + "\"";
+ }
+ if (groupObjects[k].lang) {
+ rdfjson += ", \"lang\" : \""
+ + groupObjects[k].lang.toString() + "\"";
+ }
+ rdfjson += "}";
+ } else if (groupObjects[k].type.toString() == "resource") {
+ if (object.toString().substr(0, 2) == "_:n") {
+ rdfjson += "{ \"value\" : \"" + object.toString()
+ + "\", \"type\" : \"bnode\"}";
+ } else {
+ rdfjson += "{ \"value\" : \"" + object.toString()
+ + "\", \"type\" : \"uri\"}";
+ }
+ }
+ if (k < groupObjects.length - 1) {
+ rdfjson += ",";
+ }
+ }
+ rdfjson += "]";
+ if (j < predicates.length - 1)
+ rdfjson += ",";
+ }
+ rdfjson += "}";
+ if (i < subjects.length - 1)
+ rdfjson += ",";
+ }
+ rdfjson += "}";
+ }
+ callback(null, rdfjson);
+}
+
+exports.convertStringIntoRDFJSON = function(rdfxml, type, callback) {
+ var rdf = new RDF();
+ rdf.loadRDFXML(rdfxml);
+ _toRDFJSON(rdf, type, function(err, rdfjson) {
+ callback(null, rdfjson);
+ });
+};
+
+exports.convertFileIntoRDFJSON = function(filepath, type, callback) {
+ var self = this;
+ var rdf = new RDF();
+ fs.readFile(filepath, function(err, data) {
+ self.convertStringIntoRDFJSON(data, type, function(err, rdfjson) {
+ callback(null, rdfjson);
+ });
+ });
+};
+
+exports.convertURLIntoRDFJSON = function(url, type, callback) {
+ var rdf = new RDF();
+ rdf.getRDFURL(url, function() {
+ _toRDFJSON(rdf, type, function(err, rdfjson) {
+ callback(null, rdfjson);
+ });
+ });
};
\ No newline at end of file
diff --git a/lib/vendor/node-XMLHttpRequest/XMLHttpRequest.js b/lib/vendor/node-XMLHttpRequest/XMLHttpRequest.js
index 561c71f..f6b985a 100755
--- a/lib/vendor/node-XMLHttpRequest/XMLHttpRequest.js
+++ b/lib/vendor/node-XMLHttpRequest/XMLHttpRequest.js
@@ -11,8 +11,7 @@
* @license MIT
*/
-var Url = require("url")
- ,sys = require("sys");
+var Url = require("url");
exports.XMLHttpRequest = function() {
/**
diff --git a/lib/vendor/rdf-parser/parser.js b/lib/vendor/rdf-parser/parser.js
index 6f0aa18..356b340 100755
--- a/lib/vendor/rdf-parser/parser.js
+++ b/lib/vendor/rdf-parser/parser.js
@@ -56,7 +56,6 @@ Changes since 0.37 - Added postRDFURL for Carlos Strozzi
/*extern ActiveXObject,Document,DOMParser,SVGDoc *//* platform support */
var XMLHttpRequest = require("../node-XMLHttpRequest/XMLHttpRequest").XMLHttpRequest;
-var sys = require("sys");
var xmlDOMParser = require("../node-o3-xml");
function RDF() {
diff --git a/test/test.js b/test/test.js
index 34f73e4..5b22112 100755
--- a/test/test.js
+++ b/test/test.js
@@ -1,164 +1,171 @@
-var rdf2json = require("../lib/rdf2json");
-var jsunit = require("mjsunit");
-
-function testConvertStringIntoRDFJSON(){
- rdf2json.convertStringIntoRDFJSON("" +
- "" +
- " " +
- " " +
- " " +
- " " +
- "]>" +
- "" +
- "" +
- " " +
- " An example OWL ontology" +
- " " +
- " " +
- " " +
- " " +
- " Derived from the DAML Wine ontology at " +
- " http://ontolingua.stanford.edu/doc/chimaera/ontologies/wines.daml" +
- " Substantially changed, in particular the Region based relations." +
- " " +
- " Wine Ontology" +
- " " +
- "", "flat", function(err, rdfjson){
- jsunit.assertNotNull("The generated flat RDF/JSON string should not be null", rdfjson);
- var jsonobj = eval("("+ rdfjson +")");
- jsunit.assertNotNull("The flat RDF/JSON object should not be null", jsonobj);
- });
-}
-
-function testConvertFileIntoRDFJSON(){
- rdf2json.convertFileIntoRDFJSON("../wine.rdf", "flat", function(err, rdfjson){
- jsunit.assertNotNull("The generated flat RDF/JSON string should not be null", rdfjson);
- var jsonobj = eval("("+ rdfjson +")");
- jsunit.assertNotNull("The flat RDF/JSON object should not be null", jsonobj);
- });
-}
-
-function testConvertURLIntoRDFJSON(){
- rdf2json.convertURLIntoRDFJSON("http://www.w3.org/TR/owl-guide/wine.rdf", "flat", function(err, rdfjson){
- jsunit.assertNotNull("The generated flat RDF/JSON string should not be null", rdfjson);
- var jsonobj = eval("("+ rdfjson +")");
- jsunit.assertNotNull("The flat RDF/JSON object should not be null", jsonobj);
- });
-}
-
-function testConvertStringIntoRDFJSON(){
- rdf2json.convertStringIntoRDFJSON("" +
- "" +
- " " +
- " " +
- " " +
- " " +
- "]>" +
- "" +
- "" +
- " " +
- " An example OWL ontology" +
- " " +
- " " +
- " " +
- " " +
- " Derived from the DAML Wine ontology at " +
- " http://ontolingua.stanford.edu/doc/chimaera/ontologies/wines.daml" +
- " Substantially changed, in particular the Region based relations." +
- " " +
- " Wine Ontology" +
- " " +
- "", "sparql", function(err, rdfjson){
- jsunit.assertNotNull("The generated SPARQL RDF/JSON string should not be null", rdfjson);
- var jsonobj = eval("("+ rdfjson +")");
- jsunit.assertNotNull("The SPARQL RDF/JSON object should not be null", jsonobj);
- });
-}
-
-function testConvertFileIntoRDFJSON(){
- rdf2json.convertFileIntoRDFJSON("../wine.rdf", "sparql", function(err, rdfjson){
- jsunit.assertNotNull("The generated SPARQL RDF/JSON string should not be null", rdfjson);
- var jsonobj = eval("("+ rdfjson +")");
- jsunit.assertNotNull("The SPARQL RDF/JSON object should not be null", jsonobj);
- });
-}
-
-function testConvertURLIntoRDFJSON(){
- rdf2json.convertURLIntoRDFJSON("http://www.w3.org/TR/owl-guide/wine.rdf", "sparql", function(err, rdfjson){
- jsunit.assertNotNull("The generated SPARQL RDF/JSON string should not be null", rdfjson);
- var jsonobj = eval("("+ rdfjson +")");
- jsunit.assertNotNull("The SPARQL RDF/JSON object should not be null", jsonobj);
- });
-}
-
-function testConvertStringIntoRDFJSON(){
- rdf2json.convertStringIntoRDFJSON("" +
- "" +
- " " +
- " " +
- " " +
- " " +
- "]>" +
- "" +
- "" +
- " " +
- " An example OWL ontology" +
- " " +
- " " +
- " " +
- " " +
- " Derived from the DAML Wine ontology at " +
- " http://ontolingua.stanford.edu/doc/chimaera/ontologies/wines.daml" +
- " Substantially changed, in particular the Region based relations." +
- " " +
- " Wine Ontology" +
- " " +
- "", "talis", function(err, rdfjson){
- jsunit.assertNotNull("The generated Talis RDF/JSON string should not be null", rdfjson);
- var jsonobj = eval("("+ rdfjson +")");
- jsunit.assertNotNull("The Talis RDF/JSON object should not be null", jsonobj);
- });
-}
-
-function testConvertFileIntoRDFJSON(){
- rdf2json.convertFileIntoRDFJSON("../wine.rdf", "talis", function(err, rdfjson){
- jsunit.assertNotNull("The generated Talis RDF/JSON string should not be null", rdfjson);
- var jsonobj = eval("("+ rdfjson +")");
- jsunit.assertNotNull("The Talis RDF/JSON object should not be null", jsonobj);
- });
-}
-
-function testConvertURLIntoRDFJSON(){
- rdf2json.convertURLIntoRDFJSON("http://www.w3.org/TR/owl-guide/wine.rdf", "talis", function(err, rdfjson){
- jsunit.assertNotNull("The generated Talis RDF/JSON string should not be null", rdfjson);
- var jsonobj = eval("("+ rdfjson +")");
- jsunit.assertNotNull("The Talis RDF/JSON object should not be null", jsonobj);
- });
+var rdf2json = require("../lib/rdf2json");
+var jsunit = require("mjsunit");
+var sys = require("sys");
+
+function testConvertStringIntoRDFJSON(){
+ rdf2json.convertStringIntoRDFJSON("" +
+ "" +
+ " " +
+ " " +
+ " " +
+ " " +
+ "]>" +
+ "" +
+ "" +
+ " " +
+ " An example OWL ontology" +
+ " " +
+ " " +
+ " " +
+ " " +
+ " Derived from the DAML Wine ontology at " +
+ " http://ontolingua.stanford.edu/doc/chimaera/ontologies/wines.daml" +
+ " Substantially changed, in particular the Region based relations." +
+ " " +
+ " Wine Ontology" +
+ " " +
+ "", "flat", function(err, rdfjson){
+ if(err) sys.puts("Something wrong here ...");
+ jsunit.assertNotNull("The generated flat RDF/JSON string should not be null", rdfjson);
+ var jsonobj = eval("("+ rdfjson +")");
+ jsunit.assertNotNull("The flat RDF/JSON object should not be null", jsonobj);
+ });
+}
+
+function testConvertFileIntoRDFJSON(){
+ rdf2json.convertFileIntoRDFJSON("../wine.rdf", "flat", function(err, rdfjson){
+ jsunit.assertNotNull("The generated flat RDF/JSON string should not be null", rdfjson);
+ var jsonobj = eval("("+ rdfjson +")");
+ jsunit.assertNotNull("The flat RDF/JSON object should not be null", jsonobj);
+ });
+}
+
+function testConvertURLIntoRDFJSON(){
+ rdf2json.convertURLIntoRDFJSON("http://www.w3.org/TR/owl-guide/wine.rdf", "flat", function(err, rdfjson){
+ jsunit.assertNotNull("The generated flat RDF/JSON string should not be null", rdfjson);
+ var jsonobj = eval("("+ rdfjson +")");
+ jsunit.assertNotNull("The flat RDF/JSON object should not be null", jsonobj);
+ });
+}
+
+function testConvertStringIntoRDFJSON(){
+ rdf2json.convertStringIntoRDFJSON("" +
+ "" +
+ " " +
+ " " +
+ " " +
+ " " +
+ "]>" +
+ "" +
+ "" +
+ " " +
+ " An example OWL ontology" +
+ " " +
+ " " +
+ " " +
+ " " +
+ " Derived from the DAML Wine ontology at " +
+ " http://ontolingua.stanford.edu/doc/chimaera/ontologies/wines.daml" +
+ " Substantially changed, in particular the Region based relations." +
+ " " +
+ " Wine Ontology" +
+ " " +
+ "", "sparql", function(err, rdfjson){
+ if(err) sys.puts("Something wrong here ...");
+ jsunit.assertNotNull("The generated SPARQL RDF/JSON string should not be null", rdfjson);
+ var jsonobj = eval("("+ rdfjson +")");
+ jsunit.assertNotNull("The SPARQL RDF/JSON object should not be null", jsonobj);
+ });
+}
+
+function testConvertFileIntoRDFJSON(){
+ rdf2json.convertFileIntoRDFJSON("../wine.rdf", "sparql", function(err, rdfjson){
+ if(err) sys.puts("Something wrong here ...");
+ jsunit.assertNotNull("The generated SPARQL RDF/JSON string should not be null", rdfjson);
+ var jsonobj = eval("("+ rdfjson +")");
+ jsunit.assertNotNull("The SPARQL RDF/JSON object should not be null", jsonobj);
+ });
+}
+
+function testConvertURLIntoRDFJSON(){
+ rdf2json.convertURLIntoRDFJSON("http://www.w3.org/TR/owl-guide/wine.rdf", "sparql", function(err, rdfjson){
+ jsunit.assertNotNull("The generated SPARQL RDF/JSON string should not be null", rdfjson);
+ var jsonobj = eval("("+ rdfjson +")");
+ jsunit.assertNotNull("The SPARQL RDF/JSON object should not be null", jsonobj);
+ });
+}
+
+function testConvertStringIntoRDFJSON(){
+ rdf2json.convertStringIntoRDFJSON("" +
+ "" +
+ " " +
+ " " +
+ " " +
+ " " +
+ "]>" +
+ "" +
+ "" +
+ " " +
+ " An example OWL ontology" +
+ " " +
+ " " +
+ " " +
+ " " +
+ " Derived from the DAML Wine ontology at " +
+ " http://ontolingua.stanford.edu/doc/chimaera/ontologies/wines.daml" +
+ " Substantially changed, in particular the Region based relations." +
+ " " +
+ " Wine Ontology" +
+ " " +
+ "", "talis", function(err, rdfjson){
+ if(err) sys.puts("Something wrong here ...");
+ jsunit.assertNotNull("The generated Talis RDF/JSON string should not be null", rdfjson);
+ var jsonobj = eval("("+ rdfjson +")");
+ jsunit.assertNotNull("The Talis RDF/JSON object should not be null", jsonobj);
+ });
+}
+
+function testConvertFileIntoRDFJSON(){
+ rdf2json.convertFileIntoRDFJSON("../wine.rdf", "talis", function(err, rdfjson){
+ if(err) sys.puts("Something wrong here ...");
+ jsunit.assertNotNull("The generated Talis RDF/JSON string should not be null", rdfjson);
+ var jsonobj = eval("("+ rdfjson +")");
+ jsunit.assertNotNull("The Talis RDF/JSON object should not be null", jsonobj);
+ });
+}
+
+function testConvertURLIntoRDFJSON(){
+ rdf2json.convertURLIntoRDFJSON("http://www.w3.org/TR/owl-guide/wine.rdf", "talis", function(err, rdfjson){
+ if(err) sys.puts("Something wrong here ...");
+ jsunit.assertNotNull("The generated Talis RDF/JSON string should not be null", rdfjson);
+ var jsonobj = eval("("+ rdfjson +")");
+ jsunit.assertNotNull("The Talis RDF/JSON object should not be null", jsonobj);
+ });
}
\ No newline at end of file