24.02.2013 Views

How to Analyze Graph-Based Models - Www-st.inf.tu-dresden.de ...

How to Analyze Graph-Based Models - Www-st.inf.tu-dresden.de ...

How to Analyze Graph-Based Models - Www-st.inf.tu-dresden.de ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<<strong>st</strong>rong>How</<strong>st</strong>rong> <<strong>st</strong>rong>to</<strong>st</strong>rong> <<strong>st</strong>rong>Analyze</<strong>st</strong>rong> <<strong>st</strong>rong>Graph</<strong>st</strong>rong>-<<strong>st</strong>rong>Based</<strong>st</strong>rong> <<strong>st</strong>rong>Mo<strong>de</strong>ls</<strong>st</strong>rong><br />

Prof. Dr. U. Aßmann<br />

Technische Universität Dres<strong>de</strong>n<br />

In<strong>st</strong>i<strong>tu</strong>t für Software- und Multimediatechnik<br />

Gruppe Softwaretechnologie<br />

http://www-<strong>st</strong>.<strong>inf</strong>.<strong>tu</strong>-<strong>dres<strong>de</strong>n</strong>.<strong>de</strong><br />

Softwaretechnologie II, © Prof. Uwe Aßmann<br />

1


Contents<br />

► Different kinds of relations: Li<strong>st</strong>s, Trees, Dags, <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s<br />

► Treating graph-based mo<strong>de</strong>ls – The graph-logic isomorphism<br />

► Analysis, querying, searching graph-based mo<strong>de</strong>ls<br />

♦ The Same Generation Problem<br />

♦ Datalog and EARS<br />

♦ Transitive Closure<br />

► Consi<strong>st</strong>ency checking of graph-based specifications<br />

■ Projections of graphs<br />

■ Transformation of graphs<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

2


Obliga<<strong>st</strong>rong>to</<strong>st</strong>rong>ry Reading<br />

► Jazayeri Chap 3<br />

► If you have Macasziek or Pfleeger, read the lec<strong>tu</strong>re sli<strong>de</strong>s carefully<br />

and do the exercise sheets<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

3


References<br />

► S. Ceri, G. Gottlob, L. Tanca. What You Always Wanted <<strong>st</strong>rong>to</<strong>st</strong>rong> Know<br />

About Datalog (And Never Dared <<strong>st</strong>rong>to</<strong>st</strong>rong> Ask). IEEE Transactions on<br />

Knowledge And Data Engineering. March 1989, (1) 1, pp. 146-166.<br />

► S. Ceri, G. Gottlob, L. Tanca. Logic Programming and Databases.<br />

Springer, 1989.<br />

► Ullman, J. D. Principles of Database and Knowledge Base Sy<strong>st</strong>ems.<br />

Computer Science Press 1989.<br />

► Preprints available on my home page:<br />

■ U. Aßmann. <<strong>st</strong>rong>Graph</<strong>st</strong>rong> Rewrite Sy<strong>st</strong>ems for Program Optimization. ACM<br />

Transactions on Programming Languages and Sy<strong>st</strong>ems, June 2000.<br />

■ U. Aßmann. OPTIMIX, A Tool for Rewriting and Optimizing Programs.<br />

<<strong>st</strong>rong>Graph</<strong>st</strong>rong> Grammar Handbook, Vol. II, 1999. Chapman&Hall.<br />

■ U. Aßmann. Reuse in Semantic Applications. REWERSE Summer<br />

School. July 2005. Malta. LNCS, Springer.<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

4


Goals<br />

► Un<strong>de</strong>r<strong>st</strong>and that software mo<strong>de</strong>ls can become very large<br />

► Un<strong>de</strong>r<strong>st</strong>and the need for appropriate techniques <<strong>st</strong>rong>to</<strong>st</strong>rong> handle large<br />

mo<strong>de</strong>ls<br />

■ in hand <strong>de</strong>velopment<br />

■ au<<strong>st</strong>rong>to</<strong>st</strong>rong>matic analysis of the mo<strong>de</strong>ls<br />

► Learn how <<strong>st</strong>rong>to</<strong>st</strong>rong> use graph-based techniques (Datalog, Description<br />

Logic, EARS, graph transformations) <<strong>st</strong>rong>to</<strong>st</strong>rong> analyze and check mo<strong>de</strong>ls<br />

► Un<strong>de</strong>r<strong>st</strong>and some basic concepts of simplicity in software mo<strong>de</strong>ls<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

5


Motivation<br />

► Software engineers mu<strong>st</strong> be able <<strong>st</strong>rong>to</<strong>st</strong>rong><br />

■ handle big <strong>de</strong>sign specifications (<strong>de</strong>sign mo<strong>de</strong>ls) during <strong>de</strong>velopment<br />

■ work with consi<strong>st</strong>ent mo<strong>de</strong>ls<br />

■ measure mo<strong>de</strong>ls and implementations<br />

■ validate mo<strong>de</strong>ls and implementations<br />

► Real mo<strong>de</strong>ls and sy<strong>st</strong>ems become very complex<br />

► Mo<strong>st</strong> specifications are graph-based<br />

■ We have <<strong>st</strong>rong>to</<strong>st</strong>rong> <strong>de</strong>al with basic graph theory <<strong>st</strong>rong>to</<strong>st</strong>rong> be able <<strong>st</strong>rong>to</<strong>st</strong>rong> measure well<br />

► Every analysis method is very welcome<br />

► Every <strong>st</strong>ruc<strong>tu</strong>ring method is very welcome<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

6


The Problem:<br />

<<strong>st</strong>rong>How</<strong>st</strong>rong> <<strong>st</strong>rong>to</<strong>st</strong>rong> Ma<strong>st</strong>er Large <<strong>st</strong>rong>Mo<strong>de</strong>ls</<strong>st</strong>rong><br />

► Large mo<strong>de</strong>ls have large graphs<br />

► They can be hard <<strong>st</strong>rong>to</<strong>st</strong>rong> un<strong>de</strong>r<strong>st</strong>and<br />

► Figures taken from Goose Reengineering Tool, analysing a Java<br />

class sy<strong>st</strong>em [Goose, FZI Karlsruhe]<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

7


Prof. Uwe Aßmann, Softwaretechnologie II<br />

8


Partially Collapsed<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

9


Totally Collapsed<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

10


Requirements for Mo<strong>de</strong>lling in Requirements and<br />

Design<br />

► We need gui<strong>de</strong>lines how <<strong>st</strong>rong>to</<strong>st</strong>rong> <strong>de</strong>velop simple mo<strong>de</strong>ls<br />

► We need analysis techniques <<strong>st</strong>rong>to</<strong>st</strong>rong><br />

■ Check the consi<strong>st</strong>ency of the mo<strong>de</strong>ls<br />

■ Find out about their complexity<br />

■ Find out about simplifications<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

11


Some Relationships (<<strong>st</strong>rong>Graph</<strong>st</strong>rong>s) in<br />

Software Sy<strong>st</strong>ems<br />

Softwaretechnologie II, © Prof. Uwe Aßmann<br />

12


Example: Rename Refac<<strong>st</strong>rong>to</<strong>st</strong>rong>rings in Programs<br />

<<strong>st</strong>rong>How</<strong>st</strong>rong> <<strong>st</strong>rong>to</<strong>st</strong>rong> change the name of variable Foo and keep the program consi<strong>st</strong>ent?<br />

Refac<<strong>st</strong>rong>to</<strong>st</strong>rong>r the name Person <<strong>st</strong>rong>to</<strong>st</strong>rong> Human:<br />

class Person { .. }<br />

class Course {<br />

}<br />

Person teacher = new Person(“Jim”);<br />

Person <strong>st</strong>u<strong>de</strong>nt = new Person(“John”);<br />

class Human { .. }<br />

class Course {<br />

}<br />

Human teacher = new Human(“Jim”);<br />

Human <strong>st</strong>u<strong>de</strong>nt = new Human(“John”);<br />

Definition<br />

Reference (Use)<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

13


Definition-Use <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s (Def-Use <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s)<br />

► Every language and notation has<br />

■ Definitions of items (also the variable Foo)<br />

■ Uses of items (references <<strong>st</strong>rong>to</<strong>st</strong>rong> Foo)<br />

► This is because we talk in specifications about names of objects and<br />

their use<br />

■ Definitions are done in a data <strong>de</strong>finition language (DDL)<br />

■ Uses are part of a data manipulation language (DML)<br />

► Starting from the ab<strong>st</strong>ract syntax, the name analysis finds out about<br />

the <strong>de</strong>finitions, uses, and their relations (the Def-Use graph)<br />

■ Def-Use graphs exi<strong>st</strong> in every language!<br />

■ <<strong>st</strong>rong>How</<strong>st</strong>rong> <<strong>st</strong>rong>to</<strong>st</strong>rong> specify the name analysis, i.e., the <strong>de</strong>f-use graph?<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

14


Refac<<strong>st</strong>rong>to</<strong>st</strong>rong>ring on Def-Use <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s<br />

► For renaming of a <strong>de</strong>finition, all uses have <<strong>st</strong>rong>to</<strong>st</strong>rong> be changed, <<strong>st</strong>rong>to</<strong>st</strong>rong>o<br />

■ We need <<strong>st</strong>rong>to</<strong>st</strong>rong> trace all uses of a <strong>de</strong>finition in the Def-Use-graph<br />

■ Refac<<strong>st</strong>rong>to</<strong>st</strong>rong>ring works always on Def-Use-graphs<br />

► Refac<<strong>st</strong>rong>to</<strong>st</strong>rong>ring works always in the same way:<br />

■ Change a <strong>de</strong>finition<br />

■ Find all <strong>de</strong>pen<strong>de</strong>nt references<br />

■ Change them<br />

■ Recurse handling other <strong>de</strong>pen<strong>de</strong>nt <strong>de</strong>finitions<br />

► Refac<<strong>st</strong>rong>to</<strong>st</strong>rong>ring can be supported by <<strong>st</strong>rong>to</<strong>st</strong>rong>ols<br />

■ The Def-Use-graph forms the basis of refac<<strong>st</strong>rong>to</<strong>st</strong>rong>ring <<strong>st</strong>rong>to</<strong>st</strong>rong>ols<br />

► <<strong>st</strong>rong>How</<strong>st</strong>rong>ever, building the Def-Use-<<strong>st</strong>rong>Graph</<strong>st</strong>rong> for a complete program co<strong>st</strong>s a<br />

lot of space and is a difficult program analysis task<br />

■ Every method that <strong>st</strong>ruc<strong>tu</strong>res the Def-Use-<<strong>st</strong>rong>Graph</<strong>st</strong>rong> benefits immediately the<br />

refac<<strong>st</strong>rong>to</<strong>st</strong>rong>ring<br />

■ either simplifying or accelerating it<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

15


Control-Flow <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s<br />

► Describe the control flow in a program<br />

► Typically, if <strong>st</strong>atements and switch <strong>st</strong>atements split control flow<br />

► Their ends join control flow<br />

► Ne<strong>st</strong>ed loops are <strong>de</strong>scribed by ne<strong>st</strong>ed control flow graphs<br />

a+=5;<br />

print a<br />

if<br />

re<strong>tu</strong>rn<br />

while<br />

print a++<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

16


Data-Flow <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s<br />

► Describe the flow of data through the variables<br />

a=a+5;<br />

print a<br />

a=0<br />

if<br />

b=a<br />

while<br />

print a++<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

17


Simple (Flow-Insensitive) Call <<strong>st</strong>rong>Graph</<strong>st</strong>rong><br />

► Describe the call relationship between the procedures<br />

main = procedure () {<br />

array int[] a = read();<br />

print(a);<br />

quicksort(a);<br />

print(a);<br />

}<br />

quicksort = procedure(a: array[0..n]) {<br />

int pivot = searchPivot(a);<br />

quicksort(a[0], a[pivot-1]);<br />

quicksort(a[pivot+1,n]);<br />

}<br />

read<br />

print<br />

searchPivot<br />

main<br />

quicksort<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

18


Precise Call <<strong>st</strong>rong>Graph</<strong>st</strong>rong><br />

► Describe the call relationship between the procedures including call<br />

sites<br />

read<br />

1<br />

print<br />

main<br />

2<br />

1<br />

quicksort<br />

searchPivot<br />

2<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

19


UML <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s<br />

► All diagram sublanguages of UML are graphs<br />

► They can be analyzed and checked with graph techniques<br />

► Hence, graph techniques are an essential <<strong>st</strong>rong>to</<strong>st</strong>rong>ol of the software<br />

engineer<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

20


Types of <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s in Specifications<br />

Li<strong>st</strong>s, Trees, Dags, <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s<br />

[not presented, only for completeness]<br />

Softwaretechnologie II, © Prof. Uwe Aßmann<br />

21


Mo<strong>de</strong>lling <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s on Two Ab<strong>st</strong>raction Levels<br />

► We <strong>de</strong>al here mo<strong>st</strong>ly with directed graphs (digraphs)<br />

■ li<strong>st</strong>s, trees, dags, (di-)graphs<br />

► There are two different ab<strong>st</strong>raction levels; we are intere<strong>st</strong>ed in the<br />

logical level:<br />

► Logical level (ab<strong>st</strong>ract, often <strong>de</strong>clarative, problem oriented)<br />

■ Data type Li<strong>st</strong>, Tree, Dag, <<strong>st</strong>rong>Graph</<strong>st</strong>rong><br />

■ Methods <<strong>st</strong>rong>to</<strong>st</strong>rong> handle graphs:<br />

♦ Relational algebra<br />

♦ Datalog<br />

♦ Description logic<br />

♦ <<strong>st</strong>rong>Graph</<strong>st</strong>rong> rewriting<br />

♦ <<strong>st</strong>rong>Graph</<strong>st</strong>rong> grammars<br />

♦ Recursion schemas<br />

► Physical level (concrete, often imperative, machine oriented)<br />

■ Data type adjacency li<strong>st</strong>, boolean (bit)matrix,<br />

■ Imperative algorithms<br />

■ Pointer based algorithms<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

22


Definitions<br />

► Fan-in<br />

■ In-<strong>de</strong>gree of no<strong>de</strong> un<strong>de</strong>r a certain relation<br />

■ Fan-in(n = 0): n is root no<strong>de</strong> (source)<br />

■ Fan-in(n) > 0: n is reachable from other no<strong>de</strong>s<br />

► Fan-out<br />

► Path<br />

■ Out-<strong>de</strong>gree of no<strong>de</strong> un<strong>de</strong>r a certain relation<br />

■ Fan-out(n) = 0: n is leaf no<strong>de</strong> (sink)<br />

■ An inner no<strong>de</strong> is neither a root nor a leaf<br />

■ A path p = (n 1, n 2,…,n k) is a sequence of no<strong>de</strong>s of length k<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

23


Li<strong>st</strong>s<br />

► One source (root)<br />

► One sink<br />

► Every other no<strong>de</strong> has fan-in 1,<br />

fan-out 1<br />

► Represents a <<strong>st</strong>rong>to</<strong>st</strong>rong>tal or<strong>de</strong>r<br />

(sequentialization)<br />

► Gives<br />

Prioritization<br />

Execution or<strong>de</strong>r<br />

root<br />

sink<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

24


Trees<br />

► One source (root)<br />

► Many sinks (leaves)<br />

► Every no<strong>de</strong> has fan-in


Directed Acyclic <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s<br />

► Many sources<br />

■ A jungle (term graph) is a dag<br />

with one root<br />

► Many sinks<br />

► Fan-in, fan-out arbitrary<br />

► Represents a partial or<strong>de</strong>r<br />

■ Less con<strong>st</strong>raints that in a <<strong>st</strong>rong>to</<strong>st</strong>rong>tal<br />

or<strong>de</strong>r<br />

► Weaker hierarchical ab<strong>st</strong>raction<br />

fea<strong>tu</strong>re<br />

■ Can be layered<br />

► Example<br />

■ UML inheritance dags<br />

.......<br />

.......<br />

sinks<br />

roots<br />

.......<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

26


Directed <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s (Digraphs)<br />

► Many roots<br />

■ A digraph with one source is<br />

called flow graph<br />

► Many sinks<br />

► Backedges and cycles<br />

► Wor<strong>st</strong> <strong>st</strong>ruc<strong>tu</strong>re<br />

► Example<br />

■ Many diagrammatic methods in<br />

Software Engineering<br />

■ UML class diagrams<br />

■ SA data flow diagrams<br />

.......<br />

.......<br />

sinks<br />

roots<br />

.......<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

27


Skele<<strong>st</strong>rong>to</<strong>st</strong>rong>n Trees (Trees with Secondary <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s)<br />

► Skele<<strong>st</strong>rong>to</<strong>st</strong>rong>n tree with links<br />

► Links are a secondary <strong>st</strong>ruc<strong>tu</strong>re<br />

■ Secondary relation is<br />

overlaid and is “less<br />

important”<br />

► Advantage<br />

■ Tree can be used as a<br />

concep<strong>tu</strong>al hierarchy<br />

■ References <<strong>st</strong>rong>to</<strong>st</strong>rong> other parts are<br />

possible<br />

► Example<br />

■ XML, e.g., XHTML<br />

■ Struc<strong>tu</strong>re is <strong>de</strong>scribed by<br />

Xschema/DTD, links form the<br />

secondary relations<br />

.......<br />

.......<br />

sinks<br />

roots<br />

.......<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

28


Reducible <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s (<<strong>st</strong>rong>Graph</<strong>st</strong>rong>s with Skele<<strong>st</strong>rong>to</<strong>st</strong>rong>n Trees)<br />

► <<strong>st</strong>rong>Graph</<strong>st</strong>rong> with cycles, however,<br />

only between si<strong>st</strong>ers<br />

■ No cycles between hierarchy<br />

levels<br />

► <<strong>st</strong>rong>Graph</<strong>st</strong>rong> can be “reduced” <<strong>st</strong>rong>to</<strong>st</strong>rong> one<br />

no<strong>de</strong><br />

► Advantage<br />

■ Tree can be used as a<br />

concep<strong>tu</strong>al hierarchy<br />

► Example<br />

■ UML <strong>st</strong>atecharts<br />

.......<br />

.......<br />

.......<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

29


Layerable <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s (<<strong>st</strong>rong>Graph</<strong>st</strong>rong>s with Skele<<strong>st</strong>rong>to</<strong>st</strong>rong>n Dags)<br />

► Like reducible graphs, however,<br />

sharing between different parts<br />

of the skele<<strong>st</strong>rong>to</<strong>st</strong>rong>n trees<br />

■ <<strong>st</strong>rong>Graph</<strong>st</strong>rong> cannot be “reduced”<br />

<<strong>st</strong>rong>to</<strong>st</strong>rong> one no<strong>de</strong><br />

► Advantage<br />

■ Skele<<strong>st</strong>rong>to</<strong>st</strong>rong>n can be used <<strong>st</strong>rong>to</<strong>st</strong>rong> layer<br />

the graph<br />

■ Cycles only within one layer<br />

► Example<br />

■ Layered sy<strong>st</strong>em architec<strong>tu</strong>res<br />

.......<br />

.......<br />

.......<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

30


Strength of Assertions in <<strong>st</strong>rong>Mo<strong>de</strong>ls</<strong>st</strong>rong><br />

Li<strong>st</strong>: <strong>st</strong>rong assertion: <<strong>st</strong>rong>to</<strong>st</strong>rong>tal or<strong>de</strong>r<br />

Tree: <strong>st</strong>ill ab<strong>st</strong>raction possible<br />

Dag: <strong>st</strong>ill layering possible<br />

<<strong>st</strong>rong>Graph</<strong>st</strong>rong>: the wor<strong>st</strong> case<br />

Sequential<br />

Hierarchies<br />

Partial or<strong>de</strong>r<br />

Layered<br />

Un<strong>st</strong>ruc<strong>tu</strong>red<br />

Ease of<br />

Un<strong>de</strong>r<strong>st</strong>anding<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

31


Strength of Assertions in <<strong>st</strong>rong>Mo<strong>de</strong>ls</<strong>st</strong>rong><br />

► Saying that a relation is<br />

■ A li<strong>st</strong>: very <strong>st</strong>rong assertion, <<strong>st</strong>rong>to</<strong>st</strong>rong>tal or<strong>de</strong>r!<br />

■ A tree: <strong>st</strong>ill a <strong>st</strong>rong assertion: hierarchies possible, easy <<strong>st</strong>rong>to</<strong>st</strong>rong> think<br />

■ A dag: <strong>st</strong>ill layering possible, <strong>st</strong>ill a partial or<strong>de</strong>r<br />

■ A graph: hopefully, some <strong>st</strong>ruc<strong>tu</strong>ring or analysis is possible. Otherwise,<br />

it’s the wor<strong>st</strong> case<br />

► And those propositions hold for every kind of diagram in Software<br />

Engineering!<br />

► Try <<strong>st</strong>rong>to</<strong>st</strong>rong> achieve dags, trees, or li<strong>st</strong>s in your specifications, mo<strong>de</strong>ls,<br />

and <strong>de</strong>signs<br />

■ Sy<strong>st</strong>ems will be easier, more efficient<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

32


Struc<strong>tu</strong>ring Improves Wor<strong>st</strong> Case<br />

Li<strong>st</strong>: <strong>st</strong>rong assertion: <<strong>st</strong>rong>to</<strong>st</strong>rong>tal or<strong>de</strong>r<br />

Tree: <strong>st</strong>ill ab<strong>st</strong>raction possible<br />

Dag: <strong>st</strong>ill layering possible<br />

Struc<strong>tu</strong>red graph<br />

<<strong>st</strong>rong>Graph</<strong>st</strong>rong> with analyzed fea<strong>tu</strong>res<br />

<<strong>st</strong>rong>Graph</<strong>st</strong>rong>: the wor<strong>st</strong> case<br />

Sequential<br />

Hierarchies<br />

Partial or<strong>de</strong>r<br />

Layered<br />

Struc<strong>tu</strong>red<br />

Un<strong>st</strong>ruc<strong>tu</strong>red<br />

Un<strong>st</strong>ruc<strong>tu</strong>red<br />

Ease of<br />

Un<strong>de</strong>r<strong>st</strong>anding<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

33


Remark: Text-based Specifications Have a<br />

<<strong>st</strong>rong>Graph</<strong>st</strong>rong>-<<strong>st</strong>rong>Based</<strong>st</strong>rong> Representation<br />

► Are parsed <<strong>st</strong>rong>to</<strong>st</strong>rong> ab<strong>st</strong>ract syntax trees (AST)<br />

► After name analysis, they become ab<strong>st</strong>ract syntax graphs (ASG)<br />

► Then the same remarks hold<br />

► Hence, all specifications are graph-based!<br />

mo<strong>de</strong>l M begin<br />

elements<br />

T: transis<<strong>st</strong>rong>to</<strong>st</strong>rong>r;<br />

R: resis<<strong>st</strong>rong>to</<strong>st</strong>rong>r;<br />

equations<br />

R = <strong>de</strong>r(T);<br />

end<br />

.......<br />

AST<br />

.......<br />

.......<br />

.......<br />

ASG<br />

.......<br />

.......<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

34


Methods and Tools for<br />

Analysis of <<strong>st</strong>rong>Graph</<strong>st</strong>rong>-<<strong>st</strong>rong>Based</<strong>st</strong>rong> <<strong>st</strong>rong>Mo<strong>de</strong>ls</<strong>st</strong>rong><br />

Softwaretechnologie II, © Prof. Uwe Aßmann<br />

35


married<br />

The <<strong>st</strong>rong>Graph</<strong>st</strong>rong>-Logic Isomorphism<br />

► In the following, we will make use of the graph-logic isomorphism:<br />

► <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s can be used <<strong>st</strong>rong>to</<strong>st</strong>rong> represent logic<br />

■ No<strong>de</strong>s correspond <<strong>st</strong>rong>to</<strong>st</strong>rong> con<strong>st</strong>ants<br />

■ (Directed) edges correspond <<strong>st</strong>rong>to</<strong>st</strong>rong> binary predicates<br />

■ Hyperedges (n-edges) correspond <<strong>st</strong>rong>to</<strong>st</strong>rong> n-ary predicates<br />

► Consequence:<br />

■ <<strong>st</strong>rong>Graph</<strong>st</strong>rong> algorithms can be used <<strong>st</strong>rong>to</<strong>st</strong>rong> te<strong>st</strong> logic queries on graphbased<br />

specifications<br />

■ <<strong>st</strong>rong>Graph</<strong>st</strong>rong> rewrite sy<strong>st</strong>ems can be used for <strong>de</strong>duction<br />

Carl Gu<strong>st</strong>av<br />

Silvia<br />

father<br />

mother<br />

Vic<<strong>st</strong>rong>to</<strong>st</strong>rong>ria<br />

married(CarlGu<strong>st</strong>av,Silvia).<br />

married(Silvia, CarlGu<strong>st</strong>av).<br />

father(CarlGu<strong>st</strong>av,Vic<<strong>st</strong>rong>to</<strong>st</strong>rong>ria).<br />

mother(Silvia,Vic<<strong>st</strong>rong>to</<strong>st</strong>rong>ria).<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

36


<<strong>st</strong>rong>Graph</<strong>st</strong>rong>s and Fact Data Bases<br />

► <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s can also be noted<br />

tex<strong>tu</strong>ally<br />

► <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s consi<strong>st</strong> of no<strong>de</strong>s,<br />

relations<br />

► Relations link no<strong>de</strong>s<br />

isParentOf<br />

Adam<br />

isParentOf<br />

Sibylla<br />

Gu<strong>st</strong>avAdolf<br />

► Fact data bases consi<strong>st</strong> of<br />

con<strong>st</strong>ants (data) and<br />

predicates<br />

► No<strong>de</strong>s of graphs can be<br />

regar<strong>de</strong>d as con<strong>st</strong>ants, edges<br />

as predicates between<br />

con<strong>st</strong>ants (facts):<br />

isParentOf(Adam,Gu<strong>st</strong>avAdolf).<br />

isParentOf(Adam,Sibylla).<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

37


Queries on <<strong>st</strong>rong>Graph</<strong>st</strong>rong>-<<strong>st</strong>rong>Based</<strong>st</strong>rong> <<strong>st</strong>rong>Mo<strong>de</strong>ls</<strong>st</strong>rong> Make Implicit<br />

Knowledge Explicit<br />

► Since graph-based mo<strong>de</strong>ls are a mess, we try <<strong>st</strong>rong>to</<strong>st</strong>rong> analyze them<br />

► Knowledge is either<br />

■ Explicit, I.e., represented in the mo<strong>de</strong>l as edges and no<strong>de</strong>s<br />

■ Implicit, I.e., hid<strong>de</strong>n, not directly represented, and mu<strong>st</strong> be analyzed<br />

► Query and analysis problems try <<strong>st</strong>rong>to</<strong>st</strong>rong> make implicit knowledge explicit<br />

■ E.g. Does the graph have one root? <<strong>st</strong>rong>How</<strong>st</strong>rong> many leaves do we have? Is<br />

this subgraph a tree? Can I reach that no<strong>de</strong> from this no<strong>de</strong>?<br />

► Determining fea<strong>tu</strong>res of no<strong>de</strong>s and edges<br />

■ Finding certain no<strong>de</strong>s, or patterns<br />

► Determining global fea<strong>tu</strong>res of the mo<strong>de</strong>l<br />

■ Finding paths between two no<strong>de</strong>s (e.g., connected, reachable)<br />

■ Finding paths that satisfy additional con<strong>st</strong>raints<br />

■ Finding subgraphs that satisfy additional con<strong>st</strong>raints<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

38


Queries on <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s Check Consi<strong>st</strong>ency<br />

► Queries can be used <<strong>st</strong>rong>to</<strong>st</strong>rong> find out whether a graph is consi<strong>st</strong>ent<br />

► Due <<strong>st</strong>rong>to</<strong>st</strong>rong> the graph-logic isomorphism, con<strong>st</strong>raint specifications can be<br />

phrased in logic and applied <<strong>st</strong>rong>to</<strong>st</strong>rong> graphs<br />

► Business people call con<strong>st</strong>raint specifications business rules<br />

► Example:<br />

■ if a person hasn't died yet, its <<strong>st</strong>rong>to</<strong>st</strong>rong>wn should not li<strong>st</strong> her in the li<strong>st</strong> of <strong>de</strong>ad<br />

people<br />

■ if a car is exported <<strong>st</strong>rong>to</<strong>st</strong>rong> England, <strong>st</strong>eering wheel and pedals should be on<br />

the right si<strong>de</strong>; otherwise on the left<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

39


Example:<br />

<<strong>st</strong>rong>How</<strong>st</strong>rong> <<strong>st</strong>rong>to</<strong>st</strong>rong> <<strong>st</strong>rong>Analyze</<strong>st</strong>rong> a Sy<strong>st</strong>em for Layers<br />

And the Same Generation Problem<br />

<<strong>st</strong>rong>How</<strong>st</strong>rong> <<strong>st</strong>rong>to</<strong>st</strong>rong> query a dag and search in a dag<br />

<<strong>st</strong>rong>How</<strong>st</strong>rong> <<strong>st</strong>rong>to</<strong>st</strong>rong> layer a dag – a simple <strong>st</strong>ruc<strong>tu</strong>ring problem<br />

http://susning.nu/Drottning_Silvia<br />

Softwaretechnologie II, © Prof. Uwe Aßmann<br />

40


Layering of Sy<strong>st</strong>ems<br />

► To be comprehensible, a sy<strong>st</strong>em should be <strong>st</strong>ruc<strong>tu</strong>red in layers<br />

■ Several relations in a sy<strong>st</strong>em can be used <<strong>st</strong>rong>to</<strong>st</strong>rong> <strong>st</strong>ruc<strong>tu</strong>re it, e.g., the<br />

♦ Call graph: layered call graph<br />

♦ Layered <strong>de</strong>finition-use graph<br />

♦ Layered USES relationship<br />

► A layered architec<strong>tu</strong>re is the dominating<br />

<strong>st</strong>yle for large sy<strong>st</strong>ems<br />

► Outer, upper layers use inner, lower<br />

layers (USES relationship)<br />

► Legacy sy<strong>st</strong>ems can be analyzed for<br />

layering, and if they do not have a<br />

layered architec<strong>tu</strong>re, their <strong>st</strong>ruc<strong>tu</strong>re can<br />

be improved <<strong>st</strong>rong>to</<strong>st</strong>rong>wards this principle<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

41


Layering of Acyclic <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s<br />

► Given any acyclic relation, it can be ma<strong>de</strong> layered<br />

■ SameGeneration analysis layers in trees or dags<br />

► Example: layering a family tree:<br />

■ Who is whose contemporary?<br />

■ Who is ascendant of whom?<br />

Adam<br />

Gu<strong>st</strong>avAdolf<br />

Sibylla<br />

Walter<br />

Alice<br />

Desiree<br />

Carl Gu<strong>st</strong>av<br />

Ma<strong>de</strong>leine<br />

Silvia<br />

Ralf<br />

Vic<<strong>st</strong>rong>to</<strong>st</strong>rong>ria<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

42


Pattern and Rules<br />

► Parenthood can be <strong>de</strong>scribed by a graph pattern<br />

► We can write the graph pattern also in logic:<br />

isParentOf(Parent,Child1) && isParentOf(Parent,Child2)<br />

► And <strong>de</strong>fine the rule<br />

if isParentOf(Parent,Child1) && isParentOf(Parent,Child2)<br />

then sameGeneration(Child1,Child2)<br />

Parent<br />

Child 1<br />

Child 2<br />

Parent<br />

Child 1<br />

Child 2<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

43


Impact of Rule on Family <<strong>st</strong>rong>Graph</<strong>st</strong>rong><br />

Gu<strong>st</strong>avAdolf<br />

Adam<br />

Sibylla<br />

Walter<br />

Alice<br />

CarlGu<strong>st</strong>av<br />

Ma<strong>de</strong>leine<br />

Silvia<br />

Desiree<br />

Ralf<br />

Vic<<strong>st</strong>rong>to</<strong>st</strong>rong>ria<br />

Gu<strong>st</strong>avAdolf<br />

Adam<br />

Sibylla<br />

Walter<br />

Alice<br />

CarlGu<strong>st</strong>av<br />

Ma<strong>de</strong>leine<br />

Silvia<br />

Desiree<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

Vic<<strong>st</strong>rong>to</<strong>st</strong>rong>ria<br />

Ralf<br />

44


Same Generation<br />

► Beyond si<strong>st</strong>ers and brothers we can link all people of same<br />

generation<br />

Parent<br />

Child 1<br />

Child 2<br />

► Additional rule (transitive)<br />

Parent 2 Child 2<br />

Parent 1 Child 1<br />

Parent<br />

Child 1<br />

Child 2<br />

Parent 2 Child 2<br />

Parent 1 Child 1<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

45


Impact of Transitive Rule<br />

Adam<br />

Gu<strong>st</strong>avAdolf<br />

Sibylla<br />

Walter<br />

Alice<br />

CarlGu<strong>st</strong>av<br />

Ma<strong>de</strong>leine<br />

Silvia<br />

Desiree<br />

Vic<<strong>st</strong>rong>to</<strong>st</strong>rong>ria<br />

Ralf<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

46


Same Generation Introduces Layers<br />

► Computes all no<strong>de</strong>s that belong <<strong>st</strong>rong>to</<strong>st</strong>rong> one layer of a dag<br />

■ If backedges are neglected, also for an arbitrary graph<br />

► Algorithm:<br />

■ Compute Same Generation<br />

■ Go through all layers and number them<br />

► Applications:<br />

■ Compute layers in a call graph<br />

♦ Find out the call <strong>de</strong>pth of a procedure from the main procedure<br />

■ Re<strong>st</strong>ruc<strong>tu</strong>ring of legacy software (refac<<strong>st</strong>rong>to</<strong>st</strong>rong>ring)<br />

♦ Compute layers of sy<strong>st</strong>ems by analyzing the USES relationships (ST-I)<br />

♦ Insert faca<strong>de</strong> classes for each layer (Faca<strong>de</strong> <strong>de</strong>sign pattern)<br />

Every call in<<strong>st</strong>rong>to</<strong>st</strong>rong> the layer mu<strong>st</strong> go through the faca<strong>de</strong><br />

♦ As a result, the application is much more <strong>st</strong>ruc<strong>tu</strong>red<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

47


SameGeneration as a <<strong>st</strong>rong>Graph</<strong>st</strong>rong> Rewrite Sy<strong>st</strong>em<br />

► The rule sy<strong>st</strong>em SameGeneration only adds edges. It is an edge<br />

addition rewrite sy<strong>st</strong>em (EARS).<br />

■ The graph is enlarged (transformed), but the new edges can be marked<br />

such that they are not put permanently in<<strong>st</strong>rong>to</<strong>st</strong>rong> the graph<br />

■ SameGeneration is <strong>de</strong>clarative (no specification of control flow and an<br />

ab<strong>st</strong>ract representation)<br />

♦ Confluence: The result is in<strong>de</strong>pen<strong>de</strong>nt of the or<strong>de</strong>r in which rules<br />

are applied<br />

♦ Recursion: The sy<strong>st</strong>em is recursive, since relation sameGeneration<br />

is used and <strong>de</strong>fined<br />

♦ Termination: terminates, if all possible edges are ad<strong>de</strong>d, late<strong>st</strong>,<br />

when graph is complete<br />

► SameGeneration computes reachabilities (graph query, graph<br />

analysis)<br />

■ SameGeneration can be used for graph analysis<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

48


Searching <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s – Searching in<br />

Specifications with Datalog and EARS<br />

Softwaretechnologie II, © Prof. Uwe Aßmann<br />

49


EARS and Datalog<br />

► Rule sy<strong>st</strong>ems can be noted<br />

tex<strong>tu</strong>ally or graphically<br />

(DATALOG or EARS)<br />

► EARS (edge addition rewrite<br />

sy<strong>st</strong>ems) contain graph rewrite<br />

rules, which add edges<br />

► Rule no<strong>de</strong>s contain variables<br />

Parent<br />

Child1<br />

Child2<br />

Parent<br />

Child1<br />

Child2<br />

► Datalog contains tex<strong>tu</strong>al if-then<br />

rules, which te<strong>st</strong> predicates<br />

about the con<strong>st</strong>ants<br />

► rules contain variables <<strong>st</strong>rong>to</<strong>st</strong>rong> match<br />

many con<strong>st</strong>ants<br />

// conclusion<br />

sameGeneration(Child1, Child2)<br />

:- // say: "if"<br />

// premise<br />

isParentOf(Parent,Child1),<br />

isParentOf(Parent,Child2).<br />

// premise<br />

if isParentOf(Parent,Child1) &&<br />

isParentOf(Parent,Child2<br />

then<br />

// conclusion<br />

sameGeneration(Child1,Child2)<br />

50<br />

Prof. Uwe Aßmann, Softwaretechnologie II


Same Generation Datalog Program<br />

isParentOf(Adam,Gu<strong>st</strong>avAdolf).<br />

isParentOf(Adam,Sibylla).<br />

.....<br />

if isParentOf(Parent,Child1), isParentOf<br />

(Parent,Child2)<br />

then sameGeneration(Child1, Child2).<br />

if sameGeneration(Parent1,Parent2),<br />

isParentOf(Parent1,Child1), isParentOf<br />

(Parent2,Child2)<br />

then<br />

sameGeneration(Child1, Child2).<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

51


Searching is Easy With Datalog<br />

# A SMPP problem (single source, multiple target)<br />

<strong>de</strong>scendant(Adam,X)?<br />

X={ Silvia, Carl-Gu<strong>st</strong>av, Vic<<strong>st</strong>rong>to</<strong>st</strong>rong>ria, ....}<br />

# An MSPP problem (multiple source, single target)<br />

ascendant(Silvia,X)?<br />

X={Walter, Adam}<br />

# An MMPP problem (multiple source, multiple target)<br />

ascendant(X,Y)?<br />

{X=Walter, Y={Adam}<br />

X=Vic<<strong>st</strong>rong>to</<strong>st</strong>rong>ria, Y={CarlGu<strong>st</strong>av, Silvia, Sibylla, ...}<br />

...}<br />

Y = Adam, Walter, ...<br />

# Vic<<strong>st</strong>rong>to</<strong>st</strong>rong>ria, Ma<strong>de</strong>leine, CarlPhilip not in the set<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

52


Description Logic (DL)<br />

► Is a special form of typed Datalog (typed EARS)<br />

■ But only with binary relations<br />

■ Classes and objects, in<strong>st</strong>ead of untyped Datalog con<strong>st</strong>ants<br />

■ Relationship types and relations<br />

► All knowledge is specified with triples, simple sentences of Verb-<br />

Predicate-Object:<br />

Adam in<strong>st</strong>anceOf Person.<br />

Sibylla in<strong>st</strong>anceOf Person.<br />

Gu<strong>st</strong>avAdolf in<strong>st</strong>anceOf Person.<br />

King isA Person.<br />

Princess isA Person.<br />

...<br />

Adam parentOf Gu<strong>st</strong>avAdolf.<br />

Adam parentOf Sibylla.<br />

...<br />

Adam:<br />

Person<br />

Gu<strong>st</strong>avAdolf:<br />

Person<br />

Sibylla:<br />

Person<br />

Walter:<br />

Person<br />

Alice:<br />

Person<br />

Desiree:<br />

Person<br />

Carl Gu<strong>st</strong>av:<br />

King<br />

Ma<strong>de</strong>leine:<br />

Princess<br />

Silvia:<br />

Person<br />

Ralf:<br />

Prof. Uwe Aßmann, Softwaretechnologie Person II<br />

Vic<<strong>st</strong>rong>to</<strong>st</strong>rong>ria:<br />

Princess<br />

53


Datalog, DL, OCL, and EARS:<br />

Exten<strong>de</strong>d Relational Algebra<br />

► Datalog, DL and EARS<br />

correspond <<strong>st</strong>rong>to</<strong>st</strong>rong> relational<br />

Algebra with recursion (see<br />

lec<strong>tu</strong>re on data bases). SQL<br />

has no recursion, SQL-3 has<br />

► Negation can be ad<strong>de</strong>d<br />

► Datalog is a simple variant of<br />

Prolog, a powerful logic<br />

programming language<br />

► DL languages:<br />

■ OWL (on<<strong>st</strong>rong>to</<strong>st</strong>rong>logy web<br />

language)<br />

■ OIL (on<<strong>st</strong>rong>to</<strong>st</strong>rong>logy interchange<br />

language)<br />

► OCL does not have transitive<br />

closure, but iteration<br />

<strong>de</strong>cidable<br />

"Business rules”<br />

Relational<br />

Algebra<br />

(SQL)<br />

Description Logic<br />

(OWL)<br />

Datalog (with recursion)<br />

(SQL3)<br />

Datalog with negation<br />

and recursion<br />

OCL<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

54


Application Areas of Datalog, DL, OCL, and EARS<br />

► <<strong>st</strong>rong>Graph</<strong>st</strong>rong> query problems (searching graphs)<br />

■ Reachability of no<strong>de</strong>s (transitive closure)<br />

► Consi<strong>st</strong>ency checking of graph-based specifications<br />

■ Data analysis<br />

■ Program analysis<br />

■ Mo<strong>de</strong>l analysis<br />

► Struc<strong>tu</strong>rings and algorithms on <strong>st</strong>ruc<strong>tu</strong>red graphs<br />

■ Layering of sy<strong>st</strong>em relations<br />

■ Reducibility<br />

■ Strongly connected components<br />

► Specification of contracts for procedures and services<br />

■ Prover can <strong>st</strong>atically prove the validity of the contract<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

55


Example: Search in UML Diagrams<br />

► Step 1: enco<strong>de</strong> the diagram in<<strong>st</strong>rong>to</<strong>st</strong>rong> a Datalog or DL fact base<br />

► Step 2: <strong>de</strong>fine integrity con<strong>st</strong>raint rules<br />

► Step 3: let the rules run<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

56


Answer<br />

Alternative<br />

category<br />

text<br />

Example: The Domain Mo<strong>de</strong>l of the Web-<<strong>st</strong>rong>Based</<strong>st</strong>rong><br />

Course Sy<strong>st</strong>em<br />

Pupil<br />

CourseSa<strong>tu</strong>s<br />

beginDate<br />

endDate<br />

ready<br />

resultProcent<br />

Que<strong>st</strong>ionSta<strong>tu</strong>s<br />

<strong>st</strong>a<strong>tu</strong>s<br />

hasPupil<br />

ModuleSta<strong>tu</strong>s<br />

endDate<br />

ready<br />

Education<br />

teacher<br />

Teacher<br />

name<br />

<strong>de</strong>scription<br />

la<strong>st</strong>Changed<br />

Que<strong>st</strong>ion<br />

category<br />

text<br />

linksTo<br />

hasCourse<br />

Course<br />

name<br />

<strong>de</strong>scription<br />

la<strong>st</strong>Changed linksTo<br />

changedBy<br />

active<br />

hasModule<br />

Module<br />

name<br />

<strong>de</strong>scription<br />

la<strong>st</strong>Changed<br />

changedBy<br />

active<br />

linksTo<br />

{OR}<br />

{OR}<br />

Course<br />

Owner<br />

Course<br />

Modifier<br />

Link<br />

name<br />

<strong>de</strong>scription<br />

URL<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

57


Searching with Datalog or DLQueries on UML<br />

Class Diagrams<br />

// Step1: con<strong>st</strong>ruct fact base: the UML class diagram<br />

// in Datalog fact syntax.<br />

teacher(programming,john).<br />

hasCourse(programming, lisp).<br />

hasPupil(programming,mary).<br />

hasModule(lisp,closures).<br />

// Step 2: con<strong>st</strong>ruct integrity con<strong>st</strong>raint rules<br />

reads(Person,Module) :-<br />

hasPupil(P,A), hasCourse(P,C), hasModule(C,M).<br />

// Step 3: let rules run: form and execute a query<br />

:- reads(mary, Module)<br />

// the answer<br />

Module = closures<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

58


Example:<br />

Web Queries with Logic<br />

► The Web is a giganteous graph<br />

► Pages are trees, but links create real graphs<br />

■ Links are a secondary <strong>st</strong>ruc<strong>tu</strong>re which overlays the primary tree<br />

<strong>st</strong>ruc<strong>tu</strong>re<br />

■ Interpret tree and links as relations<br />

■ <<strong>st</strong>rong>Graph</<strong>st</strong>rong> algorithms and queries can be applied <<strong>st</strong>rong>to</<strong>st</strong>rong> the web!<br />

► RDF (resource <strong>de</strong>scription framework, a simple graph language)<br />

► OWL (<strong>de</strong>scription logic, www.w3c.org) adds classes, inheritance,<br />

inheritance on binary relations, expressions and queries on binary<br />

relations<br />

► Other experimental languages <<strong>st</strong>rong>Graph</<strong>st</strong>rong>log, Hy+, WebOQL (Toron<<strong>st</strong>rong>to</<strong>st</strong>rong>),<br />

Flora/XSB, Florijd (Freiburg)<br />

► New languages are being <strong>de</strong>veloped<br />

■ In the European network REWERSE (www.rewerse.net)<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

59


Transitive Closure<br />

The Swiss-Knife of <<strong>st</strong>rong>Graph</<strong>st</strong>rong> Analysis<br />

Softwaretechnologie II, © Prof. Uwe Aßmann<br />

60


Who is Descendant of Whom?<br />

► Sometimes we need <<strong>st</strong>rong>to</<strong>st</strong>rong> know transitive edges, I.e., edges after<br />

edges of the same color<br />

► Que<strong>st</strong>ion: what is reachable from a no<strong>de</strong>?<br />

■ Which <strong>de</strong>scendants has Adam?<br />

► Answer: Transitive closure calculates reachability over no<strong>de</strong>s<br />

■ It contracts a graph, inserting masses of edges <<strong>st</strong>rong>to</<strong>st</strong>rong> all reachable no<strong>de</strong>s<br />

■ It contracts all paths <<strong>st</strong>rong>to</<strong>st</strong>rong> single edges<br />

■ It makes reachability <strong>inf</strong>ormation explicit<br />

► After transitive closure, it can easily be <strong>de</strong>ci<strong>de</strong>d whether a no<strong>de</strong> is<br />

reachable or not<br />

► Basic premise: base relation is not changed (offline problem)<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

61


Parent<br />

Transitive Closure as Rule Sy<strong>st</strong>em<br />

► Basic rule <strong>de</strong>scendant(V,N) :- isChildOf(V,N).<br />

Parent<br />

► Transitive rule (recursion rule)<br />

► left recursive: <strong>de</strong>scendant(V,N) :- <strong>de</strong>scendant(V,X),isChildOf(X,N).<br />

► right recursive:<strong>de</strong>scendant(V,N) :- isChildOf(V,X), <strong>de</strong>scendant(X,N).<br />

Child<br />

Child<br />

GrandCh<br />

Parent<br />

Parent<br />

Child<br />

Child<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

GrandCh<br />

62


Impact of Basic Rule<br />

Gu<strong>st</strong>avAdolf<br />

Adam<br />

Sibylla<br />

Walter<br />

Alice<br />

CarlGu<strong>st</strong>av<br />

Ma<strong>de</strong>leine<br />

Silvia<br />

Desiree<br />

Vic<<strong>st</strong>rong>to</<strong>st</strong>rong>ria<br />

Ralf<br />

Gu<strong>st</strong>avAdolf<br />

Adam<br />

Walter<br />

Alice<br />

Sibylla<br />

CarlGu<strong>st</strong>av<br />

Ma<strong>de</strong>leine<br />

Silvia<br />

Desiree<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

Vic<<strong>st</strong>rong>to</<strong>st</strong>rong>ria<br />

Ralf<br />

63


Impact of Recursion Rule<br />

Adam<br />

Gu<strong>st</strong>avAdolf<br />

Sibylla<br />

Walter<br />

Alice<br />

CarlGu<strong>st</strong>av<br />

Ma<strong>de</strong>leine<br />

Silvia<br />

Desiree<br />

Vic<<strong>st</strong>rong>to</<strong>st</strong>rong>ria<br />

Ralf<br />

Impact only shown for Adam,<br />

but is applied <<strong>st</strong>rong>to</<strong>st</strong>rong> other no<strong>de</strong>s <<strong>st</strong>rong>to</<strong>st</strong>rong>o<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

64


[S|M][S|M]PP Path Problems:<br />

Variants of Transitive Closure<br />

► Single Source Single Target Path Problem, SSPP:<br />

■ Te<strong>st</strong>, whether there is a path from a source <<strong>st</strong>rong>to</<strong>st</strong>rong> a target<br />

► Single Source Multiple Target SMPP:<br />

■ Te<strong>st</strong>, whether there is a path from a source <<strong>st</strong>rong>to</<strong>st</strong>rong> several targets<br />

■ Or: find n targets, reachable from one source<br />

► Multiple Source Single Target MSPP:<br />

■ Te<strong>st</strong>, whether a path from n sources <<strong>st</strong>rong>to</<strong>st</strong>rong> one target<br />

► Multiple Source Multiple Target MMPP:<br />

■ Te<strong>st</strong>, whether a path of n sources <<strong>st</strong>rong>to</<strong>st</strong>rong> n targets exi<strong>st</strong>s<br />

► All can be computed with transitive closure:<br />

■ Compute transitive closure<br />

■ Te<strong>st</strong> sources and targets on direct neighborship<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

65


Co<strong>st</strong> of Transitive Closure<br />

► Transitive closure (TC) has many implementations<br />

► Naive: multiplication of boolean matrices O(n 3 )<br />

► Multiplication of boolean matrices with Russian Method is<br />

O(n 2.4 )<br />

► Ne<strong>st</strong>ed-loop joins from relational algebra: O(n 3 )<br />

■ Gets better with semi-naive evaluation, hashed joins, semi-joins, and<br />

indices<br />

► Munro/Purdue algorithm is almo<strong>st</strong> linear, but co<strong>st</strong>s space<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

66


Exercise: Railway Routes<br />

► Base (Facts):<br />

■ directlyLinked(Berlin, Potsdam).<br />

■ directlyLinked(Potsdam,Braunschweig).<br />

■ directlyLinked(Braunschweig, Hannover).<br />

► Define the predicates<br />

■ linked(A,B)<br />

■ alsoLinked(A,B)<br />

■ unreachable(A,B)<br />

► Answer the queries<br />

■ linked(Berlin,X)<br />

■ unreachable(Berlin, Hannover)<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

67


Transitive Closure and Several Relations<br />

► Transitive closure works on one relation<br />

► If we want <<strong>st</strong>rong>to</<strong>st</strong>rong> know, whether a certain no<strong>de</strong> is reachable un<strong>de</strong>r<br />

several relations<br />

■ Compute transitive closure on all of them<br />

■ Te<strong>st</strong> neighborship directly<br />

► This <strong>de</strong>livers an implementation of the exi<strong>st</strong>ential quantifier for logic<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

68


Central Theorem of Datalog/DL/EARS<br />

► Any Datalog program or EARS graph rewrite sy<strong>st</strong>em can be<br />

transformed in<<strong>st</strong>rong>to</<strong>st</strong>rong> an equivalent one<br />

■ That is free of recursion<br />

■ And only applies the opera<<strong>st</strong>rong>to</<strong>st</strong>rong>r TransitiveClosure<br />

■ (The ransitive closure uses direct recursion, but encapsulates it)<br />

► What does this mean in practice? (Remember, Datalog/EARS can<br />

be used <<strong>st</strong>rong>to</<strong>st</strong>rong> specify consi<strong>st</strong>ency con<strong>st</strong>raint on graph-based<br />

specifications)<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

69


SameGeneration as Non-Recursive Sy<strong>st</strong>em<br />

► Basic rule as before<br />

Parent<br />

Parent 1<br />

isChildOf<br />

isChildOf<br />

Child 1<br />

Child 2<br />

Parent<br />

Child 1<br />

Child 2<br />

► Additional non-recursive rule (<strong>de</strong>scendant is transitive closure of<br />

isChildOf)<br />

<strong>de</strong>scendant<br />

(isChildOf*)<br />

<strong>de</strong>scendant<br />

Child 1<br />

Child 2<br />

Parent 1<br />

isChildOf<br />

isChildOf<br />

<strong>de</strong>scendant<br />

<strong>de</strong>scendant<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

Child 1<br />

Child 2<br />

70


Applications of <<strong>st</strong>rong>Graph</<strong>st</strong>rong> Reachability in<br />

Consi<strong>st</strong>ency Checking<br />

► Corollary: To solve an arbitrary rechability problem, use a nonrecursive<br />

query and the opera<<strong>st</strong>rong>to</<strong>st</strong>rong>r TransitiveClosure.<br />

► Consequence: should a graph-based specification be checked on<br />

consi<strong>st</strong>ency (by evaluation of consi<strong>st</strong>ency con<strong>st</strong>raints),<br />

■ it can be done with non-recursive Datalog query and the<br />

opera<<strong>st</strong>rong>to</<strong>st</strong>rong>r TransitiveClosure<br />

■ And solved with the complexity of a good TransitiveClosure<br />

algorithm<br />

► Precondition: the input graphs are fix, i.e., do not change (<strong>st</strong>atic<br />

problem)<br />

► Since the relation is one of the qualities of the world this is a central<br />

problem of computer science and IT<br />

■ Similar <<strong>st</strong>rong>to</<strong>st</strong>rong> searching and sorting<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

71


Dynamic <<strong>st</strong>rong>Graph</<strong>st</strong>rong> Reachability and its Applications<br />

► The Reps/Ramalinguan Checking Theorem: (1997):<br />

■ An online analysis and con<strong>st</strong>raint-checking problem is a probem<br />

that is specified by Datalog, EARS, or <strong>de</strong>finite set con<strong>st</strong>raints, in<br />

which the basic relations are changed online (dynamic graph<br />

reachability problem)<br />

■ An online analysis problem can be reduced <<strong>st</strong>rong>to</<strong>st</strong>rong> context-sensitive<br />

graph reachability resp. dynamic transitive closure<br />

■ and be computed in O(n 3 ) (cubic barrier problem)<br />

► Applies <<strong>st</strong>rong>to</<strong>st</strong>rong> many problems in mo<strong>de</strong>ling, requirement analysis,<br />

<strong>de</strong>sign consi<strong>st</strong>ency:<br />

■ If you can reduce a consi<strong>st</strong>ency or <strong>st</strong>ruc<strong>tu</strong>ring problem <<strong>st</strong>rong>to</<strong>st</strong>rong> <strong>st</strong>atic<br />

or dynamic graph reachability, you have almo<strong>st</strong> won since<br />

Datalog and transitive closure are powerful <<strong>st</strong>rong>to</<strong>st</strong>rong>ols!<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

72


Generic Datalog Queries<br />

► Transitive closure is a general graph opera<<strong>st</strong>rong>to</<strong>st</strong>rong>r<br />

■ Computing reachability<br />

■ Can be applied generically <<strong>st</strong>rong>to</<strong>st</strong>rong> all relations!<br />

► Many other Datalog rule sy<strong>st</strong>ems are also generic<br />

■ sameGeneration<br />

■ <strong>st</strong>ronglyConnectedComponents<br />

■ domina<<strong>st</strong>rong>to</<strong>st</strong>rong>rs<br />

► And that’s why we consi<strong>de</strong>r them here:<br />

■ They can be applied <<strong>st</strong>rong>to</<strong>st</strong>rong> <strong>de</strong>sign graphs<br />

■ Is class X reachable from class Y?<br />

■ Show me the ances<<strong>st</strong>rong>to</<strong>st</strong>rong>rs in the inheritance graph of class Y<br />

■ Is there a cycle in this cross-referencing graph?<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

73


Consi<strong>st</strong>ency Checking of <<strong>st</strong>rong>Graph</<strong>st</strong>rong>-<br />

<<strong>st</strong>rong>Based</<strong>st</strong>rong> <<strong>st</strong>rong>Mo<strong>de</strong>ls</<strong>st</strong>rong><br />

When a specification becomes big...<br />

Softwaretechnologie II, © Prof. Uwe Aßmann<br />

74


Example 1: Consi<strong>st</strong>ency Checking for<br />

Car Specifications<br />

► Car data specifications in the MOST <strong>st</strong>andard<br />

■ Thousands of parts, <strong>de</strong>scribed for an entire supplier indu<strong>st</strong>ry<br />

■ Many inconsi<strong>st</strong>encies possible<br />

■ Due <<strong>st</strong>rong>to</<strong>st</strong>rong> human errors<br />

► Global variants of the cars mu<strong>st</strong> be <strong>de</strong>scribed<br />

► Examples of context conditions for global variants of cars:<br />

■ The problem of English cars: A <strong>st</strong>eering wheel on the right implies<br />

accelera<<strong>st</strong>rong>to</<strong>st</strong>rong>r, brake, clutch on the right<br />

■ Au<<strong>st</strong>rong>to</<strong>st</strong>rong>matic gears: an au<<strong>st</strong>rong>to</<strong>st</strong>rong>matic gear box requires an au<<strong>st</strong>rong>to</<strong>st</strong>rong>matic gear-shift<br />

lever<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

75


Fir<strong>st</strong> I<strong>de</strong>a<br />

► Define a context free grammar for the car data<br />

► From that, <strong>de</strong>rive a XML schema for the car data<br />

■ Enrich the grammar nonterminals with attributes<br />

► Parse the data and validate it according <<strong>st</strong>rong>to</<strong>st</strong>rong> its contextfree <strong>st</strong>ruc<strong>tu</strong>re<br />

► What is the problem with this approach?<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

76


Second I<strong>de</strong>a<br />

► <<strong>st</strong>rong>Analyze</<strong>st</strong>rong> consi<strong>st</strong>ency of the specifications by regarding them as<br />

graphs<br />

► Check <strong>de</strong>finition criterion (name analysis)<br />

■ “is every name I refer <<strong>st</strong>rong>to</<strong>st</strong>rong> <strong>de</strong>fined elsewhere”?<br />

► <<strong>st</strong>rong>Analyze</<strong>st</strong>rong> layers with SameGeneration<br />

■ <<strong>st</strong>rong>How</<strong>st</strong>rong> many layers does my car specification have?<br />

■ Is it acyclic?<br />

► Write a query that checks the consi<strong>st</strong>ency global variants<br />

■ If the car is <<strong>st</strong>rong>to</<strong>st</strong>rong> be exported <<strong>st</strong>rong>to</<strong>st</strong>rong> England, the <strong>st</strong>eering wheel, the pedals<br />

should be on the right si<strong>de</strong><br />

■ If the car has an au<<strong>st</strong>rong>to</<strong>st</strong>rong>matic gear box, it mu<strong>st</strong> have an au<<strong>st</strong>rong>to</<strong>st</strong>rong>matic gear-shift<br />

lever<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

77


Third I<strong>de</strong>a: Use On<<strong>st</strong>rong>to</<strong>st</strong>rong>logy Language<br />

► OWL (<strong>de</strong>scription logic) can be used for consi<strong>st</strong>ency con<strong>st</strong>raints, also<br />

of car specifications<br />

■ Result: an on<<strong>st</strong>rong>to</<strong>st</strong>rong>logy, a vocabulary of classes with consi<strong>st</strong>ency con<strong>st</strong>raints<br />

■ OWL engines (RACER, Triple) can evaluate the consi<strong>st</strong>ency of car<br />

specifications<br />

■ On<<strong>st</strong>rong>to</<strong>st</strong>rong>logies can formulate consi<strong>st</strong>ency criteria for an entire supplier chain<br />

[Aßmann2005]<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

78


Example 2: Consi<strong>st</strong>ency Checking of<br />

Tax Declarations<br />

► Task: you have been hired by the tax authorities. Write a program<br />

that checks the income task <strong>de</strong>clarations on consi<strong>st</strong>ency<br />

► Represent the tax <strong>de</strong>clarations with graphs.<br />

■ <<strong>st</strong>rong>How</<strong>st</strong>rong> many graphs will you get?<br />

■ <<strong>st</strong>rong>How</<strong>st</strong>rong> big are they?<br />

■ <<strong>st</strong>rong>How</<strong>st</strong>rong> much memory do you need at lea<strong>st</strong>?<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

79


Fir<strong>st</strong> I<strong>de</strong>a<br />

► Write a context free grammar for the tax <strong>de</strong>clarations<br />

► From that, <strong>de</strong>rive a XML schema<br />

■ Enrich the grammar nonterminals with attributes<br />

► Check context free <strong>st</strong>ruc<strong>tu</strong>re of the tax <strong>de</strong>clarations with the XML<br />

parser (contextfree consi<strong>st</strong>ency)<br />

► This is usually assured by the tax form<br />

■ It is, however, nevertheless necessary, if the forms have been fed in<<strong>st</strong>rong>to</<strong>st</strong>rong> a<br />

computer, <<strong>st</strong>rong>to</<strong>st</strong>rong> avoid feeding problems.<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

80


Second I<strong>de</strong>a<br />

► Write queries that checks document-local, but global con<strong>st</strong>raints<br />

■ Are there bills for all claimed tax reductions?<br />

■ Are the appendices consi<strong>st</strong>ent with the main tax document?<br />

► Global Con<strong>st</strong>raints over all tax Declarations:<br />

■ Have all bills for all claimed tax reductions really been payed by the tax<br />

payer?<br />

■ Is a reduction for a <strong>de</strong>bt reduced only once per couple?<br />

■ ....<br />

► Write an OCL invariant specification for the tax UML class diagram<br />

that checks the con<strong>st</strong>raints<br />

■ Use the Dres<strong>de</strong>n OCL <<strong>st</strong>rong>to</<strong>st</strong>rong>olkit <<strong>st</strong>rong>to</<strong>st</strong>rong> solve the problem<br />

http://<strong>dres<strong>de</strong>n</strong>-ocl.sf.net<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

81


Third I<strong>de</strong>a: Use On<<strong>st</strong>rong>to</<strong>st</strong>rong>logy Language<br />

► OWL (<strong>de</strong>scription logic) can be used for consi<strong>st</strong>ency con<strong>st</strong>raints, also<br />

of tax <strong>de</strong>clarations<br />

■ Result: a tax on<<strong>st</strong>rong>to</<strong>st</strong>rong>logy, a vocabulary of classes with consi<strong>st</strong>ency<br />

con<strong>st</strong>raints<br />

■ OWL engines (RACER, Triple) can evaluate the consi<strong>st</strong>ency of tax<br />

specifications<br />

■ On<<strong>st</strong>rong>to</<strong>st</strong>rong>logies can formulate consi<strong>st</strong>ency criteria for an entire admini<strong>st</strong>rative<br />

workflow [Aßmann2005]<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

82


Example 3: UML Specifications in Software<br />

Engineering<br />

► Imagine a UML mo<strong>de</strong>l of the Java Development Kit JDK.<br />

► 7000 classes<br />

► Inheritance tree on classes<br />

► Inheritance dag on interfaces<br />

► Definition-use graph: how big?<br />

► Task: You are the release manager of the new JDK 1.6. It has 1000<br />

classes more.<br />

■ Ensure consi<strong>st</strong>ency please. - <<strong>st</strong>rong>How</<strong>st</strong>rong>?<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

83


I<strong>de</strong>as<br />

► Build up inheritance graphs and <strong>de</strong>finition-use graphs<br />

■ in a database<br />

► Analyse conditions such as<br />

■ Depth of inheritance tree: how easy is it <<strong>st</strong>rong>to</<strong>st</strong>rong> use the library?<br />

■ Hot-spot methods and classes: Mo<strong>st</strong>-used methods and classes (e.g.,<br />

String)<br />

♦ Optimize them<br />

■ Does every class/package have a <strong>tu</strong><<strong>st</strong>rong>to</<strong>st</strong>rong>rial?<br />

■ Is every class containt in a roadmap for a certain user group? (i.e., does<br />

the documentation explain how <<strong>st</strong>rong>to</<strong>st</strong>rong> use a class?)<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

84


Answer<br />

Alternative<br />

category<br />

text<br />

Example: The Domain Mo<strong>de</strong>l of the Web-<<strong>st</strong>rong>Based</<strong>st</strong>rong><br />

Course Sy<strong>st</strong>em<br />

Pupil<br />

CourseSa<strong>tu</strong>s<br />

beginDate<br />

endDate<br />

ready<br />

resultProcent<br />

Que<strong>st</strong>ionSta<strong>tu</strong>s<br />

<strong>st</strong>a<strong>tu</strong>s<br />

hasPupil<br />

ModuleSta<strong>tu</strong>s<br />

endDate<br />

ready<br />

Education<br />

teacher<br />

Teacher<br />

name<br />

<strong>de</strong>scription<br />

la<strong>st</strong>Changed<br />

Que<strong>st</strong>ion<br />

category<br />

text<br />

linksTo<br />

hasCourse<br />

Course<br />

name<br />

<strong>de</strong>scription<br />

la<strong>st</strong>Changed linksTo<br />

changedBy<br />

active<br />

hasModule<br />

Module<br />

name<br />

<strong>de</strong>scription<br />

la<strong>st</strong>Changed<br />

changedBy<br />

active<br />

linksTo<br />

{OR}<br />

{OR}<br />

Course<br />

Owner<br />

Course<br />

Modifier<br />

Link<br />

name<br />

<strong>de</strong>scription<br />

URL<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

85


Consi<strong>st</strong>ency Checking on UML Class Diagrams<br />

with Description Logic<br />

► Step 1: enco<strong>de</strong> the diagram in<<strong>st</strong>rong>to</<strong>st</strong>rong> a Datalog/DL fact base<br />

► Step 2: specify integrity con<strong>st</strong>raint rules<br />

► Step 3: let the rules run<br />

// Step 1: factbase<br />

teacher(programming,john).<br />

hasCourse(programming, lisp).<br />

hasPupil(programming, mary).<br />

hasModule(lisp,closures).<br />

linksTo(linkA, closures).<br />

linksTo(linkA, lisp).<br />

linksTo(linkA, q).<br />

// Step 2: integrity con<strong>st</strong>raints specification<br />

consi<strong>st</strong>ent(Link,Course,Module,Que<strong>st</strong>ion) :-<br />

linksTo(Link,Course) ||<br />

linksTo(Link, Module) ||<br />

linksTo(Link,Que<strong>st</strong>ion).<br />

// Step 3: consi<strong>st</strong>ency checking query<br />

:- consi<strong>st</strong>ent(linkA,lisp,closures,q)<br />

// answer:<br />

false<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

86


Third I<strong>de</strong>a: Use On<<strong>st</strong>rong>to</<strong>st</strong>rong>logy Language<br />

► OWL (<strong>de</strong>scription logic) can be used for consi<strong>st</strong>ency con<strong>st</strong>raints, also<br />

of UML domain mo<strong>de</strong>ls<br />

■ Result: a domain on<<strong>st</strong>rong>to</<strong>st</strong>rong>logy, a vocabulary of classes with consi<strong>st</strong>ency<br />

con<strong>st</strong>raints about the domain<br />

■ OWL engines (RACER, Triple) can evaluate the consi<strong>st</strong>ency of such<br />

domain specifications<br />

■ On<<strong>st</strong>rong>to</<strong>st</strong>rong>logies can formulate consi<strong>st</strong>ency criteria for domain mo<strong>de</strong>ls of<br />

applications and product lines [Aßmann2005]<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

87


What Have We Learned<br />

► <<strong>st</strong>rong>Graph</<strong>st</strong>rong>s and Logic are isomorphic <<strong>st</strong>rong>to</<strong>st</strong>rong> each other<br />

► Using logic or graph rewrite sy<strong>st</strong>ems, mo<strong>de</strong>ls can be validated<br />

■ <<strong>st</strong>rong>Analyze</<strong>st</strong>rong>d<br />

■ Queried<br />

■ Checked for consi<strong>st</strong>ency<br />

■ Struc<strong>tu</strong>red<br />

► Applications are many-fold, using all kinds of sy<strong>st</strong>em relationships<br />

■ Consi<strong>st</strong>ency of UML class mo<strong>de</strong>ls (domain, requirement, <strong>de</strong>sign mo<strong>de</strong>ls)<br />

■ Struc<strong>tu</strong>ring (layering) of USES relationships<br />

► Logic and graph rewriting technology involves reachability que<strong>st</strong>ions<br />

Logic and graph rewrite sy<strong>st</strong>ems are the Swiss army knife of the<br />

validating mo<strong>de</strong>ller<br />

Prof. Uwe Aßmann, Softwaretechnologie II<br />

88


The End<br />

Softwaretechnologie II, © Prof. Uwe Aßmann<br />

89

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!