Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Operation Overriding
Operation Overriding [message #825119] Tue, 20 March 2012 13:45 Go to next message
ModelGeek Mising name is currently offline ModelGeek Mising nameFriend
Messages: 550
Registered: June 2011
Senior Member
class Class1
{
attribute ID : ecore_0::ELongObject[1];
attribute name : String[1];
operation abc(input : Class1[*] { !ordered,!unique }) : Boolean[1]
{
body: true;
}
operation test() : Integer[1]{ !ordered,!unique }
{
body:1;
}
}
class Class2 extends Class1
{
operation abc(input : Class1[*] { !ordered,!unique }) : Boolean[1]
{
body: false;
}
operation test() : Integer[1]{ !ordered,!unique }
{
body:2;
}
}

I have above mentioned ecore. If I take instance of Class2 and try to run methods(abc, test) in console, it gives me OCL_Invalid.

Is operation overriding is available in OCL? if yes then what is wrong with my ecore?

thanks for help!

regards,
Re: Operation Overriding [message #825193 is a reply to message #825119] Tue, 20 March 2012 15:29 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

This looks like https://bugs.eclipse.org/bugs/show_bug.cgi?id=366229
which is fixed now for Juno for the new Eclipse evaluator. It may be
fixed for the legacy Ecore evaluator too.

Regards

Ed Willink


On 20/03/2012 09:45, ModelGeek Mising name wrote:
> class Class1
> {
> attribute ID : ecore_0::ELongObject[1];
> attribute name : String[1];
> operation abc(input : Class1[*] { !ordered,!unique }) :
> Boolean[1]
> {
> body: true;
> }
> operation test() : Integer[1]{ !ordered,!unique }
> {
> body:1;
> }
> }
> class Class2 extends Class1
> {
> operation abc(input : Class1[*] { !ordered,!unique }) :
> Boolean[1]
> {
> body: false;
> }
> operation test() : Integer[1]{ !ordered,!unique }
> {
> body:2;
> }
> }
>
> I have above mentioned ecore. If I take instance of Class2 and try to
> run methods(abc, test) in console, it gives me OCL_Invalid.
>
> Is operation overriding is available in OCL? if yes then what is wrong
> with my ecore?
>
> thanks for help!
>
> regards,
>
Re: Operation Overriding [message #825906 is a reply to message #825193] Wed, 21 March 2012 12:08 Go to previous messageGo to next message
ModelGeek Mising name is currently offline ModelGeek Mising nameFriend
Messages: 550
Registered: June 2011
Senior Member
Hi,

I have downloaded JUNO and ecore file seems working fine in Eclipse JUNO OCL console. I took an dynamic instance of subclass and opertaion worked fine.
I have an application written in netbeans IDE using old jar files. My application also has similar functionality of OCL console, but even after i have replaced all old jar files with new one(JUNO) but still it is giving same error. Do you know which jar files i need to replace in order to have the same effect in my application.
My application was using old jar files but now i have added new jar files but error is still there.

Do you have any idea about this problem?

Regards,

[Updated on: Wed, 21 March 2012 12:20]

Report message to a moderator

Re: Operation Overriding [message #825970 is a reply to message #825906] Wed, 21 March 2012 13:42 Go to previous messageGo to next message
ModelGeek Mising name is currently offline ModelGeek Mising nameFriend
Messages: 550
Registered: June 2011
Senior Member
I have solved the problem.

Thanks for assistance
Re: Operation Overriding [message #826638 is a reply to message #825970] Thu, 22 March 2012 10:18 Go to previous messageGo to next message
ModelGeek Mising name is currently offline ModelGeek Mising nameFriend
Messages: 550
Registered: June 2011
Senior Member
I am again running into same problem. I have updated jar files from JUNO. The ecore i gave ealrier works fine but i have created new which works fine in JUNO ocl console but in my application it does not work.


In JUNO OCL console i get the results from overriden method but in my application it is still results are from method in super class.

Please guide me which jar files i need to get from JUNO?

thanks!

regards,
Re: Operation Overriding [message #826658 is a reply to message #826638] Thu, 22 March 2012 10:46 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

The new Pivot-based OCL is used within interactive (Xtext-based)
tooling. It coexists with the legacy approaches since the new stuff has
new org.eclipse.ocl.examples... package names. You need to use these in
your application. The API is fairly similar but not identical and as yet
unreviewed.

Regards

Ed Willink

On 22/03/2012 06:19, ModelGeek Mising name wrote:
> I am again running into same problem. I have updated jar files from
> JUNO. The ecore i gave ealrier works fine but i have created new which
> works fine in JUNO ocl console but in my application it does not work.
>
>
> In JUNO OCL console i get the results from overriden method but in my
> application it is still results are from method in super class.
>
> Please guide me which jar files i need to get from JUNO?
>
> thanks!
>
> regards,
Re: Operation Overriding [message #826707 is a reply to message #826658] Thu, 22 March 2012 12:05 Go to previous messageGo to next message
ModelGeek Mising name is currently offline ModelGeek Mising nameFriend
Messages: 550
Registered: June 2011
Senior Member
Hi,

i have added all org.eclipse.ocl.examples... jar files but it does not work... As you have mentioned that Pivot-based OCL is used so do i need to change the code for evalution like i am using following code for evaluation

ocl = oclFactory.createOCL();
OCLHelper<Object, ?, ?, ?> helper = ocl.createOCLHelper();
try {
helper.setContext(context.eClass());
OCLExpression<Object> parsed = helper.createQuery(expression);
Object evaluate = ocl.evaluate(context, parsed);
return evaluate;
} catch (Exception e) {}

And even setting delegates are giving wrong results so do i need to change my code?

do i need to have different "imports" so Pivot-based OCL can be used?

thanks for assistance

Regards,
Re: Operation Overriding [message #826764 is a reply to message #826707] Thu, 22 March 2012 13:31 Go to previous message
ModelGeek Mising name is currently offline ModelGeek Mising nameFriend
Messages: 550
Registered: June 2011
Senior Member
Hi,

I read that i need to do intialization for standalone application with respect to PIVOT for my ecore model. I have also changed annotation to http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot


oclDelegateURI = OCLDelegateDomain.OCL_DELEGATE_URI_PIVOT;
EOperation.Internal.InvocationDelegate.Factory.Registry.INSTANCE.put
(oclDelegateURI, new OCLInvocationDelegateFactory.Global());
EStructuralFeature.Internal.SettingDelegate.Factory.Registry.INSTANCE.put
(oclDelegateURI, new OCLSettingDelegateFactory.Global());
EValidator.ValidationDelegate.Registry.INSTANCE.put
(oclDelegateURI, new OCLValidationDelegateFactory.Global());

but i getting the error
java.lang.NoClassDefFoundError: org/eclipse/uml2/uml/UMLPackage
at org.eclipse.ocl.examples.pivot.uml.UML2Ecore2Pivot$Factory.<init>(UML2Ecore2Pivot.java:48)

any idea? what is wrong here, i am not using uml model here then why it is looking for UML package?

regards,

Previous Topic:[Announce] Eclipse OCL 4.0.0 (Juno) M6 is now available
Next Topic:Pivot OCL Evaluation
Goto Forum:
  


Current Time: Thu Apr 25 00:45:14 GMT 2024

Powered by FUDForum. Page generated in 0.03450 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top