Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 1e39212df465802dd2615585d5fa99c63438e64d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?xml version='1.0' encoding='utf-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body><p>In order to validate constraints from a profile, first creation of constraint with specific annotations will be explained and then generation of validation will be explained.<br/>
<img border="0" src="ConstraintCreationUseCase.png"/><br/> 
Figure 1: Constraint creation<br/></p><h1 id="Create_a_constraint">Create a constraint</h1><p>In the context of the construction of a profile, it is possible to add constraints.<br/>
A constraint is a condition or restriction expressed in a language for the purpose of declaring some of the semantics of an element.<br/></p><h3 id="How_to">How to</h3><p>In the context of a profile diagram you can create a constraint from the palette.<br/></p><pre><img border="0" src="diagramConstraintCreation.png"/> <br/>
</pre><p>Figure 2: Constraint creation from the palette<br/>
From the model explorer, click right --> new child--> Create a new Constraint<br/></p><pre> <img border="0" src="MEConstraintCreation.png"/><br/> 
</pre><p>Figure 3: Constraint creation from the model explorer<br/></p><h2 id="Specify_the_context">Specify the context</h2><p>Before editing a constraint, it is important to specify the constraint; it can be a stereotype, an operation.<br/></p><h3 id="How_to_2">How to</h3><p>From the diagram, a context link can be added between the constraints and the context of the constraint:<br/></p><pre><img border="0" src="DiagramContextLink.png"/><br/> 
</pre><p>Figure 4: Context link creation in a the profile diagram<br/>
<br/>
From the property view, the context can be specified:<br/></p><pre><img border="0" src="propertyviewContextlink.png"/><br/> 
</pre><p>Figure 5: specify context from the property view<br/></p><h2 id="Specify_the_language">Specify the language</h2><p>It is possible to precise the language of the constraint into Papyrus. The constraint body may be written into OCL, JAVA, or natural language.<br/> In order to make constraints usable by the Papyrus, constraint must be written in OCL or JAVA.<br/> </p><h3 id="How_to_3">How to</h3><p>By default if your try to edit a constraint, default language will be OCL.<br/>
At the creation, after set the context, you can choose the editor for the constraint:<br/></p><pre><img border="0" src="constraintEdition.png"/><br/> 
</pre><p>Figure 6: choose the editor for the constraint<br/>
You can also specify the language in the property view:<br/> </p><ul><li>Select the field specification and choose create or edit the associated opaque expression:</li></ul><pre><img border="0" src="SpecificationCreation.png"/><br/> 
</pre><p>Figure 7: creation of a specification for the constraint<br/>
You can add the language, see following figure:<br/>
<img border="0" src="opaqueExpressionCreation.png"/><br/>
Figure 8: specify the language<br/>
Then if you want you write the body in the specified language:<br/></p><pre><img border="0" src="fillOpaqueExpression.png"/><br/> 
</pre><p>Figure 9: Write the body of the opaque expression<br/></p><h2 id="Specify_the_behavior_of_the_constraint_in_the_context_of_validation">Specify the behavior of the constraint in the context of validation</h2><p>Into Papyrus, the behavior of the constraint during the validation can be precise.<br/>
It is possible to precise:<br/></p><ul><li>The mode, if the validation of the constraint can be done, in t “batch” or “live” mode.</li><li>The severity: The severity of the problem if the constraint is violated. This correlates to the severity of tasks in the Tasks view of the Eclipse environment. The default severity (if none specified) is ERROR. The CANCEL severity should be used with caution, as it causes the validation operation to be interrupted, possibly resulting in the loss of valuable diagnostic information from other constraints.</li><li>The message: the message that will be displayed if the constraints is violated</li><li>The description: a description of the constraint</li><li>If it is enable by default: Indicates if this constraint should be enabled by default.</li></ul><p>For advanced user you can also precise:<br/></p><ul><li>The Id : the constraint id</li><li>The status code: The plug-in unique status code, useful for logging.</li><li>the target of validation, the element to be validated</li></ul><h3 id="How_to_4">How to</h3><p>Apply the DSML validation profile</p><ul><li>1.	Select the profile root and apply the profile</li><li>2.	Select the profile tab in the property view</li><li>3.	Click on the registered profile button</li><li>4.	Selection the DSML validation profile</li></ul><pre> <img border="0" src="DSMLprofileApplication.png"/><br/> 
</pre><p>Figure 10: apply DSML profile<br/>
Apply Stereotype on constraint</p><ul><li>1.	Select the constraint</li><li>2.	Select profile tab of the property view</li><li>3.	Click on apply profile button</li><li>4.	Select validationRule stereotype </li></ul><pre> <img border="0" src="stereotypeApplication.png"/><br/>
</pre><p>Figure 11:  Apply validationRule stereotype<br/>
Then you can edit property of stereotype to add information about the behavior of the validation<br/></p><pre><img border="0" src="AnnotationEdition.png"/><br/>
</pre><p>Figure 12: edition of the property of stereotype<br/></p><h1 id="Generation_from_Constraints">Generation from Constraints</h1><pre><img border="0" src="UseCaseGeneration.png"/><br/>
</pre><p>Figure 13: Constraint generation<br/></p><h2 id="Generate_constraints_directly_into_the_definition">Generate constraints directly into the definition</h2><p>Constraint written in OCL in the profile can be generated into the definition of the profile and taken in charge during the validation of the model.<br/></p><h3 id="How_to_5">How to</h3><p>When you save the profile,Papyrus asks to you if want to define the profile.<br/>
Click on yes and then do not forget to check save OCL constraint in the definition<br/></p><pre> <img border="0" src="ConstraintDefinition.png"/><br/>
</pre><p>Figure 14: save OCL constraints in the definition<br/></p><h2 id="Generate_constraints_as_EMF_validation_plugins">Generate constraints as EMF validation plugins</h2><p>The user can generate plugins that wrap constraint and can be used in the EMF plugin validation.<br/>
The constraint can be generated in Java code, or directly from OCL.<br/></p><h3 id="How_to_6">How to</h3><p>Select the root profile<br/>
Click right on the model explorer-&gt; create validation plugin for this DSML<br/></p><pre><img border="0" src="PluginValidationGeneration.png"/><br/>
</pre><p>Then a wizard to create the validation is launched. You have to give a name for you validation plugin.<br/></p><pre> <img border="0" src="pluginwizard.png"/><br/>
</pre><p>Figure 15: wizard of constraint validation creation<br/>
The you need to install the created plugin.<br/></p></body></html>

Back to the top