- From: bergi <bergi@axolotlfarm.org>
- Date: Wed, 02 Jul 2014 14:11:48 +0200
- To: public-rdfjs@w3.org
- CC: Read-Write-Web <public-rww@w3.org>, WebID <public-webid@w3.org>
The announcing mail contained many links, but a lack of documentation. In this mail I will explain the intension to create RDF-Ext and some details how to use it. There is already a number of RDF-Interfaces [1] implementations (webr3 [2], node-rdf [3], rdfstore [4]). If you look for a standard to handle graphs, triples and nodes in JavaScript it's definitely RDF-Interfaces. Beside the objects to model graphs, RDF-Interfaces specifies interfaces for parsers and serializers. >From my experience the most important use case is fetching a graph document from a store (the Web is also a store!), parse it and filter the triples to get the nodes your are interested in. RDF-Interfaces doesn't cover the first step at all and the second step requires manual work. So everybody had to implement the HTTP request (Ajax + Node.js) and the mime type handling to find the right parser. RDF-Ext covers this generic use case with the Store interface. The implementation comes already with a LdpStore (works with any RESTful graph data), SparqlStore and InMemoryStore. Of course the Store interface also offers methods to write to a store. See the current spec [5] for details. During development different implementations can be useful to switch from the lightweight InMemoryStore to another one with persistence. The definition of parsers and serializers in the RDF-Interfaces spec don't support asynchronous implementations. But some serializations may require additional HTTP requests. For example the JSON-LD context can be given as an IRI. The RDF-Ext spec adds a done callback to the process method of the parser, which is called after all triples have been processed. The serialize method of the serializer interface has a new callback which is called with the serialized data as the first argument. The RDF-Ext spec is downwards compatible. If an implementation doesn't require asynchronous calls both interfaces can be implemented. RDF-Ext comes with a Turtle (based on N3.js [6]) and RDF/XML (based on RDFLib.js [7]) parser, which supports both interfaces. The JSON-LD parser can be only used using the new RDF-Ext interface. All serializers (NTriples, JSON-LD) support both interfaces. The Store interface is also a good base for other generic stuff like: RDF-JSONify is a wrapper around a store to access (read/write) graph data using JSON-LD objects. It doesn't matter if your persistence layer comes with a SPARQL or LDP interface. The Store implementation handles this. RDF-JSONify converts every graph to a JSON-LD object. The JSON-LD context can be defined on the request level or for a defined path (Regex or prefix). If you don't have to deal with very dynamic data models, this maybe the easiest way to handle RDF data in JavaScript. It's the perfect combination for frameworks like React and AngularJS. See the LDApp [8] blog examples. There are implementations for both frameworks. A SPARQL query engine on top of the Store interface is in a very early stage. I plan to release it in some weeks. If you are interested and in this project and you like to contribute, please contact me. Contributions to the other modules are also very welcome. [1] www.w3.org/TR/rdf-interfaces/ [2] https://github.com/webr3/rdf-interfaces [3] https://github.com/Acubed/node-rdf [4] https://github.com/antoniogarrote/rdfstore-js [5] http://bergos.github.io/rdf-ext-spec/ [6] https://github.com/RubenVerborgh/N3.js [7] https://github.com/linkeddata/rdflib.js [8] http://bergos.github.io/ldapp-www/
Received on Wednesday, 2 July 2014 12:13:10 UTC