Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Referred operation from standard library
Referred operation from standard library [message #1411257] Fri, 22 August 2014 20:35 Go to next message
Thorsten Arendt is currently offline Thorsten ArendtFriend
Messages: 18
Registered: June 2013
Junior Member
Hi.

I exported the .oclas from an OCLinEcore and loaded it via XMI. Now, I am looking for OperationCallExp referencing an operation from the standard library, e.g. 'notEmpty()'. However, this is not possible since both, the name of the OperationCallExp and the name of the referred Operation is null. I used the following snippet:

root = (Root) resourceOclAS.getContents().get(0);
TreeIterator<EObject> iter = root.eAllContents();
while(iter.hasNext()){
   EObject eObject = iter.next();
   if (eObject instanceof OperationCallExp) {
      OperationCallExp operationCallExp = (OperationCallExp) eObject;
      System.out.println("OperationCallExp: " + operationCallExp.getName());
      Operation op = operationCallExp.getReferredOperation();
      System.out.println("Operation: " + op.getName());
    }
}


Any ideas to extract these OperationCallExp?

Thorsten
Re: Referred operation from standard library [message #1411406 is a reply to message #1411257] Sat, 23 August 2014 07:54 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I guess that you loaded it as precisely XMI rather than as a *.oclas or
at least didn't register *.oclas causing the OCL Standard library load
to fail.

You should always check all errors in all resources in your ResourceSet
to detect deed proxy failures.

Regards

Ed Willink

On 22/08/2014 21:35, Thorsten Arendt wrote:
> Hi.
>
> I exported the .oclas from an OCLinEcore and loaded it via XMI. Now, I
> am looking for OperationCallExp referencing an operation from the
> standard library, e.g. 'notEmpty()'. However, this is not possible since
> both, the name of the OperationCallExp and the name of the referred
> Operation is null. I used the following snippet:
>
>
> root = (Root) resourceOclAS.getContents().get(0);
> TreeIterator<EObject> iter = root.eAllContents();
> while(iter.hasNext()){
> EObject eObject = iter.next();
> if (eObject instanceof OperationCallExp) {
> OperationCallExp operationCallExp = (OperationCallExp) eObject;
> System.out.println("OperationCallExp: " +
> operationCallExp.getName());
> Operation op = operationCallExp.getReferredOperation();
> System.out.println("Operation: " + op.getName());
> }
> }
>
>
> Any ideas to extract these OperationCallExp?
>
> Thorsten
Re: Referred operation from standard library [message #1411438 is a reply to message #1411406] Sat, 23 August 2014 10:04 Go to previous messageGo to next message
Thorsten Arendt is currently offline Thorsten ArendtFriend
Messages: 18
Registered: June 2013
Junior Member
Hi Ed.

Thank you very much!

I made a silly mistake: I registered 'oclas' instead of '*.oclas' ... Now it works Smile

Kind regards,
Thorsten
Re: Referred operation from standard library [message #1411576 is a reply to message #1411438] Sat, 23 August 2014 19:27 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

No problem. Thanks for getting back.

Ed

On 23/08/2014 11:04, Thorsten Arendt wrote:
> Hi Ed.
>
> Thank you very much!
> I made a silly mistake: I registered 'oclas' instead of '*.oclas' ...
> Now it works :)
> Kind regards,
> Thorsten
Previous Topic:Constraint validation with imported model not working
Next Topic:What is the allInstances counterpart for Associations in OCL?
Goto Forum:
  


Current Time: Tue Mar 19 04:41:43 GMT 2024

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

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

Back to the top