Universität Koblenz-Landau Institut für Softwaretechnik Re-Group
Graph Exchange Language
An overview Ric Holt
Andreas Winter
joint work with
Andy Schürr and Susan Sim
Contents
• GXL motivation and history
• GXL requirements
• GXL features
– nodes, edges and attributes – ordering
– hypergraphs
• GXL extended features
– support for hierarchical graphs – support for graph drawing
– GXL extension – schemata
• Conclusion and Future Work
Interoperability of Tools (examples)
• Acacia C++ parser tool kit and AT&T graph drawing (TA)
• ASIS, GCC and GUPRO (TGraphs)
• Bauhaus Parsers and PBS/LSEDIT (TA)
• CPPANAL and GUPRO (TGraphs)
• Cxref extractor and TA
• CFX (PBS) and TA (RSF, TA)
• Dali tool kit and Rigi (TA)
• Datrix C++ and TA
• DaVinci, Graphlet and GUPRO (TGraphs)
• EDGE and PROGRES
• HTML and GUPRO (TGraphs)
• Grok (RSF, TA)
• GUPRO (multi-language) Parsers, GReQL-Query and Code-Browser (TGraphs)
• JViews and PROGRES
• Mathlab Stateflow and Daimler-Chrysler CTE (PROGRES)
• PLIX-Parser and TA (RSF,TA)
• Rigi parser, Rigi viewer and TA (RSF)
• SNIFF+ and TA
GXL Objective
standard exchange language
– for interchanging data between reengineering tools
mathematical model
– typed, attributed, directed graphs notation
– eXtensible Markup Language (XML) – Unified Modeling Language (UML)
application to other areas in software engineering – graph transformation
– graph drawing
History
GXL Partners
Bell Canada (Datrix Group), Canada
IBM Centre for Advanced Studies, Canada Mahindra British Telecom, India
Nokia Research Center (Software Technology Laboratory), Finland Philips Research (Software Architecture Group), The Netherlands RWTH Aachen (Department of Computer Science III), Germany University of Berne (Software Composition Group), Switzerland
University Bw München (Institute for Software Technology), Germany University of Koblenz (IST, Re-Group), Germany
University of Oregon (Department of Computer Science), U.S.A.
University of Paderborn (AG Softwaretechnik), Germany University of Stuttgart (BAUHAUS Group), Germany University of Victoria (RIGI Group), Canada
University of Waterloo (Software Architecture Group), Canada
Quality Criteria
• application domain independent
• based on an open standard
• efficient in time and space
• applicable to most
– reengineering approaches
• independent of abstraction levels
• independent of programming languages
• applicable to large software software systems
– graph transformation approaches
• independent of underlying graph models
– graph visualization approaches
• independent of graph layout models
GXL Design Goals
• simple and compact representation of directed and undirected graphs
• suitable for a broad spectrum of graph
models, including support for hypergraphs and hierarchical graphs
• uniform representation of graphs and graph schemas
• support for representation of complex attribute values
• extensibility of graph elements and attribute
types
GXL Graph Model
GXL Attribute Model
GXL Document Type Definition
automatic generation of GXL DTD
follows MOF/XMI standard
entity types and attributes are not distinguished
blows up the number of XML elements (GXL 0.7.2: 136/74 elements)
manual definition of GXL DTD
manual work to do
distinction between entity types and attributes reflects design decisions
small and simple DTD (20 elements)
GXL Document Type Definition
<!ENTITY % *-extension " " >
<!ENTITY % val " %value-extension; locator | bool | int | float | string | seq | set | bag | tup ">
<!ENTITY % context " in | out" >
<!ENTITY % link " inlink | outlink" >
<!ELEMENT gxl (%gxl-extension; graph) >
<!ATTLIST gxl xmlns:xlink CDATA #FIXED "www.w3.org/1999/xlink">
<!ELEMENT type EMPTY>
<!ATTLIST type xlink:type (simple) #FIXED "simple"
xlink:href CDATA #REQUIRED >
<!ELEMENT graph (%graph-extension;
type? , attr* , ( node | edge | rel )*)>
<!ATTLIST graph id ID #REQUIRED edgeids ( true | false )
hypergraph ( true | false )
direction ( directed | undirected)>
<!ELEMENT node (%node-extension;
type? , attr*, graph*, (%context;)*) >
<!ATTLIST node id ID #REQUIRED direction ( directed | undirected >
<!ELEMENT in |out (%context-extension; attr*) >
<!ATTLIST in |out ref IDREF #REQUIRED role NMTOKEN #IMPLIED >
<!ELEMENT edge (%edge-extension;
type? , attr*, graph*) >
<!ATTLIST edge id ID #IMPLIED from IDREF #REQUIRED to IDREF #REQUIRED
direction ( directed | undirected )>
<!ELEMENT rel (%rel-extension;
type? , attr*, graph*, (%link;)* ) >
<!ATTLIST rel id ID #IMPLIED direction ( directed | undirected )>
<!ELEMENT inlink | outlink (%link-extension; attr)* >
<!ATTLIST inlink | outlink
ref IDREF #REQUIRED role NMTOKEN #IMPLIED >
<!ELEMENT attr (type?, attr*, (%val;)) >
<!ATTLIST attr name NMTOKEN #REQUIRED kind NMTOKEN #IMPLIED >
<!ELEMENT locator EMPTY >
<!ATTLIST locator xlink:type (simple) #FIXED
xlink:href CDATA #IMPLIED >
<!ELEMENT bool | int | float | string (#PCDATA) >
<!ELEMENT seq | set | bag | tup (%val;)* >
Nodes, Edges and Attributes
p :
v :
graph
<?xml version="1.0"?><!DOCTYPE gxl SYSTEM "gxl.dtd">
<gxl><graph>
<node id = "p">
</node>
<node id = "v">
</node>
<edge
from = "p" to = "v">
</edge>
<graph></gxl>
e :
id = "e"
<type xlink:href =
"schema.gxl#Proc"/>
<type xlink:href =
"schema.gxl#Var"/>
<type xlink:href =
"schema.gxl#refers"/>
refers typed
Proc
Var attributed
file = "main.c"
line = 27
<attr name = "file">
<string>main.c</string></attr>
<attr name = "line">
<int>27</int></attr>
Attributed Edges
<edge id = "e"
from = "p" to = "v">
<type xlink:href =
"schema.gxl#refers"/>
<attr name = "line">
<int>42</int>
</attr>
</edge>
p :
v :
Proc
Var
file = "main.c"
line = 27 e : refers
line = 42
GXL Documents (DTD)
<!ELEMENT gxl (%gxl-extension; graph) >
<!ATTLIST gxl xmlns:xlink CDATA #FIXED "www.w3.org/1999/xlink">
<!ELEMENT graph (%graph-extension;
type? , attr* , ( node | edge | rel )*) >
<!ATTLIST graph
id ID #REQUIRED edgeids ( true | false ) "false"
hypergraph ( true | false ) "false"
direction ( directed | undirected ) "directed" >
Nodes and Edges (DTD)
<!ELEMENT node (%node-extension;
type? , attr*, graph*, (%context;)*) >
<!ATTLIST node
id ID #REQUIRED
direction (directed|undirected ) #IMPLIED>
<!ELEMENT edge (%edge-extension;
type? , attr*, graph*)>
<!ATTLIST edge
id ID #IMPLIED
from IDREF#REQUIRED to IDREF#REQUIRED
direction (directed|undirected ) #IMPLIED>
<graph
direction = "undirected" >
...
<edge id = "e"
from = "p" to = "v">
</edge>
...
</graph>
undirected graph
<graph
direction = "directed" >
...
<edge id = "e"
direction = "undirected"
from = "p" to = "v">
</edge>
...
</graph>
undirected edge in directed graph
Undirected Graphs
p :
v :
Proc
Var
file = "main.c"
line = 27 e :
edges are always noted as directed
but can be interpreted as undirected
Prog authors = { Ric,
Andy, Susan,
Andreas } p :
GXL supports
•set,
•sequence,
•bag,
•tuple
of
•bool,
•int,
•float,
•string,
•complex values
Complex Attributes
<node id = "p">
<type xlink:href =
"schema.gxl#prog"/>
<attr name = "authors">
<set>
<string>Ric</string>
<string>Andy</string>
<string>Susan</string>
<string>Andreas</string>
</set>
</attr>
</node>
Attributes (DTD)
<!ENTITY % val " %value-extension;
locator |
bool | int | float | string | seq | set | bag | tup ">
<!ELEMENT attr (type?, attr*, (%val;)) >
<!ATTLIST attr
name NMTOKEN #REQUIRED
kind NMTOKEN #IMPLIED >
Attribute Values (DTD)
<!ELEMENT locator EMPTY >
<!ATTLIST locator
xlink:type (simple) #FIXED "simple"
xlink:href CDATA #IMPLIED >
<!ELEMENT bool (#PCDATA) >
<!ELEMENT int (#PCDATA) >
<!ELEMENT float (#PCDATA) >
<!ELEMENT string (#PCDATA) >
<!ELEMENT seq (%val;)* >
<!ELEMENT set (%val;)* >
<!ELEMENT bag (%val;)* >
<!ELEMENT tup (%val;)* >
pointers to
external objects
simple attributes
complex attributes
Ordering of Incidences
p :
a : b :
d : c :
e : {1} {3}
{2}
{4}
{5} {6}
<node id = "p" >
</node>
<in ref = "a" />
<in ref = "b" />
<out ref = "b" />
<in ref = "e" />
<out ref = "d" />
<in ref = "c" />
{1}
{2}
v : V
w : W
u : U r :
theSecondU
theFirstU
theV
theW
directed
Hypergraphs
<rel id = "r"
direction = "directed">
<outlink ref = "u"
role = "theFirstU"/>
<outlink ref = "u"
role = "theSecondU"/>
<inlink ref = "v"
role = "theV" />
<outlink ref = "w"
role = "theW" />
</rel>
<node id = "u">
<in ref = "u"
role = "theSecondU" />
<in ref = "u"
role = "thefirstU" />
</node>
v : V
w : W u : U
theSecondU
theFirstU
theV
theW {1}
{2}
undirected
r :
"
undirected">
direction = "undirected">
Hypergraphs (DTD)
<!ELEMENT rel (%rel-extension;
type? , attr*, graph*, (%link;)* ) >
<!ATTLIST rel
id ID #IMPLIED
direction (directed | undirected) #IMPLIED>
Context and Link (DTD)
Node Incidences
<!ENTITY % context " in | out" >
<!ELEMENT in | out (%context-extension; attr*) >
<!ATTLIST in |out
ref IDREF #REQUIRED role NMTOKEN #IMPLIED >
Edge Incidences
<!ENTITY % link " inlink | outlink" >
<!ELEMENT inlink | outlink (%link-extension; attr)* >
<!ATTLIST inlink | outlink
ref IDREF #REQUIRED
role NMTOKEN #IMPLIED >
u : t :
f :
Support for Hierarchical Graphs
v : e : w :
<graph>
<node id = "v"/>
<node id = "w"/>
<edge id = "e"
from = "v" to = "w"/>
</graph>
innergraph.xml
<graph>
<node id = "t">
<attr name = "inner">
<locator xlink:href =
"innergraph.xml"/>
</attr>
</node>
<node id = "u"/>
<edge id = "f"
from = "t" to = "u"/>
</graph>
main.xml
by graph-valued attributes
Support for Hierarchical Graphs
u : t :
f :
v : e : w :
Edges crossing hierarchies
<graph>
<node id = "t">
<attr name = "inner">
<locator xlink:href =
"innergraph.xml"/>
</attr>
</node>
<node id = "u">
<attr name = "inner">
<locator xlink:href =
"innergraph.xml#w"/>
</attr>
</node>
<edge id = "f"
from = "t" to = "u"/>
</graph>
main.xml
u : t :
f :
Support for Hierarchical Graphs
v : e : w :
by nested graphs
<node id = "t">
</node>
<node id = "u"/>
<edge id = "f"
from = "t" to = "u"/>
<graph>
<node id = "v"/>
<node id = "w"/>
<edge id = "e"
from = "v" to = "w"/>
</graph>
Support for Hierarchical Graphs
u : t :
f :
v : e : w :
Edges crossing hierarchies
g :
<node id = "t">
<graph>
<node id = "v"/>
<node id = "w"/>
<edge id = "e"
from = "v" to = "w"/>
</graph>
</node>
<node id = "u"/>
<edge id = "f"
from = "t" to = "u"/>
<edge id = "g"
from = "u" to = "w"/>
Support for Graph Drawing
<node id = "v"
<attr name = "position">
<tup>
<float>0.0</float>
<float>0.0</float>
</tup>
</attr>
<attr name = "width">
<float>2</float>
</attr>
<attr name = "height">
<float>1.5</float>
</attr>
</edge>
<edge id = "e"
from = "v" to = "w">
<attr name = "polyline">
<tup>
<float>0.0</float>
<float>0.0</float>
</tup>
<tup>
<float>5.0</float>
<float>5.0</float>
</tup>
</attr>
</edge>
layout data is represented as ordinary attribute
GXL Extension
• by redefining entities
• by including GXL DTD (external entities)
<!ENTITY % gxl-extension "FOO ," >
<!ELEMENT FOO (#PCDATA)>
<!ENTITY % basegxl SYSTEM "gxl.dtd">
%basegxl;
• GXL offers extending
– GXL documents – graphs
– nodes – edges
– hyperedges (rel)
– contexts and links
– values
GXL Extension (DTD)
<!ENTITY % gxl-extension "" >
<!ENTITY % graph-extension "" >
<!ENTITY % node-extension "" >
<!ENTITY % edge-extension "" >
<!ENTITY % rel-extension "" >
<!ENTITY % value-extension "" >
<!ENTITY % context-extension "" >
<!ENTITY % link-extension "" >
Graph Schema
UML class diagram (schema)
Var
file : string
line : int line : int
refers
Proc
v : Var
file="main.c"
line = 27 line = 42
e : refers
UML object diagram (graph)
p : Proc
?
GXL Schema Representation
UML class diagram
Var file:string
line : int line : int
Proc
refers
:
Nodetyp e
name="Proc"
:
Attribut e
name="file"
:
Domain
name="string"
:
Edgetype name="refers"
:
Nodetype name="Var"
:
Domain name="int"
:
Attribut e
name="line"
from
to
hasAttr hasDom
hasAttr
hasAttr
hasDom
approach
schema graph
?
GXL Schema Representation
UML class diagram
Var file:string
line : int line : int
Proc
refers
Ric´s approach
schema graph
refers : line : int
Proc : file : string
Var : line : int
<node id = "Proc">
<attr name = "file">
<string/>
</attr>
</node>
<node id = "Var">
<attr name = "line">
<int/>
</attr>
</node>
<edge id = "refers"
from = "Proc"
to = "Var">
<attr name = "line">
<int/>
</attr>
</edge>
?
GXL Schema Representation
IST Approach
clear distinction of instance and schema level
same notation for all meta levels
conforms UML meta modeling
edges and nodes on Mi are represented by nodes on Mi+1
blows up graph size
Ric´s Approach
different interpretation of attributes depending
from meta level
requires "kind"-attributes to distinguish attributes and meta attriubtes
edges/nodes on Mi are represented as
edges/nodes on Mi+1
small graphs isomor-phic
to class diagram
GXL Tools
converters to/from GXL
• progress2gxl, gxl2progress (UAachen)
• g2gxl, gxl2g, gxl2sg, gxl2html (UKoblenz)
• gxl2rsf (Claudio Riva, Nokia)
• gxl2dot (Michal Young, UOregon)
• gxl2rsf, rsf2gxl (Jeff Michaud, UVictoria)
• gxl2ta, ta2gxl (UWaterloo)
GXL Tools: GXL2HTML
p :
v : e : refers
Proc
Var
file = "main.c"
line = 27
<?xml version="1.0"?>
<!DOCTYPE gxl SYSTEM "gxl.dtd">
<gxl><graph>
<node id = "p">
</node>
<node id = "v">
</node>
<edge
from = "p" to = "v">
</edge>
<graph></gxl>
id = "e"
<type xlink:href =
"schema.gxl#Proc"/>
<type xlink:href =
"schema.gxl#Var"/>
<type xlink:href =
"schema.gxl#refers"/>
<attr name = "file">
<string>main.c</string></attr>
<attr name = "line">
<int>27</int></attr>