Is D3 Tree API inadequate for RDF/OWL Data? Does it need to be extended?

334 views
Skip to first unread message

Guerino1

unread,
Jun 23, 2014, 5:06:58 PM6/23/14
to d3...@googlegroups.com
Hi,

I've read the API reference and tested it with an RDF/OWL based Tree visualization that I'm working on.  Unless I'm missing something (which is always possible) I believe there's an issue with the existing D3 Tree API that strips out attributes of Nodes and Links based on how the tree.nodes() and tree.links() methods work, which is to "auto-generate" Node and Link arrays from things like a JSON structure, rather than taking in predefined and pre-existing Node and Link arrays.

Most existing D3 Tree examples I've found use data structures like JSON to feed the visualization.  The JSON is used to auto-generate Node and Link arrays.  The code assumes, for example, that there's no additional information (i.e. attributes) for Link arrays other than "source" and "target".What if there's a descriptive predicate or a link ID?  Even the CSV generated Tree example auto-generates Nodes from a link set, assuming the Nodes have no descriptive attributes.

In an RDF/OWL-like environment, both, Nodes and Links are assumed to be "richer" in descriptive data and can have many additional attributes.  For example...

  var nodeSet = [
    {id: "N0", name: "Node 0", size: 20, hlink: "some link"},
    {id: "N1", name: "Node 1", size: 30, hlink: "some link"},
    {id: "N2", name: "Node 2", size: 20, hlink: "some link"},
    {id: "N3", name: "Node 3", size: 10, hlink: "some link"},
    {id: "N4", name: "Node 4", size: 70, hlink: "some link"}
  ];

  //  Notice the additional Link Attributes "linkId" and "predicate"
  var linkSet = [
    {linkId: "L0", source: "N0", predicate: "Descriptive Predicate 1", target: "N1"},
    {linkId: "L1", source: "N0", predicate: "Descriptive Predicate 2", target: "N2"},
    {linkId: "L2", source: "N2", predicate: "Descriptive Predicate 1", target: "N3"},
    {linkId: "L3", source: "N0", predicate: "Descriptive Predicate 1", target: "N4"}
  ];

Some very distinct things to keep in mind are the extra attributes in the linkSet, such as the linkId and predicate.

Based on my experience, it appears that JSON structures don't really have a clean way of representing Link attributes like Link identifiers or descriptive predicates all that way.  This seems to be reflected in the D3 Tree API.

For example, the D3 Tree API method "tree.nodes(linkSet[0])" will traverse links to create a an array of Nodes, ignoring the original nodeSet and, therefore, creates a whole new Node array (independent of the original nodeSet) that lacks all the other Node related attributes (i.e. "id", "size", and "hlink").

Additionally, the D3 Tree API method "tree.links(nodes)" seems to generate a whole new Links array that is independent of the original linkSet, and that lacks all the other Link related attributes (i.e. "linkId" and "predicate").

My Question: Is there a need for two new Tree API methods, in order to deal with more RDF/OWL-like data structures, that allow a user to "assign predefined" Node and Link arrays, so that other Node and Link related attributes don't get stripped out?  In other words, while the methods "tree.nodes(root)" and "tree.links(nodes)" seem to make sense for JSON structures, is there a need for two new API methods?  For example:

    "tree.usePredefinedNode(nodeSet)" and
    "tree.usePredefinedLInks(linkSet)"

Or, is there some better way of using the above data formats that I'm completely missing?

NOTE: I came across this in a RDF/OWL based Tree visualization that I've been working on, where I try to provide RDF/OWL-like data to the tree layout and the existing API loses/ignores the additional Node and Link attributes.  In one case, I have a hack that loops through the Tree generated Node array and merges in the lost attributes from the original nodeSet array.  I haven't yet figure out how I'm going to cleanly merge in the lost linkSet attributes, yet.  This "additional looping" in order to re-merge lost attributes seems wasteful.

NOTE: I believe that if the D3 API were extended to handle these predefined RDF/OWL-like Node and Link arrays, it would be a very natural and very powerful extension for seamlessly interfacing Graph/Network data from RDF/OWL with D3.

Would love to hear your thoughts on this.

Thanks,

Frank





Jim McCusker

unread,
Jun 23, 2014, 10:42:55 PM6/23/14
to d3-js
One issue I've had with tree layout is that OWL class heirarchies are not trees, but DAGs. If the tree layout could somehow be generalized to a DAG, (Concept Map and cytoscape have this layout available) then this could be very powerful.

Jim


--
You received this message because you are subscribed to the Google Groups "d3-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Jim McCusker

Data Scientist
5AM Solutions

PhD Student
Tetherless World Constellation
Rensselaer Polytechnic Institute
mcc...@cs.rpi.edu
http://tw.rpi.edu

Frank Guerino

unread,
Jun 23, 2014, 11:29:26 PM6/23/14
to d3...@googlegroups.com
Hi Jim,

I believe that if we can get to a standard API interface for "rich" Node Lists and "rich" Link/Relationship Lists (where by rich I mean that we can have and utilize as many attributes as necessary for Nodes and Links) we could easily convert to/from DAG.

Frank

John Carlson

unread,
Jul 7, 2017, 9:36:50 PM7/7/17
to d3-js
Is anyone visualizing OWL data in D3.js? Thanks, John

John Carlson

unread,
Jul 7, 2017, 9:40:29 PM7/7/17
to d3-js

Ruud Steltenpool

unread,
Jul 8, 2017, 5:05:33 PM7/8/17
to d3-js

Jim McCusker

unread,
Jul 8, 2017, 5:33:27 PM7/8/17
to d3-js
I've built an RDF viewer in D3 that does a lot of the work you're looking for, but might be too custom. Remember that D3 is not limited (much) by the data structure, but instead by how you apply that data to its algorithms and renderings you create with them.



--
You received this message because you are subscribed to the Google Groups "d3-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
James P. McCusker III, Ph.D.

Jim McCusker

unread,
Jul 8, 2017, 5:42:22 PM7/8/17
to d3-js
Note that I use the dagre layout package to do node/link layout. Doing good visualization of generic data (especially graph data) is non-trivial.
Reply all
Reply to author
Forward
0 new messages