Layers of RDF API

Hi Mark, Tim, Ivan, All,

It appears to me that there are different layers of RDF API, each ever 
more simplified and "Javascripty", and that we are having many 
conversations which mix up functionality from the different layers, 
leading to much discussion, and dare I say disagreement.

Perhaps it would help discussion if we define a few clear layers of API 
- here's a quick stab at it:

Layer 1
=========================
A fully typed API providing the bare minimum which implementers require 
to implement any RDF library, this includes:
  - RDF Interfaces (BlankNode, PlainLiteral etc)
  - An Interface which represents a set of triples with methods to add / 
filter / iterate / combine
  - A core-functionality interface, providing create methods for RDF 
Interfaces, CURIE resolution, Type Conversion
  - Parser and Serializer interfaces

This can be summed up with the following method signatures and usage:

   RDFTriple createTriple(RDFResource subject, IRI property, RDFNode 
object);
   boolean add( RDFTriple triple );

   var triple = y.createTriple( new IRI('http://..'), 
resolveCurie('foaf:me'), new PlainLiteral('nathan') );
   x.add( triple );

In some ways this can be thought of as the N-Triples of RDF APIs.


Layer 2
=========================
A simpler API for RDF-familiar end users which is more Javascript 
friendly, this includes
  - dynamically typed methods which are aware of native types (Date, 
Boolean, String etc)
  - special interfaces for working with Lists and BlankNodes
  - tabulator IndexedFormula style functionality

This can be summed up with the following method signature and usage:

   boolean add(any subject, any property, any object);

   var t = y.create( c(':me') , dc('created') , new Date('2010-09-02') );
   x.add( t );
   x.add( you , foaf.name , "Bob" );

In some ways this can be thought of as the Turtle of RDF APIs.


Layer 3
=========================
An API which can be seen as as-close-to pure Javascript and RDF 
integration as possible, this includes:
  - working with RDF like JSON objects
  - transparent linked data and HTTP integration
  - built in reasoning and inference

This can be summed up with code similar to the following:

   var me = get('http://webr3.org/nathan#me);
   me.name = "Nathan";
   me.vehicle.wheels = 4;
   assert(me.vehicle.type === "Car");

In some ways this can be thought of as our mid-term goal.


Layer 4
=======================
Well, layer 4 is probably an entirely different language which features 
first class support for RDF, linked-data, reasoning, rules, inference 
and so forth - quite possibly a language which compiles to Javascript. 
Something like N3+CWM+Javascript+Stuff-we-don't-know-yet combined.


In addition to the above, we have extensions such as RDFa specific 
functionality for working with documents and RDF together (considering 
the presentation tier) and query extensions like SPARQL support.


It appears to me that often I am talking in the context of Layer 1 with 
an eye on Layer 2, that Tim is often speaking of Layer 2 functionality 
with an eye for Layer 3, and that Mark is coming from the other side 
thinking primarily of Layer 3 and working backwards to layers 2 and 1. 
Regardless this perhaps doesn't matter how we are approaching things.

Can we agree that we do have several distinct layers, roughly as 
described, and that we need to define and implement each as and when we 
can - and then hopefully tag our notes, discussions, proposals with 
which layer we're talking about so clarity is assured from the off.

It is my current understanding that we (this WG) are to define Layer 1 
and the RDFa-document extensions.

Also, I've got a vague inclination that because of the simplicity of 
RDFa and because it's where JS+RDF+DOM+HTML all collide, that we all 
feel an urge to be defining the Level 3 API, but we don't have the level 
2 and 1 APIs required so are having to start by defining Level 1 instead 
- and thus functionality we are all itching for from levels 2&3 is 
creeping in to the discussions when perhaps it's outside of scope all 
together for now.

Does that all make sense?

Best,

Nathan

Received on Tuesday, 12 October 2010 21:41:16 UTC