Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » CompleteOCL and Invocation and Setting Delegates
CompleteOCL and Invocation and Setting Delegates [message #799036] Wed, 15 February 2012 11:07 Go to next message
Filip Krikava is currently offline Filip KrikavaFriend
Messages: 43
Registered: January 2012
Member
Hi,

I was wondering if there is some support for the EMF invocation and setting delegates in CompleteOCL and if so what do I need to do in order to be able to use it?

It works fine with the OCLInEcore, but with many invariants and derivates the standalone .ocl file is easier to work with.

For example if I have a derived property:

context AdaptiveElementType::allFeatures : Set(Feature)
	derive: providedSensors->union(providedEffectors)


how do I delegate this implementation from the generated model AdaptiveElementType.getAllFeatures() method?

Thanks
Filip
Re: CompleteOCL and Invocation and Setting Delegates [message #799249 is a reply to message #799036] Wed, 15 February 2012 16:48 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4188
Registered: July 2009
Senior Member
Hi

Yes/No/Doesn't make sense.

Ecore supports embedded delegates for behavioural aspects such as
setting/invocation/validation. These form part of an Ecore model via
EAnnotations.

OCLinEcore is a textual syntax and Xtext editor that makes it much more
pleasant to maintain an OCL implementation of these facilities that are
embedded in the EAnnotations. [In Juno this OCL can be genmodeled to
Java rather than interpreted.]

Complete OCL is a textual syntax and Xtext editor for an OCL document
that complements an Ecore/UML meta-model.

The problem is that Complete OCL is independent so your meta-model and
tooling doesn't know about it.

Juno adds a Load Complete OCL Resource action to typical modeling
editors to allow you to load the Complete OCL so that it works.

In Indigo, you (or the tool authors) must use the OCL Java API to load
the Complete OCL. I don't know of any generic tool that does this.

So in Juno you might.

Develop embedded OCL constraints in YourMetaModel.ecore
Open YourModel.xmi in the Sample Reflective Ecore Editor
Load MoreConstraints.ocl into the Sample Reflective Ecore Editor

Invoke Validate to run your embedded and independent constraints
Or Open the OCL Console to run your embedded and independent constraints

Regards

Ed Willink

On 15/02/2012 11:08, Filip Krikava wrote:
> Hi,
>
> I was wondering if there is some support for the EMF invocation and
> setting delegates in CompleteOCL and if so what do I need to do in
> order to be able to use it?
>
> It works fine with the OCLInEcore, but with many invariants and
> derivates the standalone .ocl file is easier to work with.
> For example if I have a derived property:
>
> context AdaptiveElementType::allFeatures : Set(Feature)
> derive: providedSensors->union(providedEffectors)
>
> how do I delegate this implementation from the generated model
> AdaptiveElementType.getAllFeatures() method?
>
> Thanks
> Filip
Re: CompleteOCL and Invocation and Setting Delegates [message #799777 is a reply to message #799249] Thu, 16 February 2012 09:50 Go to previous messageGo to next message
Filip Krikava is currently offline Filip KrikavaFriend
Messages: 43
Registered: January 2012
Member
Hi Ed,

Thanks! I'm looking forward to Juno!

OCLInEcore is great, but when editing a large model with lot of OCL it not that easy to navigate around. In that case what would be even better is to have an editor that only edits the OCL related EAnnotations in the CompleteOCL like style - having a dedicated view of the model just for the OCL stuff.

Regards,
Filip

Re: CompleteOCL and Invocation and Setting Delegates [message #800089 is a reply to message #799777] Thu, 16 February 2012 17:18 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4188
Registered: July 2009
Senior Member
Hi

Import/Export between embedded/independent is one of many to do actions;
needed for the UML spec amongst other things.

But surely the outline is quite helpful?

Regards

Ed

On 16/02/2012 09:50, Filip Krikava wrote:
> Hi Ed,
>
> Thanks! I'm looking forward to Juno!
>
> OCLInEcore is great, but when editing a large model with lot of OCL it
> not that easy to navigate around. In that case what would be even
> better is to have an editor that only edits the OCL related
> EAnnotations in the CompleteOCL like style - having a dedicated view
> of the model just for the OCL stuff.
>
> Regards,
> Filip
>
>
Re: CompleteOCL and Invocation and Setting Delegates [message #801500 is a reply to message #800089] Sat, 18 February 2012 13:49 Go to previous messageGo to next message
Filip Krikava is currently offline Filip KrikavaFriend
Messages: 43
Registered: January 2012
Member
Hi,

Indeed, the outline is quite helpful. However, the outline as a view collapses every time an edit is made (I guess xtext has problem to parse the document because when you start editing you introduce syntactic errors). It would be great if it can then go back to the last element. Actually even better if it can be the two way link between the element under the editor caret and the highlighted element in the view.

The Quick Outline is great for small models. Unfortunately, for larger models it becomes unusable as it takes too long for it to start and even longer to filter.

When talking about, I seem to fail to find the correct workflow how to use the OCLInEcore editor (I went through the docs and I tried google for it but did not found anything relevant):
What I want is to keep a separate file .oclinecore so all the comments and formatting persists, but then what is the correct way to generate .ecore file? If I do right-click and "save as -> Ecore" it works but (let me illustrate it on the OCLInEcoreTutorial example):

1. I want to save the "Tutorial.ecore" as "Tutorial.oclinecore"
- It shows the dialog to type in the name of the file with "Tutorial.ecore" as the default name. Why not "Tutorial.oclinecore"?
- It shows a warning "The original file Tutorial.ecore" has been deleted or is not accessible. Why is that?
2. I enter "Tutorial.oclinecore"
3. It replaces the "Tutorial.ecore" editor with "Tutorial.oclinecore" (so far so good)
4. I add an invariant
5. Now I want to save it back to "Tutorial.ecore" (I guess there is no sync by default, right?) so I do again "Save as -> Ecore"
- Again the default filename is "Tutorial.oclinecore" (rather than "Tutorial.ecore") and again the warning about the file being inaccessible
6. I enter "Tutorial.ecore"
7. It asks me to overwrite the file, I click yes
8. It prompts: "The file 'OCLinEcoreTutorial/model/Tutorial.ecore' has changed on the file system. Do you want to replace the editor content with these changes?"
9. Regardless if I hit YES or NO I get an empty editor with 'ERROR' (also I get the same error even if I enter a new file)
- At this point I need to close it and reopen.
In the it works, but it is a bit tedious to do all these steps when debugging OCL.

What is the correct workflow in this case? What do I miss?

Thanks a lot!
Filip

Re: CompleteOCL and Invocation and Setting Delegates [message #801646 is a reply to message #801500] Sat, 18 February 2012 18:42 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4188
Registered: July 2009
Senior Member
Hi

> Indeed, the outline is quite helpful. However, the outline as a view
> collapses every time an edit is made (I guess xtext has problem to
> parse the document because when you start editing you introduce
> syntactic errors).
Ugh. https://bugs.eclipse.org/bugs/show_bug.cgi?id=371979 raised.
> It would be great if it can then go back to the last element. Actually
> even better if it can be the two way link between the element under
> the editor caret and the highlighted element in the view.
The link (two way arrow icon) works for me.
> The Quick Outline is great for small models. Unfortunately, for larger
> models it becomes unusable as it takes too long for it to start and
> even longer to filter.
I'd never used this. I gues you get what you get.
> When talking about, I seem to fail to find the correct workflow how to
> use the OCLInEcore editor (I went through the docs and I tried google
> for it but did not found anything relevant): What I want is to keep a
> separate file .oclinecore so all the comments and formatting persists,
> but then what is the correct way to generate .ecore file? If I do
> right-click and "save as -> Ecore" it works but (let me illustrate it
> on the OCLInEcoreTutorial example):
> 1. I want to save the "Tutorial.ecore" as "Tutorial.oclinecore"
> - It shows the dialog to type in the name of the file with
> "Tutorial.ecore" as the default name. Why not "Tutorial.oclinecore"?
Unfortunately the re-used SWT Dialog does not permit the initial file to
be specified usefully. I raised a bug. Once other problenms are resolved
I may clone the Dialog so that it can be fully customized.
> - It shows a warning "The original file Tutorial.ecore" has been
> deleted or is not accessible. Why is that?
A side effect of the re-used Dialog.
> 2. I enter "Tutorial.oclinecore" 3. It replaces the "Tutorial.ecore"
> editor with "Tutorial.oclinecore" (so far so good)
> 4. I add an invariant
> 5. Now I want to save it back to "Tutorial.ecore" (I guess there is no
> sync by default, right?) so I do again "Save as -> Ecore"
> - Again the default filename is "Tutorial.oclinecore" (rather than
> "Tutorial.ecore") and again the warning about the file being inaccessible
> 6. I enter "Tutorial.ecore"
> 7. It asks me to overwrite the file, I click yes
> 8. It prompts: "The file 'OCLinEcoreTutorial/model/Tutorial.ecore' has
> changed on the file system. Do you want to replace the editor content
> with these changes?"
I raised a bug a while ago becuase I could not understand the meaning of
these EMF Edit prompts and they didn't do what a user wanted anyway.
> 9. Regardless if I hit YES or NO I get an empty editor with 'ERROR'
> (also I get the same error even if I enter a new file)
> - At this point I need to close it and reopen.
> In the it works, but it is a bit tedious to do all these steps when
> debugging OCL.
>
> What is the correct workflow in this case? What do I miss?
Raise a Bugzilla or send a newsgroup message so that I raise one.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=371982.

I suspect you want one or both of:
- drop a *.ecore copy while continuing to edit *.oclinecore
- edit *.oclinecore with a parasitic *.ecore

In the Juno release /*...*/ comments are persisted in *.ecore. //
comments are not.

Some tools understand Xtext resources and so you can use *.oclinecore
instead of *.ecore. Unfortunately genmodel is not one of them:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=371125.

Regards

Ed Willink
Re: CompleteOCL and Invocation and Setting Delegates [message #803487 is a reply to message #801646] Tue, 21 February 2012 12:18 Go to previous message
Filip Krikava is currently offline Filip KrikavaFriend
Messages: 43
Registered: January 2012
Member
Even more reasons to look to Juno Smile

Thanks a lot
Filip
Previous Topic:OCLinEcore does not work with Xtext 2.2.1
Next Topic:Implicit collect() flattening and OCLInEcore expression rewrite
Goto Forum:
  


Current Time: Mon Dec 22 12:45:03 GMT 2014

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

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