Model Visualization in the Eclipse-Based SADL-IDE

Last revised 11/16/2020. Contact us.

Visualization in SADL Version 3

In SADL Version 3, the graphing package is a plug-in accessed as a service implementing the Java Interface class com.ge.research.sadl.model.visualizer.IGraphVisualizer. The SADL-IDE's SADL preference "Graph renderer package and class" setting is, by default, the GraphViz implementation in com.ge.research.sadl.model.visualizer.GraphVizVisualizer. Any visualizer implementing the IGraphVisualizer Interface class can be placed on the Java classpath and specified in this preference.

Generating Graphs with GraphViz

GraphViz can be downloaded from http://www.graphviz.org/ and should be placed on a path without spaces or other "difficult" path characters. Once installed, there should be a "bin" folder under the installation directory with "dot" and "dotty" executables.

GraphViz creates graphs as SVG files in the Graphs project subfolder. Generating a graph also results in an attempt to open the graph file using the application associated with the SVG file type in Eclipse. With an appropriate file association, graphs will automatically be opened in an appropriate viewer, e.g., a Web browser such as Chrome or the internal Web browser.

When the GraphVizVisualizer is used, the location of the GraphViz bin folder must be specified in the OS environment variable GraphVizPath, e.g,

    GraphVizPath=C:\Apps\graphviz-2.36\release\bin

Also, when the GraphVizVisualizer is used, the dot file can be retained (not automatically deleted after the SVG file is created) by setting the OS environment variable GraphVizKeepDot to true:

    GraphVizKeepDot =true.

Note that Eclipse must be restarted after setting environment variables for them to become visible to Eclipse. (For some reason, a reboot has sometimes been found to be necessary to make the environment variable visible in Eclipse.)

Adding GraphViz Attributes

GraphViz has many node and edge attributes that can be used to give shape, color, tooltips, and more to graphs. For detailed information see https://graphviz.org/doc/info/attrs.html.

SPARQL queries can be constructed that will generate ResultSets that provide attribute values to nodes and edges in the resulting graph. This is accomplished as follows. The names of the first three columns of the ResultSet are the names of the variables for the directed graph's head-node, edge label, and tail-node, respectively. More columns can be included in the result set to provide additional attribute information by giving a column a name composed of one of the name of one of the first three columns concatenated with an underscore and the name of an attribute that is meaningful for the column with the prefixed name. For example, consider a query with this beginning:

"select distinct ?N1 ?link ?N2 ?N1_style ?N1_fillcolor ?N2_style ?N2_fillcolor (?cplist as ?N1_tooltip) where

The first column, the head-node, is named "N1". The edge label is named "link". The tail-node is named "N2". The 4th column sets the style of the head-node, the 5th column sets the fill color of the head-node. The 6th column sets the style of the tail-node. The 7th column sets the fill color of the tail-node. The 8th column, which is called "cplist" in the query but renamed to "N1_tooltip", sets a tooltip for the head-node. The header and first row of this ResultSet might look like this:

"N1","link","N2","N1_style","N1_fillcolor","N2_style","N2_fillcolor","N1_tooltip"
"HeadNode","link-label","TailNode","filled",:yellow","filled","red","I'm a tooltip; I show up when you mouse over my node"

On-Demand Graph Generation Options

There are two basic graphing commands available on the SADL dropdown menu: "Show Graph" and "Graph Ontology". (In the SADL perspective, "SADL" appears in the top menu bar; the SADL (gear) icon on the tool bar also has this dropdown menu.)

Show Graph

The result of "Show Graph" depends upon what is selected before invoking the command. The answer to the "How many edges from anchor?" question will determine the size of the graph generated around the "anchor" concept or model.

Selected Object Given Focus Results
A SADL model file, either selected in the Project Explorer or because the focus is in the editor window where the SADL model is open, but nothing is selected in the editor A graph of imports of the selected SADL model
A class is selected in the SADL editor Two graphs, a class hierarchy including the class and domains and ranges that include the class
A property is selected in the SADL editor A graph showing the domain and range of the property, and extending on following domains and ranges
An instance is selected in the SADL editor A graph showing all of the connections of that instance in the graph

Graph Ontology

Selected Object Given Focus Results
A SADL file selected in the Project Explorer A graph of the model contained in the SADL file
A SADL project selected in the Project Explorer A graph of the project showing models as nodes and arcs showing imports. Each import node with an associated OWL model in the project or in a referenced project will be a link to a graph of the imported model.

Graphing by SADL Statement

Graphs can also be generated from SADL statements within a .sadl file. This can be done either with a SPARQL construct query or with the Graph SADL keyword.

  1. Ask: "construct ....".    // will generate a graph for a valid SPARQL construct statement (see http://www.w3.org/TR/sparql11-query/#construct )
  2. Graph: "select ?s ?p ?v where {....}".    // will construct a graph; requires a result with 3 columns (3 variables in the select)