Re: Transforming RDF into (non-binary!) trees

* Paul Tyson <> [2014-07-06 10:46-0500]
> On Sat, 2014-07-05 at 22:35 +0300, Victor Porton wrote:
> > I think we should write some code which would transform RDF into a tree
> >  (not necessarily binary! utilize nameless nodes as nodes with N
> >  childs) and also check the number of branches of a certain kind
> >  (usually 0..1 or 1..1).
> > 
> > Has anyone done a similar job?
> I have not done that in RDF, but recently I had to generate optimal
> spanning trees [1] from a directed acyclic graph (DAG). It occurred to
> me that a similar technique could be applied to RDF if you first omitted
> cycles from the RDF graph (perhaps by introducing blank nodes).
> One approach would be to put the spanning tree (however you choose to
> define it) in one named graph, and all the other "non-tree" triples in
> another named graph.
> This would make it easier to apply conventional block-and-line layout
> styles (using XSL or CSS) to the spanning tree, and use the non-tree
> links to "decorate" the format (e.g. using hyperlinks or other
> interactive behavior).
> Your use case might be quite different than mine. I am motivated by the
> problem of applying formatting style to RDF graphs. Since conventional
> layout techniques for screen and paper have a tree-based target model
> (pages/screens,blocks,lines,characters), somewhere in the process you
> must find or make a tree from your graph-based data. By specifying how
> to construct one or more useful (i.e., "meaningful for formatting")
> spanning trees from a given RDF graph, you achieve greater flexibility
> and transparency in the process.

I have a similar use case where I'm using ShEx semantic actions to map
large RDF documents like
  <> (needs CSS to render as Turtle)
into XML or JSON trees. A terse example of this is at
(Look for "View GenX output as" to render XML.)
Does this approach your to-tree use case (albeit a different tree language)?

> I suppose such a system could be implemented with SPARQL, but it would
> be nice to have a non-SPARQL declarative syntax for specifying the
> spanning tree. RIF might work.
> Regards,
> --Paul
> [1]
> > 
> > I am working for bindings librdf for Ada2012. I could write such code
> >  directly in Ada (so it may be easier), but better would be to make C
> >  interface for this. I may write in Ada and leave TODO note "port it to
> >  C".
> > 
> > Any response?
> > 
> > --
> > Victor Porton -
> > 


office: +1.617.599.3509
mobile: +

Feel free to forward this message to any list for any purpose other than
email address distribution.

There are subtle nuances encoded in font variation and clever layout
which can only be seen by printing this message on high-clay paper.

Received on Monday, 7 July 2014 13:50:00 UTC