SMartyParser: an XMI Parser for UML-based Software Product Line Variability Models
1. SMartyParser:
an XMI Parser for
UML-based Software Product Line
Variability Models
Leandro A. Lanceloti
State University of Maringá (DIN-UEM) – Brasil
José C. Maldonado
University of São Paulo (ICMC-USP) – Brasil
Itana M. S. Gimenes
State University of Maringá (DIN-UEM) – Brasil
Edson A. Oliveira Junior
edson@din.uem.br
State University of Maringá (DIN-UEM) - Brasil
2. Outlines
l Introduction
l XMI for Metadata Interchange
l The Parser for UML-based SPLs
l SMartyParser Running Example
l Conclusions and On Going Works
SMartyParser: a XMI Parser for UML-based Variability Models – VaMoS 2013 – Edson Jr. 2
3. Introduction
l Variability Management (VM) is a key issue for the success of
SPLs
l Literature presents several well-known approaches for VM,
specially object-oriented
l Several tools have been developed, such as, pure::variants and
SPLOT
l however, a subset of the VM approaches is UML-based and
requires automated support for UML models
l Tools have particular means to handle variabilities
SMartyParser: a XMI Parser for UML-based Variability Models – VaMoS 2013 – Edson Jr. 3
4. Introduction
l Supporting for UML-based SPL models might be
provided by XMI files
l Several questions:
l How to handle UML-based SPLs models containing variability in a
particular environment?
l Do you have to adapt your environment to comply to existing tools?
l How do you interchange SPL metadata between different environments?
l …
SMartyParser: a XMI Parser for UML-based Variability Models – VaMoS 2013 – Edson Jr. 4
5. The OMG’s XMI Standard
l XMI is the OMG’s standard for metadata interchanging
l Plain XML parsers do not accurately support XMI files
1 <?xml version = '1.0' encoding = 'UTF-8' ?>
2 <XMI xmi.version = '1.2'
3 xmlns:UML = 'org.omg.xmi.namespace.UML'
4 xmlns:UML2 = 'org.omg.xmi.namespace.UML2'
5 timestamp = 'Tue Mar 06 20:22:06 BRT 2012'>
6 <XMI.content>
7 <UML:Diagram xmi.id = 'Iae204f0m135cde62a90mm58a3'
8 isVisible = 'true'
9 name = 'AGM - Core Assets'
10 zoom = '0.91'>
11 <UML:GraphElement.semanticModel>
12 <UML:SimpleSemanticModelElement
13 xmi.id = 'Iae204f0m135cde62a90mm7e5f'
14 typeInfo = 'ClassDiagram'/>
15 </UML:GraphElement.semanticModel>
16 <UML:GraphElement.contained>
17 ...
SMartyParser: a XMI Parser for UML-based Variability Models – VaMoS 2013 – Edson Jr. 5
18 ...
7. The SMartyParser
l SMartyParser stands for Stereotype-based Management
of Variability Parser
l It is aimed at processing XMI files of UML-based SPL models in
which variabilities are represented by means of stereotypes
(UML profiles)
l It was built taking as a basis the Open Core Framework,
from the SDMetrics project
l Open Core provides Java classes for:
l Parsing XMI files
l Define and apply metrics for OO models
SMartyParser: a XMI Parser for UML-based Variability Models – VaMoS 2013 – Edson Jr. 7
8. SMartyParser Class Diagram
SMartyParser Class Model
com.sdmetrics.model
* 1 1
MetaModelElement MetaModel
1 1
br.uem.din.les.parserxmi
* * *
* 1 1 1 1 1
ModelElement Model XMIReader ProductLineModelParser
*
XMITrigger
IProductLineVariabilityParser
*
1 1 IProductLineUMLModelParser
* 1
XMITransformation
Transformati XMITransformations
Figure 4: The SMartyParser Class Model.
SMartyParser: a XMI Parser for UML-based Variability Models – VaMoS 2013 – Edson Jr. 8
9. Figure 4: The SMartyParser Class Model.
SMartyParser Available Operations
Table 1: The SMartyParser Available Operations.
Interface Method Description
getAllDiagrams Get all diagrams from the UML model
IProductLineUM
getStructureDiagrams Get structural diagram
LModelParser
getBehaviourDiagrams Get behavioral diagrams
getInteractionDiagrams Get interaction diagrams
getElementsByDiagram Get all elements of a given diagram
getElementsByDiagramByType Get all elements of a given diagram by type
getElementByID Get an element by its ID
getElementsByType Get all elements of a given type
getAllVariabilities Get all variabilities (as UML comments)
IProductLineVariabilityParser
getAllVariationPoints Get all variation points
getAllVariables Get all variable elements
getOptionalVariants Get all optional variants
getMandatoryVariants Get all mandatory variants
getInclusiveVariants Get all inclusive variants
getExclusiveVariants Get all exclusive variants
getVariabilityByName Get a variability by its name
getVariantsOfAVariability Get all variants of a given variability
getVariationPointOfAVariant Get the variation point of a given variant
getChildrenVariabilities Get all child variabilities from a given variability
getVariantRequiredElements Get all variants required by a given variant
getVariantMutexElements Get all mutually exclusive variants of a given variant
SMartyParser: a XMI Parser for UML-based Variability Models – VaMoS 2013 – Edson Jr. 9
10. The SMartyParser
l SMartyParser was conceived based on the main UML-
based variability management concepts:
l Variation Point
l Variant (mandatory, optional, inclusive, exclusive)
l Constraints between Variants (requires, mutex)
SMartyParser: a XMI Parser for UML-based Variability Models – VaMoS 2013 – Edson Jr. 10
11. SMartyParser Configuration
Table 2: The SMartyParser Configuration File Ta
Properties
Available Properties. Ste
Property Description
uml_version the UML version
xmi_version the XMI version
related
XMI-
xmi_xtf_file_location the XTF file location
xmi_mdf_file_location the MDF file location
xmi_model_file_location the XMI file location
the stereotype used for representing
variability_stereotype
variabilities
the stereotype used for representing
variation_point_stereotype
variation points
the stereotype used for representing
mandatory_variant
mandatory variants
Stereotype-related
the stereotype used for representing
optional_variant
optional variants
the stereotype used for representing
inclusive_variant
inclusive variants
the stereotype used for representing
exclusive_variant
exclusive variants
the stereotype used for representing
variable_stereotype
variable elements
the stereotype used for representing
require_constraint
require constraints
the stereotype used for representing
mutually_exclusive_variant
mutually exclusive constraints
SMartyParser: a XMI Parser for UML-based Variability Models – VaMoS 2013 – Edson Jr. 11
12. SMartyParser Instantiation
l It is instantiated by running the following code:
ProductLineModelParser smartyParser = new
ProductLineModelParser();
l The constructor is responsible for:
l reading the respective files (MDF and XTF) indicated in the
SMartyParser configuration file; and
l processing the XMI file
SMartyParser: a XMI Parser for UML-based Variability Models – VaMoS 2013 – Edson Jr. 12
13. SMartyParser Variability Concepts
and
Example Stereotypes
e 3: Correspondence Between the SM
eotypes and Variability Concepts.
Variability Concept SMartyProfile Stereotype
Variability «variability»
Variation Point «variationPoint»
Mandatory Variant «mandatory»
Optional Variant «optional»
Inclusive Variant «alternative_OR»
Exclusive Variant «alternative_XOR»
Require Constraint «requires»
Mutually Exclusive Constraint «mutex»
Variable Elements «variable»
SMartyParser: a XMI Parser for UML-based Variability Models – VaMoS 2013 – Edson Jr. 13
14. Annotated Arcade Game Maker Use
Case Model
<<variability>>
<< optional >> << requires >> << optional >> name = "save score"
minSelection = 0
Check Previous Best Score Save Score
maxSelection = 1
bindingTime =
DESIGN_TIME
<< mandatory >> << mandatory >> allowsAddingVar = true
Install Game variants = {Save Score}
<<variability>> << mandatory >>
name = "check score" << mandatory >>
Save Game
minSelection = 0
maxSelection = 1 << mandatory >>
bindingTime = DESIGN_TIME Exit Game
GamePlayer
allowsAddingVar = true
variants = {Check Previous
Best Score} << mandatory , variationPoint >>
Play Selected Game GameInstaller
Extension Points
<<variability>>
initialization_ext_point:
name = "play game" << mandatory >>
animation_ext_point:
minSelection = 1
stance maxSelection = 3
Uninstall Game
bindingTime = DESIGN_TIME
result allowsAddingVar = true
variants = {Play Brickels, << extend >> << extend >> << extend >>
class, Play Pong, Play Bowling}
UML << alternative_OR >>
Play Pong
<< alternative_OR >> << alternative_OR >>
nts the Play Brickles Play Bowling
nd it is << include >> << include >> << include >>
<< include >>
esents << mandatory >>
<< include >> << include >> << mandatory >>
lasses, Initialization
Animation Loop
ement
meta- SMartyParser: a XMI Parser for UML-based Variability Models – VaMoS 2013 – Edson Jr. 14
15. Executing SMartyParser
l To obtain all the diagrams, as a collection, one must
invoke the following operation:
smartyParser.getAllDiagrams();
l For the AGM example, such an operation returns the
following diagram as a ModelElement instance:
l [AGM - Use Case Model]
SMartyParser: a XMI Parser for UML-based Variability Models – VaMoS 2013 – Edson Jr. 15
16. Executing SMartyParser
l to obtain all variation points from the SPL models,
one can invoke the following operation:
smartyParser.getAllVariationPoints();
l For the AGM example, such an operation returns the
following variation points:
l [Play Selected Game]
SMartyParser: a XMI Parser for UML-based Variability Models – VaMoS 2013 – Edson Jr. 16
17. Conclusions
l SMartyParser can be easily integrated to specific
environments for UML-based SPLs
l The parser provides several operations based on UML
models and their variabilities represented as stereotypes
l SMartyParser only requires one to properly configure its
configuration file avoiding misunderstanding of variability
concepts from de UML models
SMartyParser: a XMI Parser for UML-based Variability Models – VaMoS 2013 – Edson Jr. 17
18. Limitations and On Going Works
l Limitations of the parser includes:
l variability representation based on stereotypes;
l lack of an OCL engine for improving variability comprehension
and automatic product generation; and
l the parser only processes use case, class, component and
activity diagrams.. so far….
l On going works include:
l the parser is being currently extended for sequence diagrams,
the UML package merging mechanism, SysML block definition
for ES, and the SPEM elements for process lines
SMartyParser: a XMI Parser for UML-based Variability Models – VaMoS 2013 – Edson Jr. 18
19. Questions? Contributions?
l If you prefer, contact me via e-mail:
l edson@din.uem.br
SMartyParser: a XMI Parser for UML-based Variability Models – VaMoS 2013 – Edson Jr. 19
20. l Obrigado !!!
l Grazie!!!
l Thank you ! ! !
SMartyParser: a XMI Parser for UML-based Variability Models – VaMoS 2013 – Edson Jr. 20