OCL query [message #30425] |
Tue, 26 June 2007 09:25 |
Eclipse User |
|
|
|
Originally posted by: anquiroe101.hotmail.com
Hi all.
With the "OCL Interpreter" Example, I can check a OCL Query (like
self.name on writers) on a selected class:
IEditorPart editor =
getSite().getWorkbenchWindow().getActivePage().getActiveEdit or();
...
ISelection selection =
editor.getSite().getSelectionProvider().getSelection();
I have created a library diagram with 3 writers and 1 Borrower and I need
to check "self.address" on all of them, not only on selected writer.
Do someone know how to implement it? How can I access all of them?
Thanks :D
Cheers,
Anne
|
|
|
Re: OCL query [message #30633 is a reply to message #30425] |
Tue, 26 June 2007 14:46 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Anne,
You can use
self.writers.address->union(self.borrowers.address)
on a Library to get the addresses of all of its writers and borrowers as a
collection. More generally, because libraries nest, you could do
Writer.allInstances().address->union(Borrower.allInstances().address)
to get absolutely all of the writers' and borrowers' addresses as a
collection. Even more general would be
Person.allInstances().address
If you want to get only the addresses of all of the writers and borrowers
visualized on a particular diagram, then that is more of a GMF question (to
find out which writers those are) to be asked on the eclipse.modeling.gmf
newsgroup. Once you have these writers and borrowers, just iterate over
them to evaluate the "self.address" query on each.
HTH,
Christian
Anne wrote:
> Hi all.
> With the "OCL Interpreter" Example, I can check a OCL Query (like
> self.name on writers) on a selected class:
> IEditorPart editor =
> getSite().getWorkbenchWindow().getActivePage().getActiveEdit or();
> ..
> ISelection selection =
> editor.getSite().getSelectionProvider().getSelection();
>
> I have created a library diagram with 3 writers and 1 Borrower and I need
> to check "self.address" on all of them, not only on selected writer.
> Do someone know how to implement it? How can I access all of them?
>
> Thanks :D
> Cheers,
> Anne
|
|
|
Re: OCL query [message #30703 is a reply to message #30633] |
Tue, 26 June 2007 15:49 |
Eclipse User |
|
|
|
Originally posted by: anquiroe101.hotmail.com
Hi Christian,
Could I add and check OCL restrictions to the meta-model? Then, when I
checked one of them, automatically it was checked on all associated
instances?.
Thanks for your help :D
Cheers,
Anne
|
|
|
Re: OCL query [message #30739 is a reply to message #30703] |
Tue, 26 June 2007 16:06 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Anne,
You could, yes. The OCL API provides parsing and evaluation services only.
Where to find constraints, when to evaluate them, and on what objects to
evaluate them is entirely up to the client application. The EMF Validation
Framework provides additional APIs that you can use to implement a solution
to those concerns.
cW
Anne wrote:
> Hi Christian,
> Could I add and check OCL restrictions to the meta-model? Then, when I
> checked one of them, automatically it was checked on all associated
> instances?.
>
> Thanks for your help :D
> Cheers,
> Anne
|
|
|
Re: OCL query [message #30775 is a reply to message #30739] |
Tue, 26 June 2007 16:22 |
Eclipse User |
|
|
|
Originally posted by: anquiroe101.hotmail.com
Thanks :D
I'm going to read all about "EMF Validation Tutorial".
Cheers,
Anne
|
|
|
Powered by
FUDForum. Page generated in 0.03099 seconds