Arnaud Blouin

Arnaud Blouin

Associate Professor INSA Rennes
Member of the Triskell Team (INRIA/IRISA)
Campus universitaire de Beaulieu, 35042 Rennes, France

phone: +332 99 84 25 54
mail: arnaud.blouin at_ irisa.fr

img
QR Code





Malai | Kompren | Malan |

Kompren

Description

Model slicing is a model comprehension technique inspired by program slicing. The process of model slicing involves extracting a subset of model elements which represent a model slice. The model slice may vary depending on the intended purpose. For example, when seeking to understand a large class diagram, extracting from a class diagram a subset composed of all the dependencies of a particular class of interest may help. For another comprehension purpose one might want a flat view of all references and attributes inherited by a class of interest.

Kompren is a DSML to model model slicers for a particular domain (captured in a metamodel). The knowledge gained from practical experience and current model slicers, lead to the design choices of the Kompren language. The primary objective of Kompren is the selection of classes and properties in an input metamodel. Kompren promotes the definition of slicers that slice all necessary elements to make the slice a valid instance of the input metamodel. Kompren also facilitates the relaxation of the conformance required by the input metamodel. Kompren offers a set of language features to generate model slicers that can still be parameterized to process the model slice for a specific purpose. The different characteristics of Kompren tackle two goals for our generative approach: automatically building model slicers for any DSML; have model slicers that can extract different forms of slices, depending on the purpose of the slice.


Key words

Model slicing, Model-Driven Engineering (MDE)


Development

The Kermeta implementation of Kompren is distributed under the terms of the GNU General Public License and the EPL license.

Kompren 2 will be released early June with Kermeta2! This new release is based on Kermeta 2 and provides developers with a textual editor, a reflexive ecore editor, and a new compiler.

Kompren 1 is composed of: a reflexive ecore editor running on the top of Eclipse IDE; a compiler transforming a model slicer model into a model slicer function that executes the slicing operation. The Kompren metamodel is provided with the compiler. A textual editor based on the Kompren textual DSL will be provided soon.

More information about how to define a model slicer and several tutorials will appear soon (with Kermeta2 early June).


Concrete Syntax

The textual editor is currently in a testing process. It will be released with Kermeta2 soon (early June)!

The Kompren concrete syntax is explained throughout the following examples.


/* This endogenous slicer extracts subsets of ecore models. */
// If the slicer is defined as strict, the elements required to assure 
// the semantic properties are sliced as well (even if not defined in the slicer).
slicer strict StrictEcore {
	// 'domain' defines the URI of the input metamodel (an ecore model).
	// The format of the URI can be:
	//   - "platform:/resource/../nameMetamodel.ecore"
	//   - "platform:/plugin/../nameMetamodel.ecore"
	//   - "nameMetamodel.ecore"
	//   - "../folder/nameMetamodel.ecore"
	//   - "http://..."
	domain: "http://www.eclipse.org/emf/2002/Ecore"
	// 'input' specifies the type of the slicing criteria.
	// Several inputs can be defined like this:
	//   input: ecore.EClass, ecore.EStructuralFeature
	// Each input must be fully resolved (all the packages must precede the name of the input).
	input: ecore.EClass
	// The classes that must be part of the output slices.
	// If the class is abstract, all its concrete sub-classes will be sliced.
	slicedClass: ecore.ENamedElement
	// The relations that must be explored during the slicing process.
	slicedProperty: ecore.EClass.eSuperTypes
	slicedProperty: ecore.EClass.eStructuralFeatures
	slicedProperty: ecore.ETypedElement.eType
	slicedProperty: ecore.EClass.eOperations
	slicedProperty: ecore.EOperation.eParameters
	slicedProperty: ecore.EEnum.eLiterals
	slicedProperty: ecore.ENamedElement.name
}


/* This exogenous slicer displays the name of the sub-classes of the input classes. */
slicer InvertedClassModelSlicer{
	domain: "platform:/resource/org.kermeta.kompren.slicer.compiler/examples/class/ClassModel.ecore"
	input: ex.classModel.Clazz
	// Each sliced class can have	an identifier (here 'clazz') that can be used in the expression.
	slicedClass: ex.classModel.Clazz clazz 
	// Non-strict slicers can define expressions on the sliced classes/properties
	// Expressions are Kermeta 2 expressions.
		[[stdio.writeln("class: " + clazz.name)]]
	// Each sliced property can have two identifiers (here 'src' and 'tgt') corresponding to the
	// source and target elements of the relation.
	// 'opposite' defines that an opposite will be created and explored.
	// The identifier between the parentheses is the name of the created opposite.
	slicedProperty: ex.classModel.Clazz.superClasses opposite(lowerType) src tgt 
		[[stdio.writeln(tgt.name + "subclass of" + src.name)]]
}


/* This exogenous slicer displays the name of the unused variables of Kermeta operations. */
slicer UnusedVarDetector {
	domain: "./kermeta.ecore"
	input: org.kermeta.language.structure.Operation
	slicedClass: org.kermeta.language.behavior.VariableDecl varDecl 
		[[		varDecls.add(varDecl)]]
	slicedClass: org.kermeta.language.behavior.CallVariable callVar 
		[[		if(not callVar.staticType.isVoid) then
			var varDecl : VariableDecl init varDecls.detect{varD |
				varD.containedType.contains(callVar.staticType)
			}
			
			if(varDecl.isVoid) then
				var varParam : Parameter init params.detect{param | param.type==callVar.staticType }
				if(not varParam.isVoid) then
					params.remove(varParam)
				end
			else
				varDecls.remove(varDecl)
			end
		end]]
	slicedClass: org.kermeta.language.structure.Parameter param 
		[[		if(param.~operation.superOperation.isVoid) then
			params.add(param)
		end]]
	slicedProperty: org.kermeta.language.behavior.Block.statement
	slicedProperty: org.kermeta.language.behavior.Conditional.elseBody
	slicedProperty: org.kermeta.language.behavior.Conditional.thenBody
	slicedProperty: org.kermeta.language.behavior.Raise.expression
	slicedProperty: org.kermeta.language.behavior.Loop.initialization
	slicedProperty: org.kermeta.language.behavior.Loop.body
	slicedProperty: org.kermeta.language.behavior.LambdaExpression.body
	slicedProperty: org.kermeta.language.behavior.Rescue.body
	slicedProperty: org.kermeta.language.behavior.CallExpression.parameters
	slicedProperty: org.kermeta.language.behavior.Assignment.value
	slicedProperty: org.kermeta.language.structure.Operation.ownedParameter
	slicedProperty: org.kermeta.language.structure.Operation.body
	// 'onEnd' defines the Kermeta 2 code that will be executed as the post-processing step of the slicing process.
	// Similarly, 'onStart' defines a pre-processing step.
	onEnd [[		varDecls.each{varD | stdio.writeln("Variable unused: " + varD.identifier) }
		params.each{param | stdio.writeln("Parameter unused: " + param.name) }]]
	// 'helper' contains Kermeta 2 expressions can be used into other expressions.
	// the helper can contain 'require' and 'using' expressions.
	helper [[	reference varDecls : VariableDecl[0..*]
	reference params : Parameter[0..*]]]
}


TODO: explain constraint, radius, active, option.


Related Publications

2011 Blouin A., Combemale B., Baudry B., Beaudoux O. Modeling Model Slicers, ACM/IEEE 14th International Conference on Model Driven Engineering Languages and Systems (MODELS'11), (AR: 20%)
@INPROCEEDINGS{BLO11b,
  author = {Arnaud Blouin and Beno\^it Combemale and Benoit Baudry and Olivier Beaudoux},
  title = {Modeling Model Slicers},
  booktitle = {ACM/IEEE 14th International Conference on Model Driven Engineering Languages and Systems (MODELS'11)},
  year = {2011},
  volume = {6981},
  pages = {62--76},
  publisher = {Springer Berlin / Heidelberg},
  doi = {10.1007/978-3-642-24485-8_6}
}
     

Last update: 2012-04-05