https://github.com/baxtree/node-rdf2json
node-rdf2json can help users in transforming RDF/XML (resource centric) into JSON (key-value centric)
https://github.com/baxtree/node-rdf2json
Last synced: 5 months ago
JSON representation
node-rdf2json can help users in transforming RDF/XML (resource centric) into JSON (key-value centric)
- Host: GitHub
- URL: https://github.com/baxtree/node-rdf2json
- Owner: baxtree
- License: mit
- Created: 2010-12-15T17:34:24.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2012-01-09T17:25:56.000Z (over 14 years ago)
- Last Synced: 2025-09-09T14:01:12.935Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 20.4 MB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#node-rdf2json
node-rdf2json can help users in transforming RDF/XML (resource centric) into JSON (key-value centric).
#Usage:
Add node-rdf2json module to your require path:
var rdf2json = require("rdf2json");
Generate JSON based on a URL:
rdf2json.rdf2json.convertURLIntoRDFJSON(url, format, function(err, rdfjson){
var obj = eval("(" + rdfjson + ")");
sys.puts(sys.inspect(obj));
});
Generate JSON from an RDF file:
rdf2json.convertFileIntoRDFJSON(filepath, format, function(err, rdfjson){
var obj = eval("(" + rdfjson + ")");
sys.puts(sys.inspect(obj));
});
Generate JSON from a RDF string:
rdf2json.convertStringIntoRDFJSON(str, format, function(err, rdfjson){
var obj = eval("(" + rdfjson + ")");
sys.puts(sys.inspect(obj));
});
#Supported RDF/JSON formats
As the time of the last release, there is no "standard" mapping between RDF and JSON and node-rdf2json supports the following RDF/JSON formats (will be extended continuously):
[1] "flat": Flat RDF/JSON format.
example:
rdf2json.convertFileIntoRDFJSON("./test/wine.rdf", "flat", function(err, rdfjson){
// do something with rdfjson
});
[2] "sparql": SPARQL RDF/JSON format.
example:
rdf2json.convertURLIntoRDFJSON("http://www.w3.org/TR/owl-guide/wine.rdf", "sparql", function(err, rdfjson){
// do something with rdfjson
});
[3] "talis": Talis RDF/JSON format.
exmaple:
rdf2json.convertStringIntoRDFJSON("" +
"" +
" " +
" " +
" " +
" " +
"]>" +
...
"", "talis", function(err, rdfjson){
// do something with rdfjson
});