Git Product home page Git Product logo

node-rdf2json's Introduction

#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("" +
	"<?xml version=\"1.0\"?>" +
	"	<!DOCTYPE rdf:RDF [" +
	"		<!ENTITY vin  \"http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#\" >" +
   	"		<!ENTITY food \"http://www.w3.org/TR/2003/PR-owl-guide-20031209/food#\" >" +
   	"		<!ENTITY owl  \"http://www.w3.org/2002/07/owl#\" >" +
   	"		<!ENTITY xsd  \"http://www.w3.org/2001/XMLSchema#\" >" +
   	"]>" +
	...
	"</rdf:RDF>", "talis", function(err, rdfjson){
	// do something with rdfjson
});

node-rdf2json's People

Contributors

baxtree avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mattpardee heath

node-rdf2json's Issues

Segfault !

Using MacOS 10.6 and node.js 0.4.1

Just trying to run the test

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.