Using 4RDFs Triclops from Commandline

I recently merged an old RDF graphing library (within 4Suite) into the 4Suite 4RDF command-line in preperation for the beta release. The library is called Triclops. With this addition, the 4RDF command-line can now render RDF graphs into a representative SVG or Jpeg diagram.

Using Graphviz

Triclops makes use of Graphviz to render .dot graphs (generated from RDF serializations) into various formats. One of the advantages is that Graphviz's neato can be used to apply a spring graph layout algorithm to the final graph. This often results in a more informative layout of the final graph than the default. The downside is the large amount of processing needed by this function.

4RDF Options

Below is a listing of the 4RDF command-line options

The Triclops integration consists of 3 additions:

First, the additional values to the -s / --serialize option:

  • svg
  • jpeg

Second, the -g / --graphviz option (which is required when either of the above options are used) takes the path to the dot / neato executables. And finally, the -l / --spring option requests that neato is used instead of dot. This results in the spring algorithm being applied to the graph.

FOAF example

To demonstrate, I'm using the Dan Brickley FOAF example (as listed in the specification). In the terminal below, I list the content of the FOAF document, then convert it to a jpeg diagram first and then an SVG diagram right afterwards (using neato to layout the graph). On my machine, the dot and neato executables are located in /usr/bin, so I set the -g option accordingly:

The generated jpg diagram is below while its svg alternative is here.

Another example

Below are jpeg and svg diagrams of the 4Suite Repository Ontology (modeled in OWL):

My long-term plan is to make Triclops completely configurable so that the generated graphs are tailored to the user's specification for things such as the font used for text, how to format blank nodes, etc. Porting it to use Pydot might go a long way in this regard.

[Chimezie Ogbuji]

via Copia