Re: RDF to HTML templating

Hi Henry and others,

Maybe RForms can be useful for you?
https://code.google.com/p/rforms/

RForms is a pure js library that uses template files (RForms-templates) to
generates HTML forms that can be used to edit or present RDF. We have
provided some templates for common vocabularies like Dublin Core, SKOS,
FOAF etc. You can also construct your own templates with support for
specific properties, maybe mix from various vocabularies and, if so needed,
support editing of deep RDF structures. The templates are expressed as json
files and can be edited by hand or constructed with help of a specific
editor editor which we refer to as the formulator :-).

For unknown RDF graphs, e.g. when you do not know exact which properties
used in the graph, you can use the detect mode that combine templates to
match as much as possible of the graph (given that you preloaded with a
suitable set of small templates).

There are some examples in the wiki so you can experiment directly, one of
the more advanced is the learning object metadata example here:
https://code.google.com/p/rforms/wiki/demoLOM
(Note that you can modify the RDF in the editor and see the change in the
serialized format and vice versa. In this demo you can also modify the
template to change the apperance of the HTML form as well as the RDF
expression being expressed. Check the tutorial for how to modify the
template.)

Internally RForms works with an RDF API that at all times keeps the RDF
graph in sync with what is shown in the form, this allows you to in
principle have different views of the RDF in parallell (e.g. a graph view
and a form view). Currently the RDF API supports reading and writing of
RDF/XML and RDF/JSON (the version from Talis), but adding support for more
formats should be quite straightforward.

Regarding reading and writing back to a store:
The approach we have taken is to load and push back entire named graphs
since it significantly simplifies problems regarding concurrency, extent of
graph to send over, access control, and avoids update problems with blank
nodes.

You can also see RForms in action in EntryScape, a collaborative plattform
for working with metadata around resources:
http://demo.entryscape.com/

/Matthias


On Wed, Dec 18, 2013 at 7:28 PM, 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..
>
>
>
>
> >
> > 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/
>
>
>


-- 


*Matthias Palmér*
Co-founder

*MetaSolutions AB*
Mobile +46 736 812466
matthias@metasolutions.se
www.metasolutions.se

Received on Thursday, 19 December 2013 10:53:41 UTC