Changes between Version 2 and Version 3 of medea


Ignore:
Timestamp:
05/31/10 14:58:00 (7 years ago)
Author:
jlcanovas
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • medea

    v2 v3  
    11= Medea. A DSL for defining SMM textual metrics = 
    22 
    3 Medea is a DSL which allows you to specify SMM metrics in a textual way. Medea definitions are translated to SMM abstract syntax models by using Gra2Mol and then executed by the SMM engine. The following figure describes the execution process: 
     3Medea is a DSL which allows you to specify SMM metrics in a textual way. Medea definitions are translated to SMM abstract syntax models by using Gra2Mol and then executed by the SMM engine. The following figure describes the execution process for calculating metrics in a KDM model: 
    44 
    55{{{ 
     
    77<center><img style="width:850px;" src="http://modelum.es/trac/gra2mol/raw-attachment/wiki/medea/smmProcess.png"></center> 
    88}}} 
     9 
     10== Features == 
     11 * Textual DSL for defining SMM metrics 
     12 * SMM execution engine for SMM abstract syntax models 
     13 * Ant task to execute the process 
    914 
    1015== Download == 
     
    1419== Gra2MoL use == 
    1520 
     21Gra2MoL has been used in this project for specifying the textual concrete syntax of SMM. The language has allowed us to deal with the SMM abstract syntax metamodel directly. Moreover, the query language integrated into Gra2MoL allowed allowed us to resolver the identifier-based references of the Medea grammar. The following figure describes the Gra2MoL process defined for extracting SMM abstract syntax models from the Medea grammar: 
     22 
     23Medea is a DSL which allows you to specify SMM metrics in a textual way. Medea definitions are translated to SMM abstract syntax models by using Gra2Mol and then executed by the SMM engine. The following figure describes the execution process for calculating metrics in a KDM model: 
     24 
     25{{{ 
     26#!html 
     27<center><img style="width:400px;" src="http://modelum.es/trac/gra2mol/raw-attachment/wiki/medea/gra2molProcessB.png"></center> 
     28}}} 
     29 
     30As it is said previously, the defined grammar contains a number of identifier-based references between elements. The following snippet code shows a part of the grammar defined: 
     31 
     32{{{ 
     33smm_model:  
     34 'smm_model' ID ‘{’ elements* ‘}’ 
     35; 
     36 
     37elements :  
     38 libraries | scopes | charac |... 
     39; 
     40 
     41libraries :  
     42 'library' ID ‘{’ measures+ ‘}’ 
     43; 
     44 
     45measures :  
     46 ranking | dimensional 
     47; 
     48 
     49dimensional :  
     50 'dimensionalMeasure' name=ID ‘{’ 
     51   'scope' sc=ID  
     52   ('trait'tr=ID)?  
     53   'unit' un=ID 
     54   'type' type  
     55 ‘}’ 
     56; 
     57 
     58type :  
     59   'direct' ‘{’ 'operation' OP } 
     60 | 'collective' ‘{’  
     61      'accumulator' accumulator 
     62      'baseMeasure' bm=ID 
     63   ‘}’ 
     64 | ... 
     65; 
     66}}} 
     67 
     68An example of text conforms to the previous grammar is the following: 
     69 
     70{{{ 
     71smm_model myModel { 
     72 characteristic ModuleCount 
     73 scope codeModel{ 
     74  class code::CodeModel 
     75 } 
     76 scope AbstractCodeElement{ 
     77  class code::AbstractCodeElement 
     78 } 
     79 library myLibrary{ 
     80  dimensionalMeasure ModuleCount{ 
     81   scope codeModel 
     82   trait ModuleCount 
     83   unit code::Module 
     84   type collective{ 
     85    accumulator sum 
     86    baseMeasure ModuleCountRecognizer    
     87   } 
     88  } 
     89  dimensionalMeasure ModuleCountRecognizer{ 
     90   scope AbstractCodeElement 
     91   trait ModuleCount 
     92   unit code::Module 
     93   type direct{ 
     94    operation "oclIsTypeOf(code::Module)" 
     95   } 
     96  }   
     97 } 
     98} 
     99}}} 
     100 
     101And this is an example of Gra2MoL rule used for extracting SMM model element. This rules is in charge of obtaining DimensionalMeasure elements and initializing its attributes.  
     102 
     103{{{ 
     104#!html 
     105<center><img style="width:850px;" src="http://modelum.es/trac/gra2mol/raw-attachment/wiki/medea/gra2molRule.png"></center> 
     106}}} 
     107 
     108The attributes name, unit and accumulator use the result of the queries measure and accumulator, which extract the information from the node received by the rule in the from part (i.e. fromNode variable). On the other hand, for initializing the attributes scope, trait, baseMeasure and library, the queries locatedScope, locatedCharac, locatedBaseMeasure and locatedLibrary are defined, respectively. The first three queries traverse the syntax tree for locating the desired grammar node, for instance, the locatedScope query looks for the Scope grammar node by using the query //elements/#scopes. However, the query called locatedLibrary is necessary to locate in which library block the measure is located. Thus, this query is in charge of traversing the syntax tree to located the library grammar node which contains the measure. 
    16109 
    17110 
    18