Visualizing the OpenCog AtomSpace in a useful way is a complex matter and many different approaches may work well for different purposes. There have been several attempts to build AtomSpace visualization tools over the years; none have been particularly successful.
Visualization, Dashboards, Science
There are three basic classes of visualization tasks that are important for using the AtomSpace.
- Basic visualization and demos. It would be nice to be able to run the demos, found in the examples git directory, and have them run live, in a web-browser, where complete beginners can poke around and play and see what happens. A version of the AtomSpace Explorer (described below) seems like a good starting point for that.
- Dashboard. Actually using the AtomSpace usually means writing a large number of bash script to implement some data processing pipeline. Processing typically takes hours or days: it would be nice to monitor progress with something other than a plain text terminal. Each different batch process usually requires tweaking config parameters, or rewiring the pipeline in a different way. Like science experiments, you never do quite the same run twice. Some kind of processing and control dashboard would be nice. The latest suggestion is that something built from Graphana would be great! Graphana is very pretty! Graphana live demo
- Journal system. Running lab experiments requires a notebook. Not only a log of the steps that were performed, but also charts and figures showing the results. For a single user, one very convenient way of recording stuff is to use LyX for word-processing, and to use gnuplot to create charts of data. The biggest drawback to these two is that they are single-user systems, and the publication format is PDF's.
- For a multi-user system published on the web, something like Jupyter notebooks might be better. But we would need Jupyter for scheme (guile) code. And we would need to be able to version-control it. Something called "nbstripout" might be just the thing!? Solving this is not really urgent, until we get to the point of having two or more people collaborating on a science project.
Some things that a visualizer should do:
- One is almost always interested in just a tiny subset of a million-atom AtomSpace. The most powerful way of selecting what you want is the BindLink. The visualizer needs to provide an easy-to-use GUI for BindLink, and graph only what it returns.
- Graphing should not be of individual Atoms, but of structures. For example, the graph of (Evaluation (Predicate "eat") (List (Concept "Ben") (Concept "pizza"))) should not be five Atoms, but two labelled vertexes, and a labelled edge: Ben ---eats--> pizza. The BindLink should be used to return a set of labelled vertexes and edges, which can then be plotted.
- Similarly, visualizations of genomes and proteomes, used in the agi-bio/MOZI project, need to display individual genes and proteins, and their interactions (up/down regulation, expression, etc.). These need to be decorated with annotations (such as the Gene Onotology GO number). We do NOT want to draw the individual Atoms. Again, BindLink should be usable for creating these abstractions.
- Sometimes one does want to explore at the Atom level: in this case, there should be an easy way to show just the nearest neighbors (i.e the incoming set). Or maybe neighbors of a given type.
- Visualizing Values is important, two. Most commonly used are TruthValues and AttentionValues; there are others too.
- Values are, in general, time-changing. Somehow showing this would be .. nice.
Some older specifications and ideas for how visualization could be performed:
Things worth looking into:
- OGDF - the Open Graph Drawing Framework - OGDF is a self-contained C++ library for graph algorithms, in particular for (but not restricted to) automatic graph drawing. It offers sophisticated algorithms and data structures to use within your own applications or scientific projects. The library is available under the GNU General Public License.
The latest (as of October, 2017) visualization tool, and the preferred platform going forward, is the AtomSpace Explorer. This was adapted from the Mozi_Visualizer demo, which in turn was based on the former Glimpse visualizer. See the README file for instructions on how to install and use the AtomSpace Explorer.
Unfortunately, it has bit-rotted. It uses an obsolete Atom layout, and the API it uses to access Atoms is dead. It looks pretty cool from the demos, but needs a total overhaul.
Gene Annotation Service
This is a specialty tool for working with and annotating genomic data stored in the AtomSpace. See https://github.com/MOZI-AI/annotation-service
A related component is the Gene Ontlogy Visualizer. See https://github.com/Habush/annotation-graph
The Gephi code below sounds cool but it seems to have disappeared. No one knows where it went. The Dotty and Tulip visualizers were weekend hacks that never did anything fancy.
Steps for use under Ubuntu Linux:
- Start the Gephi application, including the Graph Streaming Server available in Gephi via "Tools > Plugins > Available Plugins."
- In the "Streaming" tab of the Gephi GUI, right-click the Master Server to start it.
- From the opencog shell, run
loadpy adaptors. This should find GephiMindAgent. If not, check PYTHON_EXTENSION_DIRS in your opencog.conf
- Load some atoms into the atomspace. For example,
scm-eval (clear) (load-scm-from-file "SomeAtoms.scm") (count-all)
- From the opencog shell, run `agents-step adaptors.GephiMindAgent`
- You should now see your atoms in Gephi.
(optional) Tips for new Gephi users for nice presentation:
- In the 'Layout' Tab, select the 'Force Atlas 2' layout.
- Click the check-boxes in the Layout settings for 'Dissuade Hubs' and 'Prevent Overlap'
- Click Run
(optional) Color coding:
- Select the 'Partition' tab and the 'Nodes' sub-tab.
- Click the green refresh icon below the the tabs. This should populate the parameters drop-down.
- Select "Label" in the drop-down.
- Click the 'Apply' button.
A GTK App. Very old. Bit-rotted, for sure. See https://github.com/opencog/visualization This is Erwwin Joosten's old code.
See the "obsolete" subdirectory in https://github.com/opencog/external-tools/
Hypergraph to graph conversion
In order to map Atoms into existing graph visualizers, one must map the OpenCog hypergraph into a conventional graph. Code that does this was written by Junfei Guo in 2008, and is in a rar file here: File:UpdateFinalEvaluation.rar.