Top Banner
WOSEF 2000 Universität Koblenz-Landau Institut für Softwaretechnik GUPRO Limerick, 6.6.2000 ( 1) Components of Interchange Formats (Metaschemas and Typed Graphs) Andreas Winter presented by
36

Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

Mar 27, 2015

Download

Documents

Tyler Harrison
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

WOSEF 2000

Universität Koblenz-LandauInstitut für SoftwaretechnikGUPRO

Limerick, 6.6.2000 (1)

Components of Interchange Formats

(Metaschemas and Typed Graphs)

Andreas Winter

presented by

Page 2: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (2)

Included Papers

M. van den Brand, H. de Jong, P. Olivier: A Common Exchange Format for Reengineering Tools based on ATerms

M. W. Godfrey: Practical Data Exchange for Reverse Reengineering Frameworks: Some Requirements, Some Experiences, Some Headaches

J. Ebert, B. Kullbach, A. Winter: GraX - Graph Exchange Format

Page 3: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (3)

Contents

• Components of Interchange Formats– Structure – Format– Data Access– Transformation– Metaschema

• Approaches to Interchange Formats– ATerms (efficient Annotated TERMS)– TAXForm (TA eXchange FORMAT)– GraX / GXL (Graph eXchange Language)

• Conclusion

Page 4: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (4)

Structure

Problem– various structures are used in current tools

• Abstract Syntax Trees: ATerms, ...• Graphs: Datrix-TA, TA, TGraphs, PROGRES, RSF, ...• Relations: relational Databases, RPA, ...

Requirements – exchange of data requires a common

superset, enclosing these structures

Proposed Solutions– terms– directed, typed, attributed graphs

Page 5: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (5)

Format

Problem– Programming Languages

• single language systems (Cobol, C, C++, ...)• multi language systems

– Level of Abstraction• AST level• architectural level

Requirements– adaptable and extensible interchange format

Proposed Solutions– exchange of schema data and– exchange of instance data

Page 6: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (6)

Data Access

Problem– large amount of data– import from/export to various tools

Requirements– efficient and standardized access to

interchanged data

Proposed Solutions– application programming interface– set of standardized, predefined tools

Page 7: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (7)

Transformation

Problem– different tasks require different

representations– seamless data exchange between different

representations

Requirements– efficient transformation between different

representations

Proposed Solutions– set of (reference) schemata and definition of

transformation between them

Page 8: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (8)

Metaschema

Problem– mechanism to describe schema information

for different applications– foundation to define schema

transformations

Requirements– common mechanism for describing

schemata

Proposed Solutions– metaschema (UML class diagram)

Page 9: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (9)

Efficient Annotated Terms (ATerms)

M. G. J. van den Brand,H. A. de Jong,P. Klint, P. Olivier, et al.

Approach– exchange format for tree-like data structures

like parse trees, abstract syntax trees, generated code, formatted source text

– comprehensive procedural interface for manipulation in C and Java

Page 10: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (10)

ATerm Grammar (SDF) ATerm -> ATerms

ATerm "," Aterms -> ATerms

"[" "]" -> ATermList

"[" ATerms "]" -> ATermList

AInt -> AFun

Literal -> AFun

ATermList -> ATerm

AFun -> ATerm

AFun "(" ATerms ")" -> ATerm

"{" ATerms "}" -> Annotation

ATermList Annotation -> ATerm

AFun Annotation -> ATerm

AFun "(" ATerms ")"

Annotation -> ATerm

ATerms - Structure

• Software systems are represented by annotated Terms

ATerm Grammar (EBNF)ATerm ::= AFun

["(" ATerms ")"]

[Annotation]

| "[" [ATerms] "]"

[Annotation]

ATerms ::= ATerm ("," ATerm)*

AFun ::= AInt | Literal

Annotation ::= "{" ATerms "}"

ATerm Examplesconstants : abcnumerals : 42literals : "asdf"lists : [], [1, "abc" 2], [1, 2, [3, 4]]

functions : f("a"), g(1,[])

annotations : f("a") {"remark"}

Page 11: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (11)

ATerms - Format

Instance Level– focuses (only) on tree like structures– Notation

• terms over variables, constants and a given set of function symbols

Schema Level– schemata implicitly represented

• defined by an appropriate set of functions e.g. for representing abstract syntax trees (AsFix)

• further schema information can be represented by annotations with ATerms

Page 12: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (12)

ATerms - Example (1)

AsFix (ASF+SDF Fixed Format)– parse tree format for ASF/SDF

• SDF (Syntax Definition Formalism)• ASF (Algebraic Specification Formalism)

– each term represents a parse tree including• syntax rules• original layout• comments

– AsFix representation is self-contained• term includes all grammar information

needed for interpretation

Page 13: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (13)

ATerms - Example (2)

AsFiX Functions– prod(T) : production rule

– appl(T1,T2) : applying production rule T1 to arguments T2

– l(T) : literal T– sort(T) : sort T – w(T) : white space T – attr(T) : single attribute– attrs(T) : lost of attributes– no-attrs : empty list of attributes

Page 14: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (14)

ATerms - Example (3)

Grammar (SDF)true -> Bool

false -> Bool

Bool or Bool -> Bool {left}

true or false

false

Bool

true

Bool or

Bool

AsFix Termappl(

prod([sort("Bool"),l("or"),sort("Bool")],sort("Bool"),

attrs([attr("left")])),

[appl(prod([l("true")],sort("Bool"),no-attrs)

[l("true")]),

w(" "), l("or"), w(" "),

[appl(prod([l("false")],sort("Bool"),no-attrs)

[l("false")])])

Page 15: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (15)

ATerms - Data Access

ATerms API– Making and Matching ATerms (4)

• make new ATerms• match ATerms• compare ATerms

– Reading and Writing ATerms (6) • write/read ATerms to/from text files• write/read ATerms to/from binary files• write/read ATerms to/from strings

– Annotating ATerms (3) • set/get/remove annotations

Page 16: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (16)

TA Exchange Format (TAXForm)

I. T. Bowman,M. W. Godfrey,R. C. Holt, et al.

Approach– exchange format for graph-like structures

based on TA (Tuple Attribute Language)– efficient transformation between different

graph-like structures

Page 17: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (17)

main.cfunction P {

q();T1 v;x = v++;

}

42127225

function Q {T2 w;z = w;

}

27316

test.c

Proc

File : string

Var

Line : int

Ref

Call

Line : int

Line : int

schema

TAXForm - Structure• Software systems are represented by

directed, attributed, typed graphs

File = "main.c"

P Proc

Line = 127

v Var

Line = 27

w Var

File = "test.c"

Q Proc

Line =42

Line =316

Line =225Ref

Call

Ref

typed graph

Page 18: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (18)

TAXForm - Level of Abstraction

AST Level Architectural Level

top level subsystems of LINUX kernel

Datrix AST for C++ statement

local_var = global_var * param

Page 19: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (19)

TAXForm - Format

Instance Level– focuses on arbitrary graph-like structures

• on AST level• on architectural level

– notation: • fact tuples and fact attributes

Schema Level– schemata explicitly represented– notation:

• schema tuples and schema attributes

Page 20: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (20)

TAXForm - Example (1)FACT TUPLE$INSTANCE P Proc$INSTANCE Q Proc$INSTANCE v Var$INSTANCE w VarCall P QRef P vRef Q w

FACT ATTRIBUTEP {File = "main.c"}Q {File = "test.c"}v {Line = 127}w {Line = 27}(Call P Q){Line = 42}(Ref P v){Line = 225}(Ref q w){Line = 316}

File = "main.c"

P Proc

Line = 127

v Var

Line = 27

w Var

File = "test.c"

Q Proc

Line =42

Line =316

Line =225Ref

Call

Ref

instance level

Page 21: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (21)

TAXForm - Example (2)

SCHEMA TUPLECall Proc ProcRef Proc Var

SCHEME ATTRIBUTEProc {File}Var {Line}(Call) {Line}(Ref) {Line}

Proc

File : string

Var

Line : int

Ref

Call

Line : int

Line : int

schema level

Page 22: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (22)

•TAXForm Utopia:–Transformation between schemata

TAXForm - Transformation (1)

• lots of different schemas were defined for various purposes (e.g. on architectural level)

Universal

High-Level

Procedural

PL/I C

Object-Oriented

C++ Java

Dali C Rigi CPBS C

Page 23: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (23)

• TAXForm offers a fixed set of schema transformations e.g.

TAXForm - Transformation (2)

• Work to do:– very general schema transformation mechanism

SourceFile

usesfile

Data Type

defines

Procedure Data

definesdefines

usestype

usesdata

defines defines

usesprocedure

uses type

Module

depends-on

Subsystemcontains

contains

$ENTITY

$RELATION

universalschema

high-levelschema

procedurallanguage schema

Page 24: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (24)

Graph Exchange Language (GXL)

J. Ebert,R. C. Holt,B. Kullbach,A. Schürr,A. Winter

Approach– XML exchange format for graph-like

structures based on TA and TGraphs– metamodel for defining schemata

joint graph exchange format GraX, TA, PROGRES,

RSF, RPA

Page 25: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (25)

GXL - Structure

Software systems are represented by•ordered,•directed,•attributed,•typed graphs

AST Level

Page 26: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (26)

GXL - Structure

Software systems are represented by•ordered,•directed,•attributed,•typed graphs

architectural Level

Page 27: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (27)

GXL - Foundation

Instance Level– focuses on arbitrary graph-like structures

• on AST level• on architectural level

– notation:• XML document

Schema Level– schemata explicitly represented– notation:

• XML document

Page 28: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (28)

GXL - Document Type Definition

• Exchange of instance and schema data by attributed graphs

• XML based markup language for representing attributed graphs

GXL DTD (simplified)

<!ELEMENT gxl (node | edge)* >

<!ATTLIST gxl schema CDATA #REQUIRED identifiededges (true|false) #REQUIRED >

<!ELEMENT node (attr)* >

<!ATTLIST node id ID #REQUIRED type CDATA #IMPLIED edgeorder IDREFS #IMPLIED >

<!ELEMENT edge (attr)* >

<!ATTLIST edge id ID #IMPLIED type CDATA #IMPLIED begin IDREF #REQUIRED end IDREF #REQUIRED >

<!ELEMENT attr EMPTY >

<!ATTLIST attr name CDATA #REQUIRED value CDATA #IMPLIED >

Page 29: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (29)

GXL Example (1)

instance level

File = "main.c"

P Proc

Line = 127

v Var

Line = 27

w Var

File = "test.c"

Q Proc

Line = 42

Line =316

Line = 225Ref

Call

Ref

<gxl><node id="P" type="Proc"> <attr name="File" value="main.c" /> </node> <node id="Q" type="Proc"> <attr name="File" value="test.c" /> </node> <node id="v" type="Var"> <attr name="Line" value="127" /> </node> <node id="w" type="Var"> <attr name="Line" value="27" /> </node> <edge begin="P" end="Q" type="Call"> <attr name="Line" value="42" /> </edge><edge begin="P" end="v" type="Ref"> <attr name="Line" value="225" /></edge> <edge begin="Q" end="w" type="Ref"> <attr name="Line" value="316" /> </edge></gxl>

Page 30: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (30)

GXL - Example (2)

Proc

File : string

Var

Line : int

Ref

Call

Line : int

Line : int

schema level<?xml version="1.0" ?>

<!DOCTYPE grax SYSTEM "gxl042.dtd">

<gxl schema = "meta.1.0.scx">

<node id = "v1" type = "EntityType">

<attr name = "name" value = "Proc"/>

</node>

<node id = "v2" type = "EntityType">

<attr name = "name" value = "Var"/>

...

<node id = "v3" type = "RelationshipType">

<attr name = "name" value = "s"/>

</node>

...

<edge id = "e1" type = "comesFrom">

begin = "v3" end = "v1">

</edge>

<edge id = "e2" type = "goesTo"

begin = "v3" end = "v2">

</edge>

...

</gxl>

Page 31: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (31)

GXL - Metaschema (1)

Page 32: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (32)

GXL - Metaschema (2)

with attribute structure

Page 33: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (33)

GXL - Data Access

GXL Tools– parsers

• parse GXL instance and schema data

– filters• transfer GXL documents into

TA, TGraphs, PROGRES, RSF, RPA, ...• transfer TA, TGraphs, PROGRES, RSF, RPA, ...

into GXL documents

– checkers• check if instance matches ist schema

– helpers• recover schema information

Page 34: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (34)

Comparison

ATerms TAXFORM GXL

Format Schema and Instance

StructureTerms

(AST)

directed, attributed, typed

Graphs

Data Access API suitable Tools

MetaschemaUML Class

Diagram

TransformationTransformation

Tools

Page 35: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (35)

Conclusion

Agreement– exchange of schema and instance data– by directed, attributed, typed graphs– with a XML-language– based on a common Metamodel

Extensions– consideration of hierarchical graphs,

hypergraphs, and graph transformation rules

Work to do– definition of a suitable API– definition of a set of tools– definition of powerful schema transformation

Page 36: Universität Koblenz-Landau Institut für Softwaretechnik GUPRO WOSEF 2000Limerick, 6.6.2000 (1) Components of Interchange Formats (Metaschemas and Typed.

© Institut für Softwaretechnik Universität Koblenz-Landau

Limerick, 6.6.2000 (36)

GXL

• Report: – R. C. Holt, A. Schürr, A. Winter:

GXL: Toward a Standard Exchange Format,Fachberichte Informatik, Uni Koblenz http://www.gupro.de/techreports/RR-1-2000

• URL: (coming soon)

– http://www.gupro.de/GXL

you are all invited to participate in the further development of

GXL