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

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 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] http://en.wikipedia.org/wiki/Spanning_tree

> 
> 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 - http://portonvictor.org
> 

Received on Sunday, 6 July 2014 15:47:22 UTC