Representing feature models as class diagrams Abel Gómez, Isidro Ramos Technical University of Valencia. Departamento de Sistemas Informáticos y Computación. 1 Abel Gómez, Isidro Ramos - Universidad Politécnica de Valencia
Metamodels 2 Abel Gómez, Isidro Ramos - Universidad Politécnica de Valencia
Notation Binary relationships: Mandatory Optional Groupped relationships: Alternative (XOR) XOR Czarnecki-Eisenecker notation Extended Czarnecki- Eisenecker notation XOR with optional subfeatures Optional (OR) * Figures from ŠÍPKA, M.: Exploring the Commonality in Feature Modeling Notations. In: IIT.SRC 2005 Informatics and Information Technology Student Research Conference. Bratislava, April 2005, V. Vranić (supervisor), pp. 139 144. Abel Gómez, Isidro Ramos - Universidad Politécnica de Valencia
Feature metamodel In the feature metamodel the previous relationships are described by using the lowerbound and upperbound attributes. We have also extended the metamodel in order to enrich the features with attributes. Abel Gómez, Isidro Ramos - Universidad Politécnica de Valencia
Simplified UML-Class diagram metamodel We use Ecore as a simplified version of the UML Class diagram metamodel. * Simplified subset of the Ecore metamodel 5 Abel Gómez, Isidro Ramos - Universidad Politécnica de Valencia
Transformation From feature models to class diagrams 6 Abel Gómez, Isidro Ramos - Universidad Politécnica de Valencia
Feature2Class Each feature is transformed to a class (Eclass). 7 Abel Gómez, Isidro Ramos - Universidad Politécnica de Valencia
Feature2Class model : FeatureModel name = modelname feature : Feature classdiagram E pkg : EPackage name = modelname nsprefix = modelname nsuri modelname class : EClass eclassifiers 8 Abel Gómez, Isidro Ramos - Universidad Politécnica de Valencia
FeatureAttribute2ClassAttribute Each feature attribute is transformed to a class attribute (EAttribute). The type of the attribute is transformed to a EDataType. 9 Abel Gómez, Isidro Ramos - Universidad Politécnica de Valencia
FeatureAttribute2ClassAttribute model : FeatureModel name = modelname pkg : EPackage name = modelname nsprefix = modelname nsuri modelname eclassifiers feature : Feature type : EDataType name = featureatttype, instancetypename java.lang featureatttype attributes class : EClass featureattribute : Attribute name = featureattname, type = featureatttype type : EDataType etype estructuralfeatures eattribute : EAttribute name = featureattname 10 Abel Gómez, Isidro Ramos - Universidad Politécnica de Valencia
SimpleRelationship2Reference Each BinaryRelationship is transformed to a UML composition (containment EReference). The type of relationship determines de multiplicity of the EReference. 11 Abel Gómez, Isidro Ramos - Universidad Politécnica de Valencia
SimpleRelationship2Reference model : FeatureModel name = modelname nsuri pkg : EPackage modelname eclassifiers feature : Feature childclass : EClass name = childfeatname attributes class : EClass relationship : BinaryRelationship lowerbound = lower upperbound = upper estructuralfeatures childfeature child : Feature name = childfeatname childclass : EClass etype reference : EReference name = childfeatname containment = true lowerbound = lower upperbound = upper 12 Abel Gómez, Isidro Ramos - Universidad Politécnica de Valencia
MultipleRelationship2Reference Each GrouppedRelationship is transformed to a containment EReference. Each child feature inherits from a new class whose name derives from the parent feature. The inheritance relationship is set in the relation «MultipleRelationshipChilds2Classes» 13 Abel Gómez, Isidro Ramos - Universidad Politécnica de Valencia
MultipleRelationship2Reference typeclass : EClass Type abstract = true model : FeatureModel name = modelname eclassifiers eclassifiers classdiagram pkg : EPackage childclass : EClass E nsuri modelname name = childfeatname feature : Feature eclassifiers attributes relationship : GrouppedRelationship lowerbound = lower upperbound = upper childfeature child : Feature name = childfeatname parentclass : EClass reference : EReference containment = true lowerbound = lower upperbound = upper where MultipleRelationshipChilds2Classes(childFeature, typeclass, childclass); MultipleRelationshipChilds2Annot(childFeature, featurename, parentclass); estructuralfeatures Features etype typeclass : EClass 14 Abel Gómez, Isidro Ramos - Universidad Politécnica de Valencia
MultipleRelationshipChilds2Classes feature : Feature parentclass : EClass classdiagram E esupertypes typeclass : EClass typeclass : EClass typeclass : EClass 15 Abel Gómez, Isidro Ramos - Universidad Politécnica de Valencia
MultipleRelationshipChilds2Annot When the upperbound of the GrouppedRelationship is greater than 1, we can automatically generate OCL invariants to avoid duplicated elements in the feature model instance. 16 Abel Gómez, Isidro Ramos - Universidad Politécnica de Valencia
MultipleRelationshipChilds2Annot feature : Feature parentclass : EClass classdiagram E eannotations parentclassname : String oclannot : EAnnotation source details oclentry : EStringToStringMapEntry key multiplicity featurename value = oclexpresion where oclexpression = 'self.' + parentclassname + 'Features->select(f : ' + parentclassname + 'Type f.ocliskindof(' + featurename + '))->size() <= 1' 17 Abel Gómez, Isidro Ramos - Universidad Politécnica de Valencia
MultipleRelationshipChilds2Annot These OCL invariants can be checked automatically. In the example, the screenshot on the right has a duplicated module (Calendar). Moreover, any OCL invariant can be defined in order to check the consistency of the feature model instance. 18 Abel Gómez, Isidro Ramos - Universidad Politécnica de Valencia
Representing feature models as class diagrams Abel Gómez, Isidro Ramos Technical University of Valencia. Departamento de Sistemas Informáticos y Computación. 19 Abel Gómez, Isidro Ramos - Universidad Politécnica de Valencia