|Re: How to write OCL in a file and use it in a state machine? [message #1738182 is a reply to message #1738180]
||Sun, 17 July 2016 17:43
| Ed Willink
Registered: July 2009
You can develop a *.ocl file that imports and complements your UML
models with additional Constraints, Operations, Properties.
Specification/modeling job done. (Use the Complete OCL Xtext editor.)
If you actually want to execute those constraints then you need an
instantiation of your statemachine. The default UML2Ecore2Java supports
only class structure. Perhaps Papyrus-RT provides a Java generator for
state machines too, in which case you are dependent on how that
generator supports OCL. Perhaps the constraints are correctly generated
as part of classes, but perhaps the statemechines are not extensions of
EClass and so the constraints get lost.
If you only want to animate those constraints you should be able to
create UML Instances of your States, manually Load->Resource for the
*.ocl and validate. Make sure you apply and set the
UMLforOCL::Validation::validate true. For a long time Papyrus validation
ignored loaded OCL, but I think that is now fixed, but it stopped me
progressing with OCL integration.
Overall, I see a problem that should just work and for which the
underlying code is all there but for which at least a couple of
integration bugs will probably scupper you.
On 17/07/2016 18:27, Syed Samsul Arefin wrote:
> Hello, I am quite new in papyrus modelling and OCL. In a state
> machine, I directly create guards and state invariants through the
> pop-up window. Now I want to write all the constraints in a file and
> use those constraints as guards/state invariants in the state machine.
> How can I do that? Thanks.
This email has been checked for viruses by Avast antivirus software.
Powered by FUDForum
. Page generated in 0.01585 seconds