| specialzed OCL [message #1033609] |
Thu, 04 April 2013 08:32  |
ModelGeek Mising name Messages: 351 Registered: June 2011 |
Senior Member |
|
|
I want to add some operations in default OCL so i can use them in ocl statements and then delegates should be able to evaluate them according to given implementation.
Lets say i want to add operation xyz(real, real) with return type real as well. Now suppose i have a classed named "class1" and has three real attributes names as "one", "two" and "three". In derivation statement of "three" i want to write
"self.xyz(self.one, seld.2)". I want xyz operation to be part of default OCL implemention same as collect, select, count etc operations are part of OCL.
How can i extend default implementation to make xyz part of it and how to extends delegates to be able to recognize and evaluate it as any other default operation available in OCL
Cheers,
|
|
|
|
| Re: specialzed OCL [message #1033628 is a reply to message #1033609] |
Thu, 04 April 2013 08:58   |
Ed Willink Messages: 3191 Registered: July 2009 |
Senior Member |
|
|
Hi
You've given no real clue as to what you really want to do, just a vague
assumption of your not-working solution.
If you're using OCLinEcore why not just add features to taste, possibly
in a dummy utilities class.
If you're using Complete OCL why not just add features to taste,
potentially anywhere.
So what is your problem?
Regards
Ed Willinkl
On 04/04/2013 13:32, ModelGeek Mising name wrote:
> I want to add some operations in default OCL so i can use them in ocl
> statements and then delegates should be able to evaluate them
> according to given implementation.
>
> Lets say i want to add operation xyz(real, real) with return type real
> as well. Now suppose i have a classed named "class1" and has three
> real attributes names as "one", "two" and "three". In derivation
> statement of "three" i want to write "self.xyz(self.one, seld.2)". I
> want xyz operation to be part of default OCL implemention same as
> collect, select, count etc operations are part of OCL.
>
> How can i extend default implementation to make xyz part of it and how
> to extends delegates to be able to recognize and evaluate it as any
> other default operation available in OCL
>
> Cheers,
|
|
|
| Re: specialzed OCL [message #1033664 is a reply to message #1033628] |
Thu, 04 April 2013 09:46   |
ModelGeek Mising name Messages: 351 Registered: June 2011 |
Senior Member |
|
|
Hi,
i am creating an Ecore enriched with OCL at runtime. I am also instantiating ecore at run time and using delegates to evaluate. I want to add some operations in default OCL specification, so users can use that. For example i want to add an operation xyz(real, real)::real in default MDT/OCL and users will be able to use this operation like any other operation available in OCL specs(e.g set->count, set->select(oclexpression) etc). Something like http://www.eclipse.org/forums/index.php/m/989574/#msg_936996
So i think i need to change OCLEssential Xtext grammer first and then I should extend oclstdlib, pivot etc...
i would like to know if there is any tutorial for this or any directions...
thank you very much for your support.
[Updated on: Thu, 04 April 2013 09:47] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: specialzed OCL [message #1057430 is a reply to message #1057012] |
Wed, 08 May 2013 08:28  |
Ed Willink Messages: 3191 Registered: July 2009 |
Senior Member |
|
|
Hi
If you want to see source code import as a source rather than binary
project. Better still fetch from GIT.
The simplest extension is demonstrated by testImport in
GIT\org.eclipse.ocl\tests\org.eclipse.ocl.examples.xtext.tests\src\org\eclipse\ocl\examples\test\xtext\OCLstdlibTests.java.
You could add the Java class references using => constraucts.
If you are concerned about start up time or want to avoid model loadin
you can run an equivalent of
GIT\org.eclipse.ocl\examples\org.eclipse.ocl.examples.build\src\org\eclipse\ocl\examples\build\GenerateOCLstdlibModel.mwe2
to create a library that can be installed by the equivalent of
OCLstdlib.install().
These facilities have not yet been extended by QVT, so the extensibility
has not yet been demonstrated; you may need to raise a Bugzilla or two.
Using OCL's GIT allows you to fix problems and submit them back for
review/incorporation.
[M7 adds the ability to define OCLstdlib operation bodies using OCL,
however the corresponding usage by the code generator is currently
disabled.]
Regards
Ed Willink
On 08/05/2013 13:01, ModelGeek Mising name wrote:
> Hi,
>
> In order to extend OCL library, i would like to get some information.
> I know few steps(i might be wrong) but i do not know all steps.
>
> 1 - Download latest version of org.eclipse.ocl.example.library.
> 2 - Create my own plugin and create my own OCL-ext.oclstdlib which
> extends from OCL 2.x.oclstdlib.
> 3 - new add functiona in OCL-ext.oclstdlib
> e.g. operation xyx() : Boolean => 'abc.xyz.MyXYZOperation';
>
> I am not sure about steps that should be taken afterwards and i am not
> fimiliar with MWE. Can you please point out next steps.
>
> One small question when i import org.eclipse.ocl.example.library as
> binary project then it only contains OCL-ext.oclstdlib,
> oclstdlib.ecore and oclstdlib.genmodel.
> Classes like
> org.eclipse.ocl.examples.library.collection.CollectionMinOperation are
> not available in this plugin, rather i have to see
> org.eclipse.ocl.example.library_source plugin to see that operation.
> Can you explain why?
> Cheers,
|
|
|
| Re: specialzed OCL [message #1057538 is a reply to message #1042386] |
Wed, 08 May 2013 08:01  |
ModelGeek Mising name Messages: 351 Registered: June 2011 |
Senior Member |
|
|
Hi,
In order to extend OCL library, i would like to get some information. I know few steps(i might be wrong) but i do not know all steps.
1 - Download latest version of org.eclipse.ocl.example.library.
2 - Create my own plugin and create my own OCL-ext.oclstdlib which extends from OCL 2.x.oclstdlib.
3 - new add functiona in OCL-ext.oclstdlib
e.g. operation xyx() : Boolean => 'abc.xyz.MyXYZOperation';
I am not sure about steps that should be taken afterwards and i am not fimiliar with MWE. Can you please point out next steps.
One small question when i import org.eclipse.ocl.example.library as binary project then it only contains OCL-ext.oclstdlib, oclstdlib.ecore and oclstdlib.genmodel.
Classes like org.eclipse.ocl.examples.library.collection.CollectionMinOperation are not available in this plugin, rather i have to see org.eclipse.ocl.example.library_source plugin to see that operation. Can you explain why?
Cheers,
|
|
|
| Re: specialzed OCL [message #1057539 is a reply to message #1042386] |
Wed, 08 May 2013 08:01  |
ModelGeek Mising name Messages: 351 Registered: June 2011 |
Senior Member |
|
|
Hi,
In order to extend OCL library, i would like to get some information. I know few steps(i might be wrong) but i do not know all steps.
1 - Download latest version of org.eclipse.ocl.example.library.
2 - Create my own plugin and create my own OCL-ext.oclstdlib which extends from OCL 2.x.oclstdlib.
3 - new add functiona in OCL-ext.oclstdlib
e.g. operation xyx() : Boolean => 'abc.xyz.MyXYZOperation';
I am not sure about steps that should be taken afterwards and i am not fimiliar with MWE. Can you please point out next steps.
One small question when i import org.eclipse.ocl.example.library as binary project then it only contains OCL-ext.oclstdlib, oclstdlib.ecore and oclstdlib.genmodel.
Classes like org.eclipse.ocl.examples.library.collection.CollectionMinOperation are not available in this plugin, rather i have to see org.eclipse.ocl.example.library_source plugin to see that operation. Can you explain why?
Cheers,
|
|
|
| Re: specialzed OCL [message #1057540 is a reply to message #1042386] |
Wed, 08 May 2013 08:16  |
ModelGeek Mising name Messages: 351 Registered: June 2011 |
Senior Member |
|
|
In order to extend OCL library, i would like to get some information. I know few steps(i might be wrong) but i do not know all steps.
1 - Download latest version of org.eclipse.ocl.example.library.
2 - Create my own plugin and create my own OCL-ext.oclstdlib which extends from OCL 2.x.oclstdlib.
3 - new add functiona in OCL-ext.oclstdlib
e.g. operation xyx() : Boolean => 'abc.xyz.MyXYZOperation';
I am not sure about steps that should be taken afterwards and i am not fimiliar with MWE. Can you please point out next steps.
One small question when i import org.eclipse.ocl.example.library as binary project then it only contains OCL-ext.oclstdlib, oclstdlib.ecore and oclstdlib.genmodel.
Classes like org.eclipse.ocl.examples.library.collection.CollectionMinOperation are not available in this plugin, rather i have to see org.eclipse.ocl.example.library_source plugin to see that operation. Can you explain why?
Cheers,
|
|
|