|
Re: [OCLinEcore] Definition of TemplateSignatureCS? [message #1249781 is a reply to message #1249687] |
Tue, 18 February 2014 11:16   |
Eclipse User |
|
|
|
Hi
*CS classes are part of the non-normative OCL metamodel, so you should
not use them (unless you are creating an extended OCL language and are
extending the OCL tooling).
You should only use Pivot.ecore (or OCL.ecore if you prefer the Classic
Eclipse OCL).
You can find examples of templates in Pivot.oclas and OCL-2.5.oclas.
I'm pretty certain that the support for template parameter upper/lower
bounds in incomplete.
Regards
Ed Willink
On 18/02/2014 14:16, Martin Hanysz wrote:
> Hello OCL Community,
>
> I am currently in the process of building a metamodel with the
> OCLinEcore Language that makes use of generic type parameters. While
> browsing the Help Pages for Eclipse Kepler I noticed that there is no
> definition of TemplateSignatureCS although it is used to define
> DataTypeCS, EnumerationCS, ClassCS and OperationCS.
>
> So my question is:
> How do I define a class with a type parameter?
>
> Let's say I have a class MyClass that has a type parameter T that
> extends MyOtherClass. How can I define that with the OCLinEcore
> Language? Additionally, how can I use the type parameter T to express
> that MyClass has a reference named myReference to other instances of
> MyClass that have the same type parameter?
>
> What I got so far is:
>
> import ecore : 'http://www.eclipse.org/emf/2002/Ecore#/';
>
> package myPackage : mp = 'http://www.example.com/myPackage.ecore'
> {
> class MyClass(T extends MyOtherClass)
> {
> property myReference : MyClass(T)[*];
> }
> class MyOtherClass;
> }
>
> The OCLinEcore editor accepts this as valid syntax, but when I reopen
> the file, it suddenly contains the following:
>
> import ecore : 'http://www.eclipse.org/emf/2002/Ecore#/';
>
> package myPackage : mp = 'http://www.example.com/myPackage.ecore'
> {
> class MyClass(T)
> {
> property myReference : MyClass[*];
> }
> class MyOtherClass;
> }
>
> As you can see the bound for the type parameter is gone as well as the
> type parameter of the referenced type.
>
> Best regards,
> Martin
|
|
|
|
Re: [OCLinEcore] Definition of TemplateSignatureCS? [message #1251820 is a reply to message #1251648] |
Thu, 20 February 2014 11:32  |
Eclipse User |
|
|
|
Hi
The missing diocumentation is all part of the auto-generation that will
hopefully happen for OCL 2.5. Until then many things about OCL are left
to implementers common sense.
Note that OMG OCL does not supoort templates at all yet.
Regards
Ed Willink
On 20/02/2014 12:54, Martin Hanysz wrote:
> Hello Ed,
>
> First of all, thanks for your quick answer.
>
> I think I didn't express myself clearly enough regarding the definition of TemplateSignatureCS part.
>
> Since I am new to the OCLinEcore syntax I looked it up in the Eclipse Kepler help under "OCL Documentation" > "Users Guide" > "The OCLinEcore Language". In this document, the syntax of the OCLinEcore Language is described using that kind of "routing diagram" (I don't know the correct name of these, see attachment for screenshot). All nodes in this diagram are descibed somewhere else on the page except TemplateSignatureCS.
>
> I was just guessing that this part is used for specifying type parameters of some sort and tried different notations until the OCLinEcore editor didn't mark it as a syntax error anymore.
>
> So I think the documentation on this specific part of the OCLinEcore Language syntax should be added.
>
> Best regards,
> Martin
>
|
|
|
Powered by
FUDForum. Page generated in 0.06646 seconds