|
Re: Check of OCL constraints embedded in UML2 profile [message #64339 is a reply to message #64274] |
Wed, 05 November 2008 13:46 |
Eclipse User |
|
|
|
Originally posted by: cdamus.zeligsoft.com
Hi, Matteo,
The org.eclipse.emf.validation.examples.ocl example plug-in (installed
via the "New -> Example..." wizard if you have the EMF Validation
Framework SDK) demonstrates a simple way to contribute constraints from
an OCL text file. It's a pretty bare-bones example of a custom
constraint provider that doesn't put its constraints in the plugin.xml.
You could adapt this example to have the constraint provider get the
stereotypes applied to a UML element and find Constraints attached to
the Stereotypes. For any Constraint that is specified by an OCL
expression (usually as an OpaqueExpression with a language "OCL"), you
could create an AbstractOCLModelConstraint that parses and evaluates it.
HTH,
Christian
Matteo Bordin wrote:
> Hello all,
>
> this is what I am trying to do:
>
> 1. Define a UML2 profile
> 2. Embed OCL constraints in the UML2 profile
> 3. Validate a model using the profile - and thus the embedded OCL
> constraints
>
> The OCL constraints tipically check that model element with a given
> stereotypes have certain properties. A typical OCL constraint is thus
> something like:
>
> myStereotype.base_BaseClass.<ocl_expression>
>
> The first two steps were quite easy (I use the Papyrus UML editor which
> embeds an OCL parser/validator); but I have serious problems with the
> validation part (for the papyrus users: the tutorial for OCL constraints
> doesn't seem to work).
>
> I googled around looking for tutorial/solutions with no results (or
> partial results lacking detailed info).
> So the question is: is there a way to directly use OCL constraints
> embedded in a UML2 profile to validate a model? If not, could you please
> indicate a tutorial explaining how to use OCL constraints embedded in a
> UML2 profile (likely via the validation frameworks)?
>
> Thanks in advance,
>
> Matteo
|
|
|
Re: Check of OCL constraints embedded in UML2 profile [message #64362 is a reply to message #64339] |
Wed, 05 November 2008 17:13 |
Matteo Bordin Messages: 19 Registered: July 2009 |
Junior Member |
|
|
Hello Christian,
thanks for the hint. Before trying it, I would like to know if I could
use UML2 static profiles for my purpose (generating genmodel model out
or a UML2 profile containig OCL constraints).
Thanks,
Matteo
Christian W. Damus wrote:
> Hi, Matteo,
>
> The org.eclipse.emf.validation.examples.ocl example plug-in (installed
> via the "New -> Example..." wizard if you have the EMF Validation
> Framework SDK) demonstrates a simple way to contribute constraints from
> an OCL text file. It's a pretty bare-bones example of a custom
> constraint provider that doesn't put its constraints in the plugin.xml.
>
> You could adapt this example to have the constraint provider get the
> stereotypes applied to a UML element and find Constraints attached to
> the Stereotypes. For any Constraint that is specified by an OCL
> expression (usually as an OpaqueExpression with a language "OCL"), you
> could create an AbstractOCLModelConstraint that parses and evaluates it.
>
> HTH,
>
> Christian
>
> Matteo Bordin wrote:
>> Hello all,
>>
>> this is what I am trying to do:
>>
>> 1. Define a UML2 profile
>> 2. Embed OCL constraints in the UML2 profile
>> 3. Validate a model using the profile - and thus the embedded OCL
>> constraints
>>
>> The OCL constraints tipically check that model element with a given
>> stereotypes have certain properties. A typical OCL constraint is thus
>> something like:
>>
>> myStereotype.base_BaseClass.<ocl_expression>
>>
>> The first two steps were quite easy (I use the Papyrus UML editor
>> which embeds an OCL parser/validator); but I have serious problems
>> with the validation part (for the papyrus users: the tutorial for OCL
>> constraints doesn't seem to work).
>>
>> I googled around looking for tutorial/solutions with no results (or
>> partial results lacking detailed info).
>> So the question is: is there a way to directly use OCL constraints
>> embedded in a UML2 profile to validate a model? If not, could you
>> please indicate a tutorial explaining how to use OCL constraints
>> embedded in a UML2 profile (likely via the validation frameworks)?
>>
>> Thanks in advance,
>>
>> Matteo
|
|
|
Re: Check of OCL constraints embedded in UML2 profile [message #64431 is a reply to message #64362] |
Wed, 05 November 2008 19:07 |
Eclipse User |
|
|
|
Originally posted by: cdamus.zeligsoft.com
Hi, Matteo,
The UML2 run-time provides traceability between your UML profile and the
generated EPackage, so this should work as well with OCL as a dynamic
profile.
Just be sure to register your package and your profile on the various
EMF and UML2 extension points, and you should be fine.
Cheers,
Christian
Matteo Bordin wrote:
> Hello Christian,
>
> thanks for the hint. Before trying it, I would like to know if I could
> use UML2 static profiles for my purpose (generating genmodel model out
> or a UML2 profile containig OCL constraints).
>
> Thanks,
>
> Matteo
>
> Christian W. Damus wrote:
>> Hi, Matteo,
>>
>> The org.eclipse.emf.validation.examples.ocl example plug-in (installed
>> via the "New -> Example..." wizard if you have the EMF Validation
>> Framework SDK) demonstrates a simple way to contribute constraints
>> from an OCL text file. It's a pretty bare-bones example of a custom
>> constraint provider that doesn't put its constraints in the plugin.xml.
>>
>> You could adapt this example to have the constraint provider get the
>> stereotypes applied to a UML element and find Constraints attached to
>> the Stereotypes. For any Constraint that is specified by an OCL
>> expression (usually as an OpaqueExpression with a language "OCL"), you
>> could create an AbstractOCLModelConstraint that parses and evaluates it.
>>
>> HTH,
>>
>> Christian
>>
>> Matteo Bordin wrote:
>>> Hello all,
>>>
>>> this is what I am trying to do:
>>>
>>> 1. Define a UML2 profile
>>> 2. Embed OCL constraints in the UML2 profile
>>> 3. Validate a model using the profile - and thus the embedded OCL
>>> constraints
>>>
>>> The OCL constraints tipically check that model element with a given
>>> stereotypes have certain properties. A typical OCL constraint is thus
>>> something like:
>>>
>>> myStereotype.base_BaseClass.<ocl_expression>
>>>
>>> The first two steps were quite easy (I use the Papyrus UML editor
>>> which embeds an OCL parser/validator); but I have serious problems
>>> with the validation part (for the papyrus users: the tutorial for OCL
>>> constraints doesn't seem to work).
>>>
>>> I googled around looking for tutorial/solutions with no results (or
>>> partial results lacking detailed info).
>>> So the question is: is there a way to directly use OCL constraints
>>> embedded in a UML2 profile to validate a model? If not, could you
>>> please indicate a tutorial explaining how to use OCL constraints
>>> embedded in a UML2 profile (likely via the validation frameworks)?
>>>
>>> Thanks in advance,
>>>
>>> Matteo
|
|
|
Powered by
FUDForum. Page generated in 0.03683 seconds