Giter Site home page Giter Site logo

arnobl / kompren Goto Github PK

View Code? Open in Web Editor NEW
1.0 5.0 3.0 30.23 MB

Modelling and Generating Model Slicers with Kompren

License: Eclipse Public License 1.0

Java 68.62% Xtend 30.10% Scala 1.28%
model-driven-engineering model-slicing emf ecore java xtext eclipse

kompren's Introduction

Kompren

An eclipse tool for modelling and generating model slicers.

Papers on Kompren:

Tutorials

This section contains a serie of tutorials to help start the learning of the language and its syntax.

Defining a Slicer

slicer Slicer1 {
 	domain : 'platform:/resource/test/src/main/ex1.genmodel' 
 	input : ex1.A 
 }

A model slicer is a tool that extracts a subset of model elements for a specific purpose. This is the root concept of the Kompren language. Type slicer.

The name of the slicer must be defined. The name of the slicer. The expected format is a qualified named (e.g., pkg1.Class1). In our example, type: Slicer1 .

Type {.

The source metamodel URIs must be defined. It defines the URI of the Ecore models used to define the slicer. The slicer will be based on the model elements of these metamodels. Genmodels of the metamodels must be provided here. The expected format is a string literal (between double quotes). Type domain :. Then, give the value, here: 'platform:/resource/test/src/main/ex1.genmodel' .

The input classes must be defined. It defines the classes of the input metamodels that will be considered during the slicing process. The expected format is a qualified named (e.g., pkg1.Class1). Type input :. Then, give the value, here: ex1.A .

Type }.

Defining a helper

slicer Slicer1 {
 	domain : 'platform:/resource/test/src/main/ex1.genmodel' 
 	input : ex1.A 
 	helper [[ println("Defining the helper")
// data can be used in all the expressions of the slicer.
val data = newArrayList() ]]
 
 }

It defines a block of statements (written in Kermeta3), such as variables, operations, that can be used in other blocks (e.g. onStart). Then, give the value, here: [[ println("Defining the helper") // data can be used in all the expressions of the slicer. val data = newArrayList() ]] .

See also:
Defining a Slicer

Defining a pre-execution code block

slicer Slicer1 {
 	domain : 'platform:/resource/test/src/main/ex1.genmodel' 
 	input : ex1.A 
 	onStart [[ println("starting the slicing process!") ]]
 
 }

It defines a block of Kermeta 3 statements that are executed before the slicing process. Then, give the value, here: [[ println("starting the slicing process!") ]] .

See also:
Defining a Slicer

Defining a post-execution code block

slicer Slicer1 {
 	domain : 'platform:/resource/test/src/main/ex1.genmodel' 
 	input : ex1.A 
 	onEnd [[ println("ending the slicing process.") ]]
 
 }

It defines a block of Kermeta 3 statements that are executed after the slicing process. Then, give the value, here: [[ println("ending the slicing process.") ]] .

See also:
Defining a Slicer

Defining a Radius

slicer Slicer1 {
 	domain : 'platform:/resource/test/src/main/ex1.genmodel' 
 	input : ex1.A 
 	radius : 	ex1.A 

 }

The radius is used to filter the sliced elements in the input model. The radius works as follows: Starting at 0, a value is incremented on each visited class instance focused by the radius. The slicing process stops when no elements can be sliced anymore or when this value is greater than the radius given as parameter. The value of the radius is specificed by the user of the slicer. The classes of the radius must be defined. The expected format is a qualified named (e.g., pkg1.Class1). Then, give the value, here: ex1.A .

See also:
Defining a Slicer

Defining a SlicedClass

slicer Slicer1 {
 	domain : 'platform:/resource/test/src/main/ex1.genmodel' 
 	input : ex1.A 
 	slicedClass : 	ex1.A 

 }

When a sliced class is selected from the input metamodels, instances of this class will be sliced and put in the output model slice. The sliced element must be defined. It defines the element of metamodel targeted by this slicing feature. The expected format is a qualified named (e.g., pkg1.Class1). Then, give the value, here: ex1.A .

See also:
Defining a Slicer

Defining an optional element to slice

slicer Slicer1 {
 	domain : 'platform:/resource/test/src/main/ex1.genmodel' 
 	input : ex1.A 
 	slicedClass : ex1.A option
 }

If optional, an option will be added to the slicer to state whether this slicing element has to be considered during the slicing. Type option.

See also:
Defining a Slicer
Defining a SlicedClass

Defining An expression

slicer Slicer1 {
 	domain : 'platform:/resource/test/src/main/ex1.genmodel' 
 	input : ex1.A 
 	slicedClass : ex1.A [[ println("Slicing a " + theA) ]]
 
 }

It defines the Xtend code executed when an instance of this element is sliced. It does not work with strict slicer. An expression must be defined. It defines the Xtend code executed when an instance of this element is sliced. It does not work with strict slicer. The expected format is a block of Xtend code (between [[ ]]). In our example, type: [[ println("Slicing a " + theA) ]] .

See also:
Defining a Slicer
Defining a SlicedClass

Defining a Constraint

slicer Slicer1 {
 	domain : 'platform:/resource/test/src/main/ex1.genmodel' 
 	input : ex1.A 
 	slicedClass : ex1.D 	constraint : checkDAttr [[ theD.dAttr ]]
 

 }

A constraint can be added to restrict the slicing process. The produced slicer will have a parameter to state whether this constraint has to be used. The name of the constraint must be defined. It defines the name of the constraint that will be the name of the corresponding parameter of the slicer. The expected format is a simple variable name (i.e. must follow the Java naming convention). In our example, type: checkDAttr .

The boolean expression of the constraint must be defined. It defines the predicate (to write in Xtend) that will be used to checked whether the constraint can be applied. The expected format is a block of Xtend code (between [[ ]]). In our example, type: [[ theD.dAttr ]] .

See also:
Defining a Slicer
Defining a SlicedClass

Defining a VarDecl

slicer Slicer1 {
 	domain : 'platform:/resource/test/src/main/ex1.genmodel' 
 	input : ex1.A 
 	slicedClass : ex1.A 	theA 

 }

In some cases, a variable declaration to required to perform some actions while slicing a model. varName must be defined. It defines the name of the declared variable. The expected format is a simple variable name (i.e. must follow the Java naming convention). Then, give the value, here: theA .

See also:
Defining a Slicer
Defining a SlicedClass

Defining a strict slicer

slicer strict Slicer1 {
 	domain : 'platform:/resource/test/src/main/ex1.genmodel' 
 	input : ex1.A 
 	slicedClass : 	ex1.A 

 }

It defines a slicer as a strict slicer. A strict slicer produces as output a model that is always conformed to its input metamodel. This means that some classes, relations, attributes may be sliced while not selected by the user. Type strict.

See also:
Defining a Slicer
Defining a SlicedClass

Defining a SlicedProperty

slicer Slicer1 {
 	domain : 'platform:/resource/test/src/main/ex1.genmodel' 
 	input : ex1.A 
 	slicedProperty : 	ex1.A.d 

 }

When a property is selected from the input metamodels, instances of this property will be sliced and put in the output model slice. The sliced element must be defined. It defines the element of metamodel targeted by this slicing feature. The expected format is a qualified named (e.g., pkg1.Class1). Then, give the value, here: ex1.A.d .

See also:
Defining a Slicer

Defining a OppositeCreation

slicer Slicer1 {
 	domain : 'platform:/resource/test/src/main/ex1.genmodel' 
 	input : ex1.A 
 	slicedProperty : ex1.C.ce 	opposite ( ceOpposite )

 }

An opposite can be used when the slicer has to go throw a relation in its opposite way. The name of the opposite reference must be defined. It defines the name of the new relation that goes in the opposite way than the relation specified. The expected format is a simple variable name (i.e. must follow the Java naming convention). Type opposite (.

Then, give the value, here: ceOpposite .

Type ).

See also:
Defining a Slicer
Defining a SlicedProperty

kompren's People

Contributors

arnobl avatar dvojtise avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

kompren's Issues

Kompren opposites do not call the correct onXXXSliced operation

For instance with Ecore and a lowerType opposite:

    if(theSlicer.optionlowerType){
    _self.^lowerType.forEach[_elt| _elt.visitToAddRelations(theSlicer)
        if(_self.sliced && _elt.sliced) theSlicer.oneSuperTypeSliced(_self, _elt)
    ]
    }

The operation oneSuperTypeSliced is called instead of onlowerTypeSliced

The ops feedOpposites do not call their super op

For instance:

@OverrideAspectMethod
def void feedOpposites(){

_self.^ESuperTypes.forEach[^lowerType.add(_self)]
_self.^EOperations.forEach[feedOpposites]
_self.^EStructuralFeatures.forEach[feedOpposites]
_self.^EGenericSuperTypes.forEach[feedOpposites]

}

should call its super feedopposites op.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.