RDF Data Visualization
There was a "software to draw RDF graph diagrams" thread on [email protected]. I was checking out the options and figured I'd record them here so others could be as lazy as I would have liked to have been.
I downloaded ontology-visualization.
git clone https://github.com/fatestigma/ontology-visualization
Cloning into 'ontology-visualization'...
remote: Counting objects: 44, done.
remote: Compressing objects: 100% (31/31), done.
remote: Total 44 (delta 19), reused 34 (delta 12), pack-reused 0
Unpacking objects: 100% (44/44), done.
It came with a tiny chunk of demo data:
:John a :Man ;
:name "John" ;
:hasSpouse :Mary .
:Mary a :Woman ;
:name "Mary" ;
:hasSpouse :John .
:John_jr a :Man ;
:name "John Jr." ;
:hasParent :John, :Mary .
:Time_Span a owl:Class .
:event a :Activity ;
:has_time_span [
a :Time_Span ;
:at_some_time_within_date "2018-01-12"^^xsd:date
] .
:u129u-klejkajo-2309124u-sajfl a :Person ;
:name "John Doe" .
I installed the python rdflib ( sudo pip install rdflib ) and rendered it with ontology-visualization:
python ./ontology_viz.py -o test.dot test.ttl -O ontology.ttl
[WARNING] Class http://dig.isi.edu/Time_Span doesn't exist in the ontology!
[WARNING] Property http://dig.isi.edu/at_some_time_within_date doesn't exist in the ontology!
dot -Tsvg -o test-ontology-visualization.svg test.dot
Woman Mary
ontology-visualization a name
Man John Mary Time_Span 2018-01-12
a name hasSpouse hasSpouse a at_some_time_within_date
Person John Doe a John hasParent John Jr. Activity
a name hasParent name a has_time_span
u129u-klejkajo-2309124u-sajfl John_jr event
The EasyRdf Converter required no installation. I just pasted the Turtle in and selected SVG. Otoh, it rendered the result in a giant <pre/> rather than rendering the SVG inline in the response. I manually re-ordered
the EasyRdf's graphviz output in order to better compare it to ontology-visualization. Here are the original EasyRdf dot and EasyRdf SVG and the tweaked dot.
John http://dig.isi.edu/Man owl:Class
EasyRdf Converter
rdf:type rdf:type
http://dig.isi.edu/Woman Mary http://dig.isi.edu/John http://dig.isi.edu/Time_Span 2018-01-12
rdf:type rdf:type rdf:type
http://dig.isi.edu/Person John Doe http://dig.isi.edu/Mary John Jr. http://dig.isi.edu/Activity
rdf:type rdf:type
http://dig.isi.edu/u129u-klejkajo-2309124u-sajfl http://dig.isi.edu/John_jr http://dig.isi.edu/event
Folks suggested yEd and Visio but those require manual drawing. You can also convert from yEd to RDF and ShEx. Someone mentioned Gruff but that requires installation of AllegroGraph (transcript below). The
default rendering of the test data was again somewhat arbitrary in its layout but I again heroically alligned it with the ontology-visualization output for easy comparison. I didn't figure out how to export so here's a
screenshot.
Gruff
Conclusion
ontology-visualization - prettier with colors and swoopier arcs.
EasyRdf Converter - nicer .dot file to work with (if you care about that).
Gruff - more manual and a lot more work because it's part of an industrial-strength, multi-purpose tool.
Installing Gruff
Gruff has to talk to a database endpoint. I wasn't sure if it could be any SPARQL endpoint but in order to minimize impedence, I went strait to Allegrograph. The Franz downloads page has Gruff and Allegrograph.
Allegrograph
tar xzf ~/Downloads/agraph-6.4.4-linuxamd64.64.tar.gz
mkdir agraph-inst
./agraph-6.4.4/install-agraph /tmp/agraph-inst/
/tmp/agraph-inst/ already exists.
Overwrite? (config files will not be affected) [y/n] y
Welcome to the AllegroGraph configuration program. This script will
help you establish a baseline AllegroGraph configuration.
You will be prompted for a few settings. In most cases, you can hit return
to accept the default value.
Location of configuration file to create:
[/tmp/agraph-inst/lib/agraph.cfg]:
Directory to store data and settings:
[/tmp/agraph-inst/data]:
/tmp/agraph-inst/data does not exist.
Would you like me to create it?:
[y]:
Directory to store log files:
[/tmp/agraph-inst/log]:
/tmp/agraph-inst/log does not exist.
Would you like me to create it?:
[y]:
Location of file to write server process id:
[/tmp/agraph-inst/data/agraph.pid]:
Port:
[10035]:
Now you must set up an initial user account for AllegroGraph. This
account will have "super user" privileges in AllegroGraph.
SuperUser account name:
[super]:
SuperUser account password:
SuperUser account password (again):
Instance timeout seconds:
[604800]:
/tmp/agraph-inst/lib/agraph.cfg has been created.
If desired, you may modify the configuration. When you are satisfied,
you may start the agraph service.
You can start AllegroGraph by running:
/tmp/agraph-inst/bin/agraph-control --config /tmp/agraph-inst/lib/agraph.cfg start
You can stop AllegroGraph by running:
/tmp/agraph-inst/bin/agraph-control --config /tmp/agraph-inst/lib/agraph.cfg stop
Removing staged installations from all hosts.
Installation complete.
./agraph-inst/bin/agraph-control start
AllegroGraph Server Edition 6.4.4, built on September 06, 2018 08:22:54 GMT-0700
Gruff
tar xzf ~/Downloads/gruff-7.2.2-AG6.4.4-linuxamd64.64-ACL10.1.tar.gz
./gruff
International Allegro CL [master]
10.1 [64-bit Linux (x86-64)] (Sep 6, 2018 8:35)
Copyright (C) 1985-2017, Franz Inc., Oakland, CA, USA. All Rights Reserved.
This dynamic runtime copy of Allegro CL was built by:
Franz Inc. Staff
;; Optimization settings: safety 1, space 1, speed 1, debug 2.
;; For a complete description of all compiler switches given the
;; current optimization settings evaluate (explain-compiler-settings).
;;---
;; Current reader case mode: :case-sensitive-lower
(gruff:4886): Gdk-WARNING **: 03:49:25.992: gdk_window_set_icon_list: icons too large
Open the AllegroGraph interface: http://127.0.0.1:10035/#.
Create new repository Name: test and click .
Under "Load and Delete Data" click on "Import RDF: from an uploaded file".
Use the to select "test.ttl". Don't forget to click the button done with the file upload dialog.
From Gruff, File, Open Triple Store:
Under view, select Graphical Query View
My default query was: select ?s ?p ?o where {
?s ?p ?o .
}
limit 100
Click and .
You should now be able to drag stuff around to your heart's content.