Graph Transformation Rules With weight and Fuzzy ...

3 downloads 0 Views 172KB Size Report
selected patterns by analyzing entities such as: class inheritance, interface .... recognizing a composite design pattern, than noticing the existence of an ...
International Journal of Computer and Information Technology (ISSN: 2279 – 0764) Volume 03– Issue XX, XXXXX 2014

Graph Transformation Rules With weight and Fuzzy Logic for Better Design Pattern Recognition Marcel Karam1, Sultan Aljahdali2, [email protected], [email protected] 1

Department of Computer Science, American University of Beirut, Lebanon

Hamid Mcheick3 [email protected]

Rasha Abdallah1, Hala Ollaic1

2 College of Computers and information Technology, Taif University, Kingdom of Saudi Arabia

3 Department of Math and Computer Science, University of Quebec at Chicoutim, Canada

{rma47, hao04}@aub.edu.lb

Abstract—The principal aim of this article is to demonstrate, using an example and proof, that associating design patterns’ graph transformation rules with weights can improve the fuzzy logic calculation used in the detection and recognition of design Patterns. We also demonstrate that our proposed weight augmentation can be applied to both static and dynamic analysis of a system under examination.

In the direction of static analysis for design pattern recognition, we investigated the technique in [25] which uses graph transformation rules and fuzzy logic. Our investigation revealed opportunities to improve the recognition rate by incorporating the concept of graph weight in the analysis of the graph transformation rules, and subsequently its use in the fuzzy logic calculations of the recognition rate.

Keywords-component; (Design Patterns, Reverse Engineering, Graph Theory, Fuzzy Logic)

The rest of this paper is organized as follows. In section II, we describe the preliminaries related to design pattern recognition. In Section III, we describe our observation on the recognition rate in [25], and describe the opportunities for improvements. In Section IV, we show, using an example how our proposed weighted graph transformation rules and fuzzy logic formula can improve the recognition rate. In Section V, we conclude and give recommendation for future work.

I.

INTRODUCTION

A design pattern is a general reusable solution for a commonly reoccurring software design problem. It is best described in UML [11] class diagrams where classes, methods, attributes, and their collaborations and relationships can be seen and studied. A design pattern is not a standard structural element, and does not follow certain grammatical concrete rules. It is subject to variation, both structurally and behaviorally. A design pattern can be implemented in various ways, making the detection and recognition of design patterns especially in Object Oriented software of legacy systems a challenging task. Design pattern detection and recognition techniques can be classified, in general, into static, static and dynamic, or hybrid. Static techniques disregard behavioral properties and attempt to identify structural similarities in selected patterns by analyzing entities such as: class inheritance, interface implementation, modifier of classes and methods, type and accessibility of attributes, etc. Examples of such techniques are the work that uses a fuzzy-like approach [20] and the similarity scoring algorithm found in [15, 18]. Static and dynamic techniques such as the work in [16, 19] consider method calls or message-flows between classes and use the static relationships to provide the context for analyzing the behavioral properties. Hybrid techniques like the work in [1, 9, 13] detect design patterns based on the notion of concept analysis. Visual language parsing techniques are also used [5]. Alternative techniques such as [23] takes into consideration that some methods often share the same style of representing information. Others such as the ones in [6, 14, 17] use UMLbased representation for the recognition.

www.ijcit.com

II.

RELATED WORK

A. Preliminaries The preliminaries in this section are intended to provide the reader with the required design pattern recognition background information. Given graphs G1 and G2, can one find in G2 a sub-graph which is “isometric” to G1? The answer to this question is normally found by applying an exact graph matching algorithm. Most applications that rely on graph theory want to find however a “somehow” similar or inexact graph rather than an “exact” one. This is especially true in pattern recognition areas such as face recognition, graphics, or in our case, design patterns. The inexact pattern matching algorithm answers the following question: given G1 and G2 can one find a sub-graph in G2 which “resembles” G1 “more or less”? The answer draws on knowledge from graph theory, and specifically attributed relational graph, and mathematical transformation rules. We will provide an overview for each next. 1) Attributed Relational Graphs The Attributed Relational Graphs (ARG) are graphs made of up nodes or entities, and edges or relationships between

1

International Journal of Computer and Information Technology (ISSN: 2279 – 0764) Volume 03– Issue XX, XXXXX 2014 these entities. With design pattern recognition, the ARG is the Abstract Syntax graph the (ASG), where nodes can be objects, functions, or attributes, and edges represent methods of interactions between these nodes such as function calls. A node is associated with a descriptive tuple (name, type, location, file number), for example: (“foo”, F, 38, 6) indicates that this node represents an entity named foo of type function located at line 38 in file 6. An Association is a group of nodes which share one or more common sink node satisfying a certain common property. An Association degree is the number of sink nodes shared by these nodes. The Association Support is the number of source nodes within an Association. In the case of design pattern recognition, the Association is a pattern definition rule, whereby more than one node, or ASG component, are built around one node (trigger) in such a way that the property being held between the different nodes is equivalent to the definition of a certain design pattern. The ARG is stored in the form of database regions which are a group of nodes sharing one or more sink nodes and loosely satisfying a certain Association A with respect to a node n. A in our case, the design pattern definition, is expressed in terms of the Architectural Query Language (AQL) which will query the abovementioned database for regions satisfying certain criteria. The ARG can be dissected into sub-regions whereby each region satisfies a predefined property. The A priori theorem is used to dissect the graph into regions and associate with each region a ranking which is calculated as the average of the maximum Association degree for each region.



For each subgraph in the region satisfying A, find the glue edges (edges that could not be transformed).



Having these as basis, try to make the needed graph transformation rules, and calculate the distance. Whenever a graph G1 is found, such as distance (GE, G2)

Suggest Documents