Title: Structural Manipulations of Software Architecture Using Tarski Relational Algebra
1Structural Manipulations of Software Architecture
Using Tarski Relational Algebra
Paper at WCRE '98 Working Conference on Reverse
Engineering, Honolulu, Oct 1998.
- Ric Holt
- University of Waterloo, Canada holt_at_uwaterloo.ca
2Top view of concrete software architecture of
250KLOC system
3Client-server view of one subsystem of the
250KLOC system
4Process of view creation
Source code
Clustering
Parser
Facts extracted from code
Hierarchic decomposition
Grok Fact manipulator
Architectural diagram
Layouter
Browser
5Example typed graph
- C (r,a), (r,b), (a,v), (a,w) (a,x), (b,y),
(b,z) - I (a,b)
- E (b,y)
- U (v,w), (x,y)
6Algebraic Operators
Union I E (a,b), (b,y) Intersection E C
(b,y) Difference C - E (r,a), (r,b),
(a,v), (a,w), (a,x), (b,z) Inverse inv E
(y,b) Composition I o E (a,y) Identity id
(r,r), (a, a), (b,b), (w,w) Transitive
Cl. C (r,a), (r, b), (r,v), (r,w), (r,x),
(r,y), (r,z), (a,v), (a,w), (a,x), (b,y),
(b,z) Reflex. T.C. C id C
7External Representation of Graphs
RSF call P Q include F G store Q X contain Main P
Main
contain
P
F
call
Q
include
store
G
X
8Hide transformations
Graph G
d
T
e
a
V
f
b
Graph I hideExt(G, S)
Graph H hide(hide(G,T),V)
9Hide transformation
The hide transformation takes a graph G that
includes a hierarchical (tree) containment
relation C and another relation R and a
particular node S, and eliminates all descendent
nodes of S, while replacing each edge from
outside S to inside S by an edge to S, and each
edge from inside S to outside S by an edge from
S. Similarly for hideExt.
10When use hide transformation?
Use hide when relation R is optimistically
transitive.
T
a
c
d
S
e
V
b
f
g
h
11Edged induced by hiding
T
a
c
d
S
e
V
b
f
g
h
Edges induced by edge (f,g) all edges that
hide/hideExt may cause to be drawn all
subpaths from f to g.
12Family relations
Given containment (child) relation C Parent P
inv C Sibling S P o C - id Descendent D
C Inclusive descendent Do C Ancestor A
P Inclusive ancestor Ao P Super
cousin K P o S o C
13Induced cousins
Given relation U (for use), what higher level
relations are induced by U? Divide U into Uk
(cousin edges) Ud (descendent/export/public
edges) Ua (ancestor/buy edges) Induced cousin
usage Uk (Do o Uk o Ao) K
Uk
Do
Ao
Uk
14 Induced descendent edges (export/public edges)
Ud (Ao o Ud o Ao) D (K o Uk o
Ao) D
Uk
Ao
K
Ud
Ao
Ud
Uk
Ao
Not Uk
Ao
Ud
K
Ao
Not Ud
Uk
Ao
15Grok a relational calculator
Program getdb call.rsf tcall call putdb
both.rsf Input from call.rsf call P Q call
Q R Output to both.rsf call P Q call Q
R tcall P Q tcall Q R tcall P R
P
call
Q
call
R
16Inducing calls up to file level
call is a procedure call fcall is a file
level call
File
File
fcall
main.c
start.h
funcdef
funcdcl
startup
main
call
Procedure body
Procedure header
fcall funcdef o call o inv funcdcl
17Algorithms for composition and other operators
Implement T R o S Naïve implementation,
O(e2) O(n4)
Original a R b b S c c R x y R d x S b
Result a T c c T b
for i 1 .. e if type(i) R then for j
1 .. e if type(j) S trg(i) src
(j) then create T(src(i),
trg(j)) end if end
for end if end for Remove duplicates
18Algorithms for composition and other operators