(Syql) an Abstraction Layer for Querying Software Models
Total Page:16
File Type:pdf, Size:1020Kb
System Query Language (SyQL) An Abstraction Layer for Querying Software Models By: Dott. Ing. Mirco Bianco Faculty Supervisor: Prof. Werner Nutt External Supervisor: Prof. Ernesto Damiani A thesis submitted for the degree of Doctor of Philosophy Faculty of Computer Science Free University of Bozen-Bolzano April 2012 Dedico questo lavoro a chi per qualsiasi motivo, lo consulterà. E mi auguro che, in queste pagine, riesca a trovare qualcosa di utile. Table of Contents 1 Introduction................................................................................................................1 1.1 Problem Statement..............................................................................................3 1.2 Goals...................................................................................................................4 1.3 Methodology.......................................................................................................5 1.4 Publications.........................................................................................................6 1.5 Thesis Organization............................................................................................7 2 Motivations...............................................................................................................11 2.1 First Motivation – The language aspect............................................................11 2.2 Second Motivation – Object-Oriented Facilities..............................................15 2.3 Third Motivation – Linguistic Variables...........................................................19 2.4 Fourth Motivation – Conciseness.....................................................................21 2.5 Fifth Motivation – Handling Uncertainty Without Affecting the Schema........23 3 Related work.............................................................................................................31 3.1 Software Measurement Theory.........................................................................31 3.2 Automated In-process Software Engineering Measurement and Analysis Systems....................................................................................................................34 3.3 Domain Specific Languages – DSL.................................................................36 3.3.1 DSLs Implementation Patterns.................................................................39 3.4 Software Fault-Proneness Prediction................................................................41 3.5 Similar Tools ....................................................................................................47 3.5.1 Language INtegrated Query – LINQ........................................................49 3.5.2 fuzzySQL..................................................................................................50 3.5.3 SQLf..........................................................................................................51 3.5.4 Semmle – .QL ..........................................................................................52 3.5.5 dmFSQL....................................................................................................53 3.5.6 SCQL ........................................................................................................55 3.5.7 NDepend – CQL.......................................................................................56 3.5.8 COOR – CQL...........................................................................................57 4 The PROM System...................................................................................................59 4.1 The Architecture...............................................................................................59 4.2 Software Metrics Extractors.............................................................................60 i 4.2.1 Code Meta-Model.....................................................................................60 4.2.2 C# Metrics Extractor ................................................................................63 4.2.2.1 Preprocessor...........................................................................................65 4.2.2.2 Parser......................................................................................................65 4.2.3 Java Metrics Extractor..............................................................................67 4.3 Where SyQL is placed......................................................................................70 5 System Query Language – SyQL.............................................................................71 5.1 Language Structure ..........................................................................................72 5.2 Data Model.......................................................................................................78 5.3 Language Semantics.........................................................................................80 5.3.1 Mapping of a relational database schema into a SyQL schema................84 5.4 Architecture.......................................................................................................91 5.5 SyQL Query Planning and Execution...............................................................96 5.5.1 The Main Approach..................................................................................96 5.5.2 Query Data Flow.......................................................................................97 5.5.3 SQL Translation .....................................................................................100 5.6 Support for Linguistic Variables ....................................................................103 5.6.1 Implementation.......................................................................................104 5.6.2 Linguistic Variables and Software Metrics.............................................105 5.7 Optimizations..................................................................................................112 5.7.1 Conditions Sorting..................................................................................112 5.7.2 Parallel Execution...................................................................................114 5.7.3 Concept Tuning.......................................................................................114 5.8 Available Concepts..........................................................................................115 5.8.1 Class........................................................................................................118 5.8.2 Method and TestMethod.........................................................................120 5.8.3 Bug and ClosedBug................................................................................122 5.8.4 User.........................................................................................................123 5.8.5 Chronon...................................................................................................123 5.8.6 Util..........................................................................................................124 6 Extensibility............................................................................................................125 6.1 How to Implement New Concepts..................................................................126 ii 6.1.1 Step 1 – SQL Definition..........................................................................127 6.1.2 Step 2 – Definition of Attributes and Constructors.................................129 6.1.3 Step 3 – Definition of the Materialization Logic....................................131 6.1.4 Step 4 – Definition of the Equivalence and Hashing Properties.............133 6.1.5 Step 5 – Definition of the External Methods..........................................135 6.1.6 Step 6 – Definition of the Internal Methods...........................................136 6.2 How to Implement New Fuzzy Evaluators.....................................................140 6.2.1 Step 1 – Definition of the Measure and of the Evaluation Logic...........140 6.2.2 Step 2 – Definition of the Fuzzy Evaluator.............................................142 7 Performance Evaluation.........................................................................................144 7.1 Abstraction Layer Assessment........................................................................144 7.1.1 Testing Methodology and Infrastructure.................................................144 7.1.2 Number of Concepts...............................................................................146 7.1.3 Number of Cores.....................................................................................151 7.1.4 Discussion...............................................................................................155 7.2 Language Assessment.....................................................................................156 8 Limitations..............................................................................................................158 8.1 Only Domain Specific – Data Manipulation Language.................................158 8.2 No Closure......................................................................................................161 8.3 Query Planning...............................................................................................163 9 Validation................................................................................................................165