Vous êtes sur la page 1sur 31

Data-Centered Software Architecture

Dewan Tanvir Ahmed, Ph.D.


King Saud University
dtahmed@ksu.edu.sa
Overview
Data-centered SW Architecture is characterized by
A centralized data store that is shared by all surrounding software
components

Consists of two types of components
Data Store
Software component agents

Overview
The connection between the data module and the software
components is either implemented by
Explicit method invocation or Implicit method invocation

Software component does not communicate directly
Via data store

The shared data module provides
Insertion
Deletion
Update and
Retrieval

Classification

Classified into two categories (based on Flow Control Strategy)
Repository
Blackboard
Repository
Repository
Data store is passive
Clients of the data store are active
Its clients taking control of flow logic
Client may access the repository
Interactively
Batch transaction
Examples
Database management system
Library Information system
Interface repository in CORBA
UDDI registry for Web Services
CASE tools IBM Rational Rose
IDE (Interactive Development Endowment)
Blackboard
Blackboard
Data store is active
Clients are inactive/passive

Flow of logic is determined by the current data status
The clients of a blackboard system are called
Knowledge sources
Listeners or subscribers
A new data change may trigger events so that the knowledge sources
take actions to respond to these events. These actions may result in new
data and change in logic flow
Example:
Knowledge-based AI system
voice and image recognition system
Security system
Business resource management systems.
Repository Style
Bootstrap
Agent 1 Agent 2 Agent n
Repository
Dash line means clients have full control over logic flow
Each agent might have different interface, functionality, privilege
Repository Architecture
Example: Student Record DB
Student
- SSN
- Name

+ Student()
+ getSSN()
+ setSSN()
+ getName()
+ setName()
123 Solomon
234 Anderson
987 Smith
database
connectivity
r0
r1
rn
class Students table
Students
- Vector or Arraylist
+ Students()
+ add()
+ remove()
+ next()
+ first()

class
Client: Students class, has a list of Student instances (in Vector)
Store: Students table (student_id, student_name)
Follows Model-View-Controller model
It describes the static relationships between data classes and their backup database tables
It describes the static relationships between data classes and their collection classes
A programming oriented view of the repository design architecture
Instance of Student class represent one
specific record in the database table
Mapping Into Detailed Design
public class Student implements Serializable {
String SSN;
String Name;

public Student() {
SSN = "";
Name = "";
}
public Student(String ssn, String name) {
SSN = ssn;
Name = name;
}
public void setSSN(String ssn) { SSN = ssn; }
public String getSSN() { return SSN; }
public void setName(String name) { Name=name; }
public String getName() { return Name; }
}
Clients Side When Students Initiated
. . .
ArrayList studentList = new ArrayList();
Statement statement = connection.createStatement();
ResultSet results =
statement.executeQuery("SELECT * FROM students");
Student student = new Student();
while (results.next()) {
student.setSsn(results.getSsn(1));
student.setName(results.getName(2));
studentList.add(student);
}
Example 2: CASE Tool
CASE tool
Data
reposition
Diagram drawing
Fill -in- Forms
(Specifications)
Code for
Reverse Engineering
Diagrams
Reports (Text
Specifications)
Generated diagram
form RE
Graphic
Files
Text Report
Files
Text Code
Files
Commands
Program
Scripts
menu
Example 3: Compiler
Construction
Compiler tool
scanner parser
code
generator
int x, y;
x= y + 1;
x int 0
y int 0
Symbol
table
Statement
Var exp ;
(Int) (Int)

x y + 1
(Int) (Int) (Int)

parse tree
mov ax, [y]
add ax, 1
mov [x], ax
[x] address of variable x
In symbol table
Type check
By semantic
parser
Question: why not batch sequence?
The data in memory are shared by all agents and the agents dont pass on data to each
other directly.
Variants of Data Repository
Virtual repository
Built up on the top of multiple physical repositories
Most DB allows users to create views that are virtual repositories since
they do not exist physically.
Benefits
Simplify the overall complexity of overall database structure
Security management in terms of scope of data of manipulation for
different users

Variants of Data Repository
Distributed repository system (distributed database system)
All data are distributed over all sites linked by network
Data are replicated in order to
Improve reliability and local accessibility

Other issues - concerns
Vertical or horizontal partitions
Synchronization of duplicated data
Cost of data transmission
Collaboration (two-phase transaction commitment)
Summary: Data Repository
Application Domain
Suitable for large complex information system
Data transactions drive the control flow

Benefits
Data integrity:
easy to backup and restore,
System scalability and Reusability of agents:
Reduce the overhead of transient data between software components

Cons
Data store reliability and availability
High dependency between data structure of data store
Overhead cost of moving data on network
Blackboard Architecture Style
Introduction
Blackboard system:
A common knowledge base, the "blackboard", is iteratively
updated by a diverse knowledge sources,
starting with a problem specification and ending with a solution.
1
st
Blackboard arch. developed in 1970s
mainly used for
Speech recognition
Weather forecast

Motivated by classroom teaching
Blackboard
Teacher and students (agents) solve problems together
Agents can work collaboratively or independently

Overview
Blackboard: variation of data-centric
Consists of three partitions
Blackboard:
Used to store data (Hypothesis and fact)
Knowledge Source:
stores domain specific knowledge
controller
initiating the blackboard and knowledge sources

How does it work?
Data driven a change in the data stored in Blackboard triggers one or
more knowledge source might lead to more changes
Blackboard Arch. in Box-Line
Properties
Each knowledge source is relatively independent
They dont need to interact with each other
Only interact and respond to the blackboard subsystem
Blackboard Arch. in Box-Line
Agent 1 Agent 2 Agent n
Blackboard
Also called subscriber mode
Note the direction of control
flow
Data links
Flow logic control
Class Diagram of Blackboard Arch.
+inspect()
+update()
-facts
Blackboard
+execute()
-Blackboard
-KS
-controller
Control
+matchInspect()
+update()
-rules
Knowledge
Source (KS1)
1
1
1
n
1
n
A UML diagram for rule-based blackboard software
Example: KBS
KBS: Knowledge Based System
Knowledge: represented as production rule
Condition
Action
Example Setting
Here is a set of rules:
R1: IF animal gives milk THEN animal is mammal
R2: IF animal eats meat THEN animal is carnivore
R3: IF animal is mammal AND animal is carnivore AND animal has tawny
color AND animal has black stripes THEN animal is tiger

The set of facts is
F1: animal eats meat
F2: animal gives milk
F3: animal has black strips
F4: animal has tawny color

GOAL: Which animal it is?
How to Solve Problems
Two major approaches
Forward Reasoning
Backward Reasoning

Both can use the blackboard arch.
Facts in blackboard
Rules in agents

Example: forward reasoning
F1 matches R2 produces new fact F5: it is a mammal
F2 matches R1 produces new fact F6: it is carnivore
F5,F6,F3,F4 matches R3 produces the result

Matching Process
Control
Knowledge
Source i
Blackboard
initiate()
intiate()
matchInspect()
update()
matchInspect()
update()
inspect()
Dynamic interaction in a Blackboard system
How is the subscribing implemented?
Blackboard ( Fact i )
addEventListener()
KS EventTrigger()
Vector V 0 1 n-1
KS 0
Event Sink 0
handleEvent 0
( exec) action
KS (n-1)
Event Sink (n-1)
handleEvent (n-1)
(exec) action
scan
.
Publish/subscriber relationship between blackboard and knowledge sources
Another Example: Travel Reservation
Travel Consulting System
Process
A client submits a request
The system stores all the data in the blackboard
The blackboard makes a request to the air agent
Once air reservation data is returned and stored in blackboard,
the change triggers hotel, auto rental, attraction agents for a
travel plans under budge and time
Client chooses one of the plan
The system triggers the billing process
Two major approaches
Example: Travel Reservation
Travel Reservation System
Air agent Hotel agent Auto agent
control
client
Billing agent
Attraction
agent
db
Why not repository arch. for travel
reservation?
Observation:
User requests in relatively fixed format
Hard to integrate all knowledge (business logic) in a central store, why?
Hotel discounts rules changes every day!
Many specialized hotel reservation services available?
best solution: publish the contract data and let all of them bid.
Summary - Blackboard
Application Domain
Suitable for solving immature and complex AI problems
The problem spans multiple disciplines, each of which has complete different
knowledge expertise
Optimal, partial, or approximate solution is acceptable
Exhausted searching is impossible.

Pros
Scalability: easy to add new knowledge source
Concurrency: all knowledge sources can work in parallel
Reusability of knowledge source agents

Cons
Tight dependency between the blackboard and knowledge source
Synchronization of multiple agents is an issue
Debugging and testing of the system is a challenge.

Vous aimerez peut-être aussi