Universität Koblenz-Landau Institut für Softwaretechnik Re-Group
Graph Exchange Language
Andreas Winter
joint work with
Ric Holt (University of Waterloo) Susan Elliott Sim (University of
Toronto)
Andy Schürr (Universität BW
(and many more)
Contents
Motivation and Idea GXL Overview
– Exchanging graphs with GXL – Exchanging schemas with GXL
GXL current work
– GXL Tools
Conclusion
extract:
parser and fact extractors for multi-language
systems, Ada, C/C++, Cobol, Java, SQL ...
abstract:
analysis techniques like querying, browsing, data flow analysis,
architecture recovery, cluster analysis ...
view:
visualization
charts, diagrams, graphs, tables, source code, ...
GXL Background
Tools in Software Reengineering
source code source
code extract extract
repository repository
abstract abstract
view view
History
GXL Partners
1 function main (){
...
8 a := max(a,b);
...
19 b := min(b,a);
...
}
GXL Example
typed nodes attributed nodes
attributed edges
ordered incidences directed
edges
typed
edges
Requirements of Exchange Formats (1)
Independence
– application independence
• language independence
(C/C++, Cobol, Java, JCL, SQL, multi-language etc.)
• abstraction level independence
(AST, "middle level", Architecture)
• aspect independence
(data flow, control flow, code structure, etc.)
– tool independence
• data structure independence
(syntax trees, various types of graphs, relational databases,
object oriented databases, file and directory structures)
Requirements of Exchange Formats (2)
Efficiency
– efficiency in time – efficiency in space
– efficiency in "building tools"
Extensibility
– extensible for further applications
(CASE tools, visualization tools, etc)
Universality
– used by others
– standardized format
GXL Objective
Exchanged Data
– instance data – schemas data
Mathematical Model
– typed, attributed, ordered, directed graphs – expanded by
• hypergraphs and hierarchical graphs
Notation
– eXtensible Markup Language (XML)
– Unified Modeling Language (UML)
GXL Graph Model
typed graphs
attributed graphs
directed graphs
ordered graphs hierarchical
graphs hyper- graphs
graph part
GXL Document Type Definition (1.0)
<!ENTITY % *-extension "" >
<!ENTITY % *-attr-extension "" >
<!ELEMENT gxl (graph* %gxl-extension; ) >
<!ATTLIST gxl xmlns:xlink CDATA #FIXED "www.w3.org/1999/xlink"
%gxl-attr-extension>
<!ELEMENT type EMPTY>
<!ATTLIST type xlink:type (simple) #FIXED "simple"
xlink:href CDATA #REQUIRED>
<!ELEMENT graph (type? , attr* , ( node | edge | rel )*
%graph-extension; ) >
<!ATTLIST graph id ID #REQUIRED role NMTOKEN #IMPLIED edgeids ( true | false ) "false"
hypergraph ( true | false ) "false"
edgemode ( directed | undirected |
defaultdirected | defaultundirected) "directed"
%graph-attr-extension;>
<!ELEMENT node (type? , attr*, graph* %node-extension; ) >
<!ATTLIST node id ID #REQUIRED %node-attr-extension;>
<!ELEMENT edge (type?, attr*, graph* edge-extension; ) >
<!ATTLIST edge id ID #IMPLIED from IDREF #REQUIRED to IDREF #REQUIRED fromorder CDATA #IMPLIED toorder CDATA #IMPLIED isdirected ( true | false ) #IMPLIED %edge-attr-extension;>
<!ELEMENT rel (type? , attr*, graph*, relend*
%rel-extension;) >
<!ATTLIST rel id ID #IMPLIED isdirected ( true | false ) #IMPLIED %rel-attr-extension;>
<!ELEMENT relend (attr* %relend-extension; ) >
<!ATTLIST relend target IDREF #REQUIRED role NMTOKEN #IMPLIED direction ( in | out | none ) #IMPLIED startorder CDATA #IMPLIED
endorder CDATA #IMPLIED %relend-attr-extension; >
<!ELEMENT attr (type?, attr*, (%val;)) >
<!ATTLIST attr id IDREF #IMPLIED name NMTOKEN #REQUIRED kind NMTOKEN #IMPLIED >
<!ENTITY % val " locator | bool | int | float | string | enum | seq | set | bag |tup %value-extension; ">
<!ELEMENT locator EMPTY >
<!ATTLIST locator xlink:type (simple) #FIXED "simple"
xlink:href CDATA #IMPLIED >
<!ELEMENT bool |int | float | string (#PCDATA) >
<!ELEMENT enum (#PCDATA) >
<!ELEMENT seq | set | bag | tup (%val;)* >
Exchanging Graphs with GXL
Attributed, typed, directed Graphs Undirected Graphs
Ordered Graphs Hypergraphs
Hierarchical Graphs
Exchanging Graphs with GXL
p :
v :
graph
r : typed
refs
Proc
Var attributed
file = "main.c"
line = 27
<gxl>
<graph id="example">
<type xlink:href = "schema.gxl"/>
<node id = "p">
</node>
<node id = "v">
</node>
<edge
from = "p" to = "v">
</edge>
<type xlink:href =
"schema.gxl#Proc"/>
<type xlink:href =
"schema.gxl#Var"/>
<type xlink:href =
"schema.gxl#refs"/>
<attr name = "file">
<string>main.c</string></attr>
<attr name = "line">
<int>27</int></attr>
id = "r"
Exchanging Schemas with GXL
Graph Schema Definition with UML Class Diagrams
– attributed, typed, directed, ordered graphs – hypergraphs
– hierarchical graphs
GXL Representation of class diagrams
GXL Metaschema
Exchanging Schemas with GXL
Graph Class
(UML class diagram)
Var
file : string
line : int line : int
refs
Proc
Var
file="main.c"
line = 27 line = 42
e : refs
Graph
(UML object diagram)
p : Proc
v :
Representing Schemas
• Schemas (graph classes) are represented as graphs as well
• Schemas are exchanged as GXL
documents suiting a metaschema for graph classes
• only one common and simple DTD for exchanging
– graphs matching different graph schemas
– graph classes matching a metaschema
GXL Schema Representation
UML class diagram
Var file:string
line : int line : int
Proc
refs
Proc:NodeClas s
name="Proc"
a1:Attribu te
name="file"
s : String
refs:
EdgeClass
name="refs"
var:NodeClass