Speciffing: Object-Oriented

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

VNU Journal of Science, Natural Sciences and Technolo gy 26 (2010) 89-94

speciffing object-oriented Design Patterns using owl


' Vu Dieu Huongl'*, Nguyen Van Vyl, Le Viet H*
tCoil"ge of Technologt, VNU, 144 Xuan Thuy, Hanoi, Yietnqm
2Information Technologt Institute, WU, 144 Xuan Thuy, Hanoi, Yietnam

Received 20 Julv 2009

Abstract. Design patterns provide good solutions for problems occurred in the design stage. Using
design patterns in the software development processes helps improve productivity and quality of
software products. Pattern Oriented Analysis and Design Process has fow steps related to patterns,
namely the acquaintance with design patterns in the pattern library, the retrieval of the pattem
candidate, the selection ofsuitable patterns and the application ofselected patterns. It is necessary
to have a method to specify pattems in a machine understandable form to automate the above four
steps. Some works have hied to specify the sbuctural aspects of design patterns by ontology. We
add the specification ofthe behavior aspects into design pattern ontology so that this ontology can
be used to automate steps in the Pattern Oriented Analysis and Design Process.
t
Kel,words: design pattern, OWL, Ontology'

1. Introduction Design patterns are also stored in some


databases or expressed by some means. In
Pattern Oriented Analysis and Design recent years, many design pattern libraries have
Process (POAD) is a systematic process that been built [1].
promotes pattem-based development Il]. The acquaintance activity in POAD
POAD consists of four important steps: includes browsing catalogs of pattems that are
acquaint with design patterns in the reusable stored in libraries for the purpose of
asset library, retrieve of the pattem candidates, understanding existing patterns. In this step, we
select suitable patterns and use the selected focus on intent sections and applicability
pattems. sections of the pattem documentations.
The retrieval activity in POAD is defined as
Design pattems are usually described in the
selecting patterns from the library. The selected
unstructured documents. A pattern document
patterns are those produce solutions for
includes many sections such as name of pattern,
application requirements. lrput of this step is
intent, motivation, applicability (applicability the set of application requirements. The
context of pattems), structure, implementation outcome of this step is a set of pattern
and consequence [2]. candidates. This set of pattem candidates is
used as input of the selection activity to select
Co.r"tp*aing author. Tel.: 84-4-375490 16. the suitable pattems to pass to the next step.
E-mail: [email protected]
89
90 V.D. Huong et al. I W[l lournal of Science, Natural Sciences andTechnology 25 (2010) 8g-g4

In the naditional way, to carry out the kr this paper, we propose a method to
acquaintance and the retrieval activities, all specifu both the structural aspects and the
patterns need to be read and the intent section behavior aspects of pattems using OWL. Our
and the applicability section in document are idea is speciffing the applicability context of
focused. Identiffing and retrieving set of design patterns in the form of object model to
pattern candidates are performed manually. compare the application requirements with the
These activities take much time and effort. So, applicability section of design pattems
it is necessary to automate these activities. If automatically. This technique can therefore
the retrieval step is automated then the assist in retrieving pattern candidates.
.
acquaintance step isn't necessary in POAD. The rest of this paper is organized as
To retrieve set of pattern candidates for a follows. Section 2 introduces an overview of
software system automatically, we need a Ontology and OWL. Section 3 and section 4
technique that allows comparing automatically represent our contribution, a method to specifu
the requirement specification of the software patterns and rehieve the pattern candidates from
system with the context in which pattems ontology. We also illustrate in these sections
should be applied (the applicability context of our approach's implementation and an example
patterns). However, the comparison depends on of retrieving the pattern candidates from our
the specification method for the software ontology to be used in refining Customer-
requirements and the applicability context of Account management system. The last section
patterns. gives some perspectives and concludes the
There were some specification methods for paper.
Design Pattems (Pattems). Gamma et al
described twenty three patterns using text and
IJML [2]. Maplesden introduced a set of graph 2. Ontology and OWL
notations to model patterns t3]. These
specifications assist us in understanding Ontology defines a common vocabulary for
patterns. researchers who need to share information in a

Many researches specified patterns using


domain. It includes machine-interpretable
definitions of basic concepts in the domain and
different formal specification languages such as
relations among them [7].
LePUS, Slam-Sl t4-61. Using the formal
specification languages, we can specifo We develop ontology for purposes:
different aspects of patterns. However, it costs - To share common understanding of the
much time to study formal methods and it is structure of information among people or
very difficult to understand formal software agents
specifications ofpatterns for new users. - To enable reuse of domain knowledge
Dietrich specified design patterns using - To make domain assumptions explicit
OWL [4]. OWL is quite similar to Object OWL (Ontologt Web Language) is
Oriented modeling languages. Therefore, it is
language for representing ontology [5]. It is a
easier for us to use OWL to speciff patterns and
powerful language to represent knowledge in a
understand the OWL specification of patterns as
machine understandable form based on a simple
well. However, Dietrich just specifies the
data model using linked resources.
structural aspect of patterns.
v.D. Huong et at. lwlJ lournal of science, Natural sciences andTechnology 25 Q070) 89-94 91

Most of the elements of an OWL ontology We can use some of languages to develop
concern classes, properties, instances of classes ontology such as LOOM, LISP, XML, SHOE,
(individuals), and relationships between these OIL, DAM+OIL, RDF, RDFS, OWL' In this
instances. research, we use OWL to build"the design
pattern OntologY.
The data described by an OWL ontology is
interpreted as a set of "individuals" and a set of
"property assertions" which relate individuals to 3.l.Developing the design patterils ontologt
one another. An OWL ontology consists of a set using OW
of axloms which place constraints on sets of
individuals (called "classes") and the types of The design pattern ontology is defined with
relationships permitted between them' These classes, namely DesignPattern, Catalog,
axioms provide semantics by allowing systems Participant, Operation and ApplicationClass'
to infer additional information based on the data The class Catalog classifies a pattern according
explicitly provided. to different categories. The class Participant
OWL is the semantic web mark-uP specifies information about participants in
language. A big advantage of it is openness' patterns. Methods of these participants are
Therefore, we can share }nowledge in the OWL specified by the class Operation' The class
ontology via internet and new knowledge can Participant and the class Operation represent the
also be added easilY. collaboration of participants and therefore
represent the behavior aspect of pattems' The
3. The Design Pattern OntologY ' class ApplicationClass describes the conte4t
where patterns should be applied. Attributes of
We develop the design pattern ontology to
classes in ontology are shown in the table 1'
share design patterns and to share experience in
using design Patterns.
Table I . Properties of classes in DP Ontology

Attributes of Value
Intent DataTlpeProPertY Text
InCata The class

OfDesign Pattern Objec8roPertY The class DesignPattern


isAbsEact Data Boolean
OfPaticipant ObjectPropertY The class PaticiPant
Operation
isAbsfiact DataTypeProPertY Boolean
The class
The class

In the pattern document, the context is and the collaboration of these objects' For
described by text. However, in our approach, example, the specification of the applicability
applicability contexts of design patterns are context of Composite paltern is presented
specified visually by a set of objects and visually by the class diagram in the figure 1'
collaborations among them. The applicability There are whole class (e.g' PICTURES) and
partial classes (e.g' LINES and CIRCLES)' The
context of design pattems is specified by
objects which are instances of the class Class relationship among these classes is composite
92 V.D. Huong et al. I lrl{Il lournal of Science, Natural Sciences andTechnology 25 (2070) 8g-g4

relationship. Concretely, PICTURES is a 4. Implementation


composition of LINES and CIRCLES.
We can use some tools to build, edit and
update the ontology, such as OntoEdit, OilED,
WebODE, Chimera DAG_Edit and Prot6g6.
hr this research, we used Protdgd 3.3.1 to
develop Design Pattern Ontology. Prot6g6 is a
free, open source ontology editor. The Protdgd
platform supports two main ways of modeling
Fig. l. Class diagram represents the applicability ontology via the Protdg6-Frames and Protdg6-
context of Composite pattern. OWL editors. Protdgd ontology can be exported
into a variety of formats including RDF(S),
OWL. and XML Schema.
3.2. Retrieving design patterns from Ontologt
We specified object oriented design patterns
Artifacts of the analysis phase in the object of Gamma et al l2l. A design view of Design
oriented development process include simple Pattem Ontology is shown in the figure 2.
class diagrams and simply interactive diagrams.
These diagrams are results of modeling
application requirements. We call these
diagrams as the initial diagrams of the desigr;
phase in the development process and they are
inputs of retrieval step in POAD. The designers
need to retrieve design patterns which produce
solutions to refine these initial diagrams.
The applicability context of a design pattem
is specified by class diagram in which classes
are composed of athibutes and operations. So,
we can select the pattern candidates
automatically by comparing classes in the
initial diagrams with classes in applicability Fig. 2. A view of the Design Pattern Ontology.
contexts of design patterns to find the
commonity. We can obtain that by comparing
In order to illustrate our approach about
how to retrieve pattems from our ontology, we
such kinds of relationships as dependence,
execute the retrieval activity on an example. It
composite, and inheritance, etc. In addition, we
aims to refine a design of Customer-Account
can compare operations like creation
management system in a bank. The initial
(constructors) and/or deletion (destructors). We
can also consider types of operation (abstract,
design class diagram of the system is
represented in the figure 3:
concrete), the execution order of operations or
parameters and retum values, etc.
V.D. Huong et at. / WLI lournal of Science, Natural Sciences and Technology 26 (201.0) 89-94 93

Classes to Interfaces can't be in the set of


pattern candidates for this initial class diagram.

5. Conclusion and Future works

We proposed a specification method for


design pattems using OWL. In this approach,
we specified both the structural aspects and the
behavior aspects of pattems and specified the
applicability context of pattems by a set of
objects and the collaboration among them visually.
This method allows us to share design
patterns and to share experience in using these
patterns. This also assist in retrieving set of
Fig 3. A class diagram of Customer-Account pattem candidates which respond to a given
management system in a bank. software requirement.

We need execute all queries which frnd out


We also developed a Design Pattern
Ontology using OWL.
the common properties of elements in the figure
3 and elements in the specification of the The difficult of our method is in speciffing
applicability context of each pattem in Df the applicability context of patterns. We need
Ontology. understand pattems to represent the
applicability context of patterns visually.
In this example, the query of
However, it is very easy for who develop
Composite pattem returns these match
patterns or who have experiment in using pattems.
elements: the Customs class is markable with
the Pictures class. The ATMAccounts class and Ontology query languages such as Ontology
SavingAccounts are markable with the Line Web Language - Query Language (OWL-QL)
class and Circles class. It means that the and ontology query tools such as OWQL Query
Customers class is the whole class, the Service and Racer Manager Software have been
ATMAccounts class and the SavingAccounts developing. We are going to study on
classes are partial classes. integrating Design Pattem Ontology with an
existing ontology query tool, study on
Therefore, relationships of classes in the
developing a new tool which support for
initial class diagram (presented in figure 3) and
selecting design pattems automatically in
relationships of classes in the specification of
Pattern-Oriented Analysis and Design Process
Composite pattern have in common. This
and then evaluate the productivity ofretrieval.
means that we detected the Composite pattern is
a pattern candidate because it have the same
structural properties correspond at the initial Acknowledgements
class diagram as illustrated in the figure 3. This work is partly supported by the
Some pattems such as Iterator pattern, research project No. QCT 08.02 granted by
Abstract Factory pattern and From Abstract Vietnam National University, Hanoi.
94 V.D. Huong et al. / WU Journal of Science, Natural Sciences and Technology 26 (201.0) A9-94

References t5l G. Epameinondas. "LePUS: A Formal Language


for Modeling Design Pattems." Ch. XVI in:
Toufik Taibi (ed.) Design Pattern Formalization
[] S. M. Yacoub, H. H. Ammar, Pattern-Oriented
Techniques. Hershey, USA: Idea Group Inc,
Analysis and Design: Composing Palterns to
Design Software Systems, Addison Wesley, 2007 , p. 357 .

U.S, August 28,2003. t6l A. Herranz, J. Jose, M. Navarro, "Modeling and


Reasoning about Pattems in Slam-Sl". Ch. XVI
[2] E. Gamma, R. Helm, R. Johnson, J. Vlissides,
Design Pattbrns - Elements of reusable object- in: Toufik Taibi (ed.) Design Patterns
orient e d s oftware, Addi son-Wesl ey, U. S, I 995. Formalization Techniques, IGI Publishing, U.S,
2007,p.206.
[3] D. Maplesden, J. Hosking, J. Grundy, "A Visual
.Language for DP Modeling and Instantiation", 17l L. W. Lacy, Owl: Representing Information
HCC'0 1, IEEE, 2001,p. 338. Using the Web Ontologt Language. Victoria,
BC, Canada, 2005.
[4] J. Dietrich, C. Elgar. "A formal description of
Patterns using OWL", ASWEC'05,IEEE, 2005,
p.243.

Dac th cdc m6u thi6t kC nuong d6i tugng su dpng OWL

Vf, Di6u Hucrngr, Nguy6n Vdn Vyr, LO Vi6t Ha2


tTrudng
Dqi hpc C6ng nghQ, DHQGHN, 144 Xudn Tht)y, Hd NQi, ViQt Nam
'Vi|, C6rg nghQ Th6ng tin, DHQ,GHN, 144 Xudn Thrty, Hd Npi, ViQt Nam
4

MAu thiiSt k6 cung cip cdc gi6i ph6p ttit cho chc viln dO ndy sinh trong giai do4n thi6t ki5 hQ th6ng.
Ti6n trinh phAn tich, thi6t k6 huong m5u @OAD) ld tiiin trinh phdn mAm hucmg di5n mpc ti6u tdng khd
ndng srl dgng mlu thi6t t6. POAD c6 b6n bu6c lin quan diSn mdu: Idm quen vdi c6c miu trong thu
viQn m6u, ldy ra c6c miu ring vin phir hqp v6i hQ thdng hiQn t4i,lqa chpn mdu phir hqp nh6t trong
danh s6ch mAu rlmg vi6n, sf dung cdc miu dd chon di5 thi6t k6 hQ th6ng. HiQn t4i, chring ta v6n thgc
hin b6n budc ndy bing tay. D tg ttQng ho6 c6c budc ndy, chfng ta c6n c6 m6t phuong ph6p d[c td
c6c m6u theo c6ch md m6y tinh c6 tne ni6u clugc d6 n6 c6 th6 trq gitp chtng ta thgc hiQn c6c ho4t
<tQng v6i c6c miu. Trong nghiOn c{ru niry, chring t6i sri dgng OWL - ng6n ngii sri dpng ttd xdy dgng
ontology trn web, aC aAc td cd khia c4nh c6u tr0c vd hdnh vi cria c6c m6u d6 chring ta c6 thiS ty dQng
ho6 c6c bu6c trong POAD.

You might also like