390 likes | 502 Views
G raph E x change L anguage 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
E N D
Graph Exchange LanguageAn overview Ric HoltAndreas 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
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 Interoperability of Tools (examples)
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
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 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)
<!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) > <!ATTLISTgxl xmlns:xlink CDATA #FIXED "www.w3.org/1999/xlink"> <!ELEMENT type EMPTY> <!ATTLISTtype xlink:type (simple) #FIXED "simple" xlink:href CDATA #REQUIRED > <!ELEMENTgraph (%graph-extension; type? , attr* , ( node | edge | rel )*)> <!ATTLISTgraph id ID #REQUIRED edgeids ( true | false ) hypergraph ( true | false ) direction ( directed | undirected)> <!ELEMENTnode (%node-extension; type? , attr*, graph*, (%context;)*) > <!ATTLISTnode id ID #REQUIRED direction ( directed | undirected > <!ELEMENTin |out (%context-extension; attr*) > <!ATTLIST in |out ref IDREF #REQUIRED role NMTOKEN #IMPLIED > <!ELEMENTedge (%edge-extension; type? , attr*, graph*) > <!ATTLIST edge id ID #IMPLIED from IDREF #REQUIRED to IDREF #REQUIRED direction ( directed | undirected )> <!ELEMENTrel (%rel-extension; type? , attr*, graph*, (%link;)* ) > <!ATTLISTrel id ID #IMPLIED direction ( directed | undirected )> <!ELEMENTinlink | outlink (%link-extension; attr)* > <!ATTLIST inlink | outlink ref IDREF #REQUIRED role NMTOKEN #IMPLIED > <!ELEMENT attr (type?, attr*, (%val;)) > <!ATTLISTattr name NMTOKEN #REQUIRED kind NMTOKEN #IMPLIED > <!ELEMENTlocator EMPTY > <!ATTLIST locator xlink:type (simple) #FIXED xlink:href CDATA #IMPLIED > <!ELEMENTbool | int | float | string (#PCDATA) > <!ELEMENTseq | set | bag | tup (%val;)* > GXL Document Type Definition
<?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> graph typed attributed p : Proc <type xlink:href = "schema.gxl#Proc"/> <attr name = "file"> <string>main.c</string></attr> file = "main.c" <type xlink:href = "schema.gxl#Var"/> refers <attr name = "line"> <int>27</int></attr> v : Var <type xlink:href = "schema.gxl#refers"/> line = 27 Nodes, Edges and Attributes e : id = "e"
p : Proc file = "main.c" <edge id = "e" from = "p" to = "v"> <type xlink:href = "schema.gxl#refers"/> <attr name = "line"> <int>42</int> </attr> </edge> e : refers line = 42 v : Var line = 27 Attributed Edges
GXL Documents (DTD) <!ELEMENTgxl (%gxl-extension; graph) > <!ATTLISTgxl xmlns:xlink CDATA #FIXED "www.w3.org/1999/xlink"> <!ELEMENTgraph (%graph-extension; type? , attr* , ( node | edge | rel )*) > <!ATTLISTgraph id ID #REQUIRED edgeids ( true | false ) "false" hypergraph ( true | false ) "false" direction ( directed | undirected ) "directed" >
Nodes and Edges (DTD) <!ELEMENTnode (%node-extension; type? , attr*, graph*, (%context;)*) > <!ATTLISTnode id ID #REQUIRED direction (directed|undirected ) #IMPLIED> <!ELEMENTedge (%edge-extension; type? , attr*, graph*)> <!ATTLISTedge id ID #IMPLIED from IDREF #REQUIRED to IDREF #REQUIRED direction (directed|undirected ) #IMPLIED>
p : Proc file = "main.c" undirected edgein directed graph undirected graph <graph direction = "undirected" >... <edge id = "e" from = "p" to = "v"></edge>... </graph> <graph direction = "directed" >... <edge id = "e" direction = "undirected" from = "p" to = "v"></edge>... </graph> v : Var line = 27 Undirected Graphs edges are always noted as directedbut can be interpreted as undirected e :
p : Prog <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> authors = { Ric, Andy, Susan, Andreas } Complex Attributes GXL supports • set, • sequence, • bag, • tuple of • bool, • int, • float, • string, • complex values
Attributes (DTD) <!ENTITY % val " %value-extension; locator | bool | int | float | string | seq | set | bag | tup "> <!ELEMENTattr (type?, attr*, (%val;)) > <!ATTLISTattr name NMTOKEN #REQUIRED kind NMTOKEN #IMPLIED >
Attribute Values (DTD) <!ELEMENTlocator EMPTY > <!ATTLISTlocator xlink:type (simple) #FIXED "simple" xlink:href CDATA #IMPLIED > <!ELEMENTbool (#PCDATA) > <!ELEMENTint (#PCDATA) > <!ELEMENTfloat (#PCDATA) > <!ELEMENTstring (#PCDATA) > <!ELEMENTseq (%val;)* > <!ELEMENTset (%val;)* > <!ELEMENTbag (%val;)* > <!ELEMENTtup (%val;)* > pointers to external objects simple attributes complex attributes
p : b : a : <node id = "p" > e : </node> d : c : Ordering of Incidences {2} {1} {3} <in ref = "a" /> <in ref = "b" /> <out ref = "b" /> <in ref = "e" /> <out ref = "d" /> <in ref = "c" /> {4} {6} {5}
directed undirected v : V v : V "undirected"> theV theV theSecondU theSecondU <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> {1} {1} u : U u : U r : r : {2} {2} theFirstU theFirstU theW direction = "undirected"> theW w : W w : W Hypergraphs <node id = "u"> <in ref = "u" role = "theSecondU" /> <in ref = "u" role = "thefirstU" /> </node>
Hypergraphs (DTD) <!ELEMENTrel (%rel-extension; type? , attr*, graph*, (%link;)* ) > <!ATTLISTrel id ID #IMPLIED direction (directed | undirected) #IMPLIED>
Context and Link (DTD) Node Incidences <!ENTITY % context " in | out" > <!ELEMENTin | out (%context-extension; attr*) > <!ATTLISTin |outref IDREF #REQUIREDrole NMTOKEN #IMPLIED > Edge Incidences <!ENTITY % link " inlink | outlink" > <!ELEMENTinlink | outlink (%link-extension; attr)* > <!ATTLISTinlink | outlinkref IDREF #REQUIREDrole NMTOKEN #IMPLIED >
t : <graph> <node id = "v"/> <node id = "w"/> <edge id = "e" from = "v" to = "w"/> </graph> innergraph.xml e : v : w : <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 f : u : Support for Hierarchical Graphs by graph-valued attributes
t : e : v : w : <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 f : u : Support for Hierarchical Graphs Edges crossing hierarchies
t : e : <node id = "t"> </node> <node id = "u"/> <edge id = "f" from = "t" to = "u"/> v : w : f : u : Support for Hierarchical Graphs by nested graphs <graph> <node id = "v"/> <node id = "w"/> <edge id = "e" from = "v" to = "w"/> </graph>
t : e : <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"/> v : w : g : f : u : Support for Hierarchical Graphs Edges crossing hierarchies <edge id = "g" from = "u" to = "w"/>
<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> <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> Support for Graph Drawing layout data is represented as ordinary attribute
<!ENTITY % gxl-extension "FOO ," > <!ELEMENT FOO (#PCDATA)> <!ENTITY % basegxl SYSTEM "gxl.dtd"> %basegxl; GXL Extension by redefining entities by including GXL DTD (external entities) • 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 "" >
UML class diagram(schema) Proc file : string e : refers refers line = 42 line : int Var v : Var line : int ? Graph Schema UML object diagram(graph) p : Proc file="main.c" line = 27
schema graph :Nodetype : Attribute : Domain hasAttr hasDom name="Proc" name="file" name="string" from : Edgetype hasAttr name="refers" : Domain : Attribute hasDom to name="int" name="line" : Nodetype hasAttr name="Var" approach ? GXL Schema Representation UML class diagram Proc file:string refers line : int Var line : int
schema graph <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> Proc : file : string Proc file:string refers refers : line : int line : int Var Var : line : int line : int Ric´s approach ? GXL Schema Representation UML class diagram
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 Schema Representation
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)
<?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> <type xlink:href = "schema.gxl#Proc"/> <attr name = "file"> <string>main.c</string></attr> <type xlink:href = "schema.gxl#Var"/> <attr name = "line"> <int>27</int></attr> id = "e" <type xlink:href = "schema.gxl#refers"/> GXL Tools: GXL2HTML p : Proc file = "main.c" e : refers v : Var line = 27
Conclusion GXL offers a standard exchange language for • directed and undirected • typed • attributed • graphs and hypergraphs GXL offers a standard exchange language in • Software Reengineering • Graph Transformation • Graph Drawing more information • http://www.gupro.de/GXL
Upcoming Events • Workshop "Practical Data Interchange Issues with GXL" (after lunch) • Workshop "Exchange Formats" (WCRE 2000) • Dagstuhl Seminar "Interoperability of Reengineering Tools" • APPLIGRAPH Meeting "Exchange Formats for Graph Transformation" • WoSEF 2001 ???