Re: RDF to HTML templating

On 18 Dec 2013, at 21:40, Melvin Carvalho <melvincarvalho@gmail.com> wrote:

> 
> 
> 
> On 18 December 2013 21:38, Melvin Carvalho <melvincarvalho@gmail.com> wrote:
> 
> 
> 
> On 18 December 2013 19:28, Henry Story <henry.story@bblfish.net> wrote:
> 
> 
> 
> On 18 Dec 2013, at 17:50, Luggen Michael <michael.luggen@bfh.ch> wrote:
> 
> > Hi Henry,
> >
> > In which kind of format comes the PointedGraph? If you can transform it into a JSON Structure you can take any of the numerous JavaScript Template Libraries around. I personally prefer Handlebars, but also Mustache, Underscore are valid contenders. The interesting tidbit is how to map a Graph to a defined JSON Structure which can be consumed by a Template.
> 
> Hi Michael! :-)
> 
> That is what we are doing right now by hand to map the pointed graph to JS.
> We could automate it of course. ( if there is a library to do that already
> that would save us some time, please let us know ).
> 
> The problem is that we want to put actions on the HTML so that when a field is updated
> it should update a particular graph in the store ( and the remote LDP resource of course ).
> But  for this the field needs to know what relation it was to what subject, so
> that the triple can be updated or removed. If one has create json that contains
> each of the properties, the types, etc, that seems a bit heavy.
> 
> ( But perhaps that can be done with JSON=LD ? ... Hmmm.... The problem with JSON-LD would be
> that we then would then risk serialisng the whole graph into JSON-LD when perhaps only a small
> part will be needed in the html template... It is the template that really queries the
> graph to fill it out.)
> 
> So the problem is to solve the mapping into HTML in such a way that it is easy to map back
> to the store when changes are made..
> 
> One way is HTTP PATCH over JSON.  Code and demo here:
> 
> http://hello.rww.io/hellopatch.html
> 
> SPARQL Update version:
> 
> http://hello.rww.io/hellosparql.html

Melvin and Michael,

 I am aware that one can use HTTP PATCH to update the resources. That is indeed what
our LDP server does. 

https://github.com/stample/rww-play/wiki/Curl-Interactions#updating-a-resource-with-patch

The problem is not how to update the remote resource or the local graph. The issue
is more how to map a change occurring in an html field to a correct SPARQL Update string.
For this to work on needs to know what triple needs to be changed in the graph. An update to 
a form tells us what changes occurred to an object of a triple. One still needs to know by what
relation that form element was related to what object. Knowing that it is then easy to write the
correct Sparql Update. 

Eg.  if someone updates a form element showing a name to a new name, it would be great
if one could by looking at the DOM find automatically from the form what the relation was - 
foaf:name for example - and what the subject was <#me> for example.

 The thought is that if the html contained this information ( RDFa seems like a reasonable first
choice ), then one could add an event listener on the form element that could automatically work
out these relations.

Henry

> 
> >
> > Michael
> >
> >
> > On 18.12.2013, at 17:04, Henry Story <henry.story@bblfish.net> wrote:
> >
> >> Hi all,
> >>
> >> I have a quick question:
> >>
> >> Is there a simple RDF to HTML templating library?
> >>
> >> We have developed an initial PointedGraph library for
> >> rdflib [1],  and would like to have a function such as
> >>
> >>  template.apply(pg,template)
> >>
> >> which would bind the pointed graph to a template.
> >> I imagine this could be best done with an RDFa
> >> template, but I don't know what the issues with
> >> this are. I am quite open to other suggestions too.
> >>
> >> I have seen Vie, but this seems to require a whole
> >> framework. It would be nice to have a library dedicated
> >> to just this functionality, so that one can use it with
> >> different libraries, or develop our own.
> >>
> >> All the best,
> >>
> >>      Henry Story
> >>
> >>
> >> [1] https://github.com/stample/rww-play/blob/withPointedGraph/public/ldp/lib/pointedGraph.js
> >>  We'd like to then have an rdfstore implementation for this later.
> >>
> >> Social Web Architect
> >> http://bblfish.net/
> >>
> >>
> >
> 
> Social Web Architect
> http://bblfish.net/
> 
> 
> 
> 

Social Web Architect
http://bblfish.net/

Received on Wednesday, 18 December 2013 22:56:38 UTC