Main Page/Resources/MTBenchmark/JavaQueries

From Atenea

Jump to: navigation, search

Contents

Java Queries

The JavaQuery case study was proposed in the Transformation Tool Contest (TTC) 2009 for supporting reverse engineering [1].

With this case study we have incorporated to our benchmark a large metamodel with complex inheritance structures and package definitions that represents a more realistic example than the rest of (rather) simple metamodels used in the rest of the test cases, and hence a more realistic scenario.

Another interesting characteristic of this case study is that the transformation has a rule with a complex filter from which several helpers are called.

Metamodels

Input metamodel

Download JDTAST.ecore or show JDTAST.ecore tree view

Output metamodel

Download View.ecore or show View.ecore tree view

Image:View.png

Transformation

As an example, in the following we show the ATL transformation for this case study. The code can be downloaded from here.

module Q1;
create OUT: MM1 from IN: MM;
helper context MM!TypeDeclaration def: methodsWithReturnType : Sequence(MM!MethodDeclaration) =
   self.bodyDeclarations -> select( e | e.oclIsKindOf (MM!MethodDeclaration)) -> select (e | not e.returnType.oclIsUndefined())
;
helper context MM!BodyDeclaration def: isPublic : Boolean =
   self.modifiers -> select (m | m.oclIsTypeOf (MM!Modifier)) -> exists (m | m.public)   
;
helper context MM!BodyDeclaration def: isStatic : Boolean =
   self.modifiers -> select (m | m.oclIsTypeOf (MM!Modifier)) -> exists (m | m.static)   
;
rule Q1 {
   from
      s: MM!TypeDeclaration (s.methodsWithReturnType
           -> select (e | e.isPublic) -> select (e | e.isStatic)
           -> select (e | e.returnType.oclIsKindOf(MM!QualifiedType) or 
                           e.returnType.oclIsKindOf(MM!SimpleType))
           -> exists (e | e.returnType.name.fullyQualifiedName = s.name.fullyQualifiedName)
       )
   to
      v_class: MM1!Class (
         name <- s.name.fullyQualifiedName
      )
}

Input models

The input models can be downloaded from this link provided by the authors of the TTC case study.

References

[1] Sottet, J.S., Jouault, F.: Program comprehension. Proc. 5th Int. Workshop on Graph-Based Tools (2009)

Personal tools