Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Model Integrity in EMF with MDT OCL
Model Integrity in EMF with MDT OCL [message #424548] Wed, 29 October 2008 20:20 Go to next message
Cristina Missing name is currently offline Cristina Missing nameFriend
Messages: 21
Registered: July 2009
Junior Member
Hi all!

I am a EMF/GMF user and I am trying to include OCL constraints directly in
my metamodels (instead of doing it in my .gmfmap files).

I have read and tried to reproduce the example described in the article
"Implementing Model Integrity in EMF with MDT OCL"
( http://www.eclipse.org/articles/article.php?file=Article-EMF -Codegen-with-OCL/index.html)...
But, I find it impossible :-S

I am using Ganymede... actually, the bundle for Model-Driven Development,
available in the main Ganymede download page
( http://www.eclipse.org/downloads/download.php?file=/technolo gy/epp/downloads/release/ganymede/SR1/eclipse-modeling-ganym ede-SR1-incubation-win32.zip).

When I open the employee example project (directly downloaded from the
article page), I get the following error:

"Unsatisfied version constraint: org.eclipse.emf.codegen.ecore:
[2.3.0,2.4.0)"

How I tried to solve the problem:

1) I have opened the "Dependencies" in the MANIFEST.MF (where the error is
detected).

2) Selected the org.eclipse.emf.codegen.ecore item

3) Pressed the "properties" button

4) Select the only "Available version to match" =>
org.eclipse.emf.codegen.ecore (2.4.1.v200808251517)

5) Pressed the "Match" button => the minimum version changes automatilly
to 2.4.1 (inclusive)

6) Pressed OK

The problem is solved !!! However... I follow the instructios and
"generate all" from the \model\Employee.genmodel

114 errors arise, most of them described as: "Company cannot be resolved
to a type", "Department cannot be resolved to a type"... and so on.

How can I reproduce the experiment described in the paper? Do I need
another Eclipse (maybe Europa)?

Any help will be very wellcome :-D

Cheers!

Cristina
Re: Model Integrity in EMF with MDT OCL [message #424549 is a reply to message #424548] Wed, 29 October 2008 20:36 Go to previous messageGo to next message
Cristina Missing name is currently offline Cristina Missing nameFriend
Messages: 21
Registered: July 2009
Junior Member
Hi again,

I have just realized something when tracing the errors I mentioned in my
previous post (e.g. "Company cannot be resolved as a type")...

The classes implementing the metamodel concepts (Employee, Department, and
Company) ARE EMPTY!!

/org.eclipse.ocl.examples.employee/src/org/eclipse/ocl/examp les/employee/(*)

(*) Employee.java, Department.java, Company.java => EMPTY

/org.eclipse.ocl.examples.employee/src/org/eclipse/ocl/examp les/employee/impl/(**)

(**) EmployeeImpl.java, DepartmentImpl.java, CompanyImpl.java => EMPTY

Thus, I think it is a generatino problem with the JET templates!! :S

Any idea?
Re: Model Integrity in EMF with MDT OCL [message #424553 is a reply to message #424549] Wed, 29 October 2008 22:19 Go to previous messageGo to next message
gary s thompson is currently offline gary s thompsonFriend
Messages: 92
Registered: July 2009
Member
Cristina wrote:
> Hi again,
> I have just realized something when tracing the errors I mentioned in my
> previous post (e.g. "Company cannot be resolved as a type")...
> The classes implementing the metamodel concepts (Employee, Department,
> and Company) ARE EMPTY!!
>
> /org.eclipse.ocl.examples.employee/src/org/eclipse/ocl/examp les/employee/(*)
>
>
> (*) Employee.java, Department.java, Company.java => EMPTY
>
> /org.eclipse.ocl.examples.employee/src/org/eclipse/ocl/examp les/employee/impl/(**)
>
>
> (**) EmployeeImpl.java, DepartmentImpl.java, CompanyImpl.java => EMPTY
> Thus, I think it is a generatino problem with the JET templates!! :S
>
> Any idea?
>

In my hands this usually implies that the source code generated from the
jet template is bad (because the jet template is bad or the model is bad).

so
1. in the navigator pane select the down arrow and select filters
2. uncheck .*
3. you should have a .JETEmitters project
4. navigate to
..JETEmitters/src/org/eclipse/emf/codegen/ecore/templates/mo del/Class_.java
and look for errors and correct them in you jet templates

to get a complete recompile you may need to

1. delete the .JETEmitters project (remember to check "Delete project
contents on disk...")
2. you may also need to delete the empty source files from you projects
as well

regards
gary
Re: Model Integrity in EMF with MDT OCL [message #424564 is a reply to message #424549] Thu, 30 October 2008 02:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, Cristina,

In addition to Gary's note, I should add that no attempt has been made
(that I know of) to port the templates in the article to EMF 2.4 (the
Ganymede version). The article was originally written for EMF 2.2 and
was later updated for 2.3. It is quite likely that the EMF templates
extended by the article were changed in the 2.4 release such that the
extensions no longer work.

So, if you can get it working with the Europa (2.3) version, then you
might enjoy contributing an update of the article. :-)

Can you guess why this example is a one-off article and not an official
OCL SDK Example plug-in? ;-)

Cheers,

Christian

Cristina wrote:
> Hi again,
> I have just realized something when tracing the errors I mentioned in my
> previous post (e.g. "Company cannot be resolved as a type")...
> The classes implementing the metamodel concepts (Employee, Department,
> and Company) ARE EMPTY!!
>
> /org.eclipse.ocl.examples.employee/src/org/eclipse/ocl/examp les/employee/(*)
>
>
> (*) Employee.java, Department.java, Company.java => EMPTY
>
> /org.eclipse.ocl.examples.employee/src/org/eclipse/ocl/examp les/employee/impl/(**)
>
>
> (**) EmployeeImpl.java, DepartmentImpl.java, CompanyImpl.java => EMPTY
> Thus, I think it is a generatino problem with the JET templates!! :S
>
> Any idea?
>
Re: Model Integrity in EMF with MDT OCL [message #424567 is a reply to message #424549] Thu, 30 October 2008 08:24 Go to previous messageGo to next message
Cristina Missing name is currently offline Cristina Missing nameFriend
Messages: 21
Registered: July 2009
Junior Member
Thank you very much for your answers !!

If I manage to adapt/implement a solution for EMF 2.4 (Ganymede version),
I will post it for anyone having the same problem!! :D

Cheers!

Cristina
Re: Model Integrity in EMF with MDT OCL [message #424571 is a reply to message #424567] Thu, 30 October 2008 10:29 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090807050502020801020000
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Cristina/Christian

It wold probably be helpful to maintain something on the wiki
<http://wiki.eclipse.org/MDT-OCL>

http://wiki.eclipse.org/MDT-OCL

Or maybe folks are more likely to find it among the EMF recipes:
<http://wiki.eclipse.org/EMF/Recipes>

http://wiki.eclipse.org/EMF/Recipes


Cristina wrote:
> Thank you very much for your answers !!
>
> If I manage to adapt/implement a solution for EMF 2.4 (Ganymede
> version), I will post it for anyone having the same problem!! :D
>
> Cheers!
>
> Cristina
>

--------------090807050502020801020000
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Cristina/Christian<br>
<br>
It wold probably be helpful to maintain something on the wiki<a
href="http://wiki.eclipse.org/MDT-OCL"><br>
</a>
<blockquote><a href="http://wiki.eclipse.org/MDT-OCL">http://wiki.eclipse.org/MDT-OCL</a><br>
</blockquote>
Or maybe folks are more likely to find it among the EMF recipes:<a
href="http://wiki.eclipse.org/EMF/Recipes"><br>
</a>
<blockquote><a href="http://wiki.eclipse.org/EMF/Recipes">http://wiki.eclipse.org/EMF/Recipes</a><br>
</blockquote>
<br>
Cristina wrote:
<blockquote
cite="mid:30436523d6627dbc180e1023cce9f30f$1@www.eclipse.org"
type="cite">Thank you very much for your answers !!
<br>
<br>
If I manage to adapt/implement a solution for EMF 2.4 (Ganymede
version), I will post it for anyone having the same problem!! :D
<br>
<br>
Cheers!
<br>
<br>
Cristina
<br>
<br>
</blockquote>
</body>
</html>

--------------090807050502020801020000--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Model Integrity in EMF with MDT OCL [message #424625 is a reply to message #424571] Fri, 31 October 2008 15:08 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Hi everybody

I've followed the discussion and i often visit the tutorial from Mr
Damus on Eclipse wiki.
And every time i answering why this kind of behaviour (putting ocl
constraints in eAnnotations) is not by default integrated in emf/ocl ?
it could be good to have an option in eclipse preferences : activate JET
templates for OCL
and getting the behavior described in the tutorial ?
what do you think about ?

Regards

Ed Merks a écrit :
> Cristina/Christian
>
> It wold probably be helpful to maintain something on the wiki
> <http://wiki.eclipse.org/MDT-OCL>
>
> http://wiki.eclipse.org/MDT-OCL
>
> Or maybe folks are more likely to find it among the EMF recipes:
> <http://wiki.eclipse.org/EMF/Recipes>
>
> http://wiki.eclipse.org/EMF/Recipes
>
>
> Cristina wrote:
>> Thank you very much for your answers !!
>>
>> If I manage to adapt/implement a solution for EMF 2.4 (Ganymede
>> version), I will post it for anyone having the same problem!! :D
>>
>> Cheers!
>>
>> Cristina
>>




Re: Model Integrity in EMF with MDT OCL [message #424628 is a reply to message #424625] Fri, 31 October 2008 15:31 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Tristan,

There's https://bugs.eclipse.org/bugs/show_bug.cgi?id=191689 so I agree
it would be useful, but nobody has copious spare time. In an ideal
world, the design might be more like
https://bugs.eclipse.org/bugs/show_bug.cgi?id=216701 where downstream
plugins could contribute their "validation language" extensions much
like this bugzilla does for derived features. A potential advantage of
that is that it could then be applied for dynamic as well as generated
models. So many good ideas, so little time...


Tristan FAURE wrote:
> Hi everybody
>
> I've followed the discussion and i often visit the tutorial from Mr
> Damus on Eclipse wiki.
> And every time i answering why this kind of behaviour (putting ocl
> constraints in eAnnotations) is not by default integrated in emf/ocl ?
> it could be good to have an option in eclipse preferences : activate
> JET templates for OCL
> and getting the behavior described in the tutorial ?
> what do you think about ?
>
> Regards
>
> Ed Merks a écrit :
>> Cristina/Christian
>>
>> It wold probably be helpful to maintain something on the wiki
>> <http://wiki.eclipse.org/MDT-OCL>
>>
>> http://wiki.eclipse.org/MDT-OCL
>>
>> Or maybe folks are more likely to find it among the EMF recipes:
>> <http://wiki.eclipse.org/EMF/Recipes>
>>
>> http://wiki.eclipse.org/EMF/Recipes
>>
>>
>> Cristina wrote:
>>> Thank you very much for your answers !!
>>>
>>> If I manage to adapt/implement a solution for EMF 2.4 (Ganymede
>>> version), I will post it for anyone having the same problem!! :D
>>>
>>> Cheers!
>>>
>>> Cristina
>>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Model Integrity in EMF with MDT OCL [message #424701 is a reply to message #424628] Mon, 03 November 2008 09:51 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Hi Ed

I have been visited your links and i agree with your solutions
but why can't we imagine a solution using EMF validation framework

Don't you think it could be simpler to design a solution using it ? (or
maybe i didn't evaluate all the problems)

Ed Merks a écrit :
> Tristan,
>
> There's https://bugs.eclipse.org/bugs/show_bug.cgi?id=191689 so I agree
> it would be useful, but nobody has copious spare time. In an ideal
> world, the design might be more like
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=216701 where downstream
> plugins could contribute their "validation language" extensions much
> like this bugzilla does for derived features. A potential advantage of
> that is that it could then be applied for dynamic as well as generated
> models. So many good ideas, so little time...
>
>
> Tristan FAURE wrote:
>> Hi everybody
>>
>> I've followed the discussion and i often visit the tutorial from Mr
>> Damus on Eclipse wiki.
>> And every time i answering why this kind of behaviour (putting ocl
>> constraints in eAnnotations) is not by default integrated in emf/ocl ?
>> it could be good to have an option in eclipse preferences : activate
>> JET templates for OCL
>> and getting the behavior described in the tutorial ?
>> what do you think about ?
>>
>> Regards
>>
>> Ed Merks a écrit :
>>> Cristina/Christian
>>>
>>> It wold probably be helpful to maintain something on the wiki
>>> <http://wiki.eclipse.org/MDT-OCL>
>>>
>>> http://wiki.eclipse.org/MDT-OCL
>>>
>>> Or maybe folks are more likely to find it among the EMF recipes:
>>> <http://wiki.eclipse.org/EMF/Recipes>
>>>
>>> http://wiki.eclipse.org/EMF/Recipes
>>>
>>>
>>> Cristina wrote:
>>>> Thank you very much for your answers !!
>>>>
>>>> If I manage to adapt/implement a solution for EMF 2.4 (Ganymede
>>>> version), I will post it for anyone having the same problem!! :D
>>>>
>>>> Cheers!
>>>>
>>>> Cristina
>>>>




Re: Model Integrity in EMF with MDT OCL [message #424709 is a reply to message #424701] Mon, 03 November 2008 12:35 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Tristan,

I'm not really quite sure what you're asking. Many folks like to use
OCL to express constraints so I imagine a good solution would make that
easy, but would be extensible so that any expression language could be
used... The extended Validation Framework already has all kinds of
support for this stuff, but it's more focused on contributing
constraints that are external to the model and can be individually
turned on and off, whereas in EMF core we're focused on constraints that
are intrinsic to the model and must always be satisfied...


Tristan FAURE wrote:
> Hi Ed
>
> I have been visited your links and i agree with your solutions
> but why can't we imagine a solution using EMF validation framework
>
> Don't you think it could be simpler to design a solution using it ?
> (or maybe i didn't evaluate all the problems)
>
> Ed Merks a écrit :
>> Tristan,
>>
>> There's https://bugs.eclipse.org/bugs/show_bug.cgi?id=191689 so I
>> agree it would be useful, but nobody has copious spare time. In an
>> ideal world, the design might be more like
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=216701 where downstream
>> plugins could contribute their "validation language" extensions much
>> like this bugzilla does for derived features. A potential advantage
>> of that is that it could then be applied for dynamic as well as
>> generated models. So many good ideas, so little time...
>>
>>
>> Tristan FAURE wrote:
>>> Hi everybody
>>>
>>> I've followed the discussion and i often visit the tutorial from Mr
>>> Damus on Eclipse wiki.
>>> And every time i answering why this kind of behaviour (putting ocl
>>> constraints in eAnnotations) is not by default integrated in emf/ocl ?
>>> it could be good to have an option in eclipse preferences : activate
>>> JET templates for OCL
>>> and getting the behavior described in the tutorial ?
>>> what do you think about ?
>>>
>>> Regards
>>>
>>> Ed Merks a écrit :
>>>> Cristina/Christian
>>>>
>>>> It wold probably be helpful to maintain something on the wiki
>>>> <http://wiki.eclipse.org/MDT-OCL>
>>>>
>>>> http://wiki.eclipse.org/MDT-OCL
>>>>
>>>> Or maybe folks are more likely to find it among the EMF recipes:
>>>> <http://wiki.eclipse.org/EMF/Recipes>
>>>>
>>>> http://wiki.eclipse.org/EMF/Recipes
>>>>
>>>>
>>>> Cristina wrote:
>>>>> Thank you very much for your answers !!
>>>>>
>>>>> If I manage to adapt/implement a solution for EMF 2.4 (Ganymede
>>>>> version), I will post it for anyone having the same problem!! :D
>>>>>
>>>>> Cheers!
>>>>>
>>>>> Cristina
>>>>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Model Integrity in EMF with MDT OCL [message #424719 is a reply to message #424709] Mon, 03 November 2008 13:12 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Ed,

Okay you answered my question thank you
i will check my current tasks and I will see if it is possible for me to
contribute for this request (but i'm not very familiar with eclipse process)

Ed Merks a écrit :
> Tristan,
>
> I'm not really quite sure what you're asking. Many folks like to use
> OCL to express constraints so I imagine a good solution would make that
> easy, but would be extensible so that any expression language could be
> used... The extended Validation Framework already has all kinds of
> support for this stuff, but it's more focused on contributing
> constraints that are external to the model and can be individually
> turned on and off, whereas in EMF core we're focused on constraints that
> are intrinsic to the model and must always be satisfied...
>
>
> Tristan FAURE wrote:
>> Hi Ed
>>
>> I have been visited your links and i agree with your solutions
>> but why can't we imagine a solution using EMF validation framework
>>
>> Don't you think it could be simpler to design a solution using it ?
>> (or maybe i didn't evaluate all the problems)
>>
>> Ed Merks a écrit :
>>> Tristan,
>>>
>>> There's https://bugs.eclipse.org/bugs/show_bug.cgi?id=191689 so I
>>> agree it would be useful, but nobody has copious spare time. In an
>>> ideal world, the design might be more like
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=216701 where downstream
>>> plugins could contribute their "validation language" extensions much
>>> like this bugzilla does for derived features. A potential advantage
>>> of that is that it could then be applied for dynamic as well as
>>> generated models. So many good ideas, so little time...
>>>
>>>
>>> Tristan FAURE wrote:
>>>> Hi everybody
>>>>
>>>> I've followed the discussion and i often visit the tutorial from Mr
>>>> Damus on Eclipse wiki.
>>>> And every time i answering why this kind of behaviour (putting ocl
>>>> constraints in eAnnotations) is not by default integrated in emf/ocl ?
>>>> it could be good to have an option in eclipse preferences : activate
>>>> JET templates for OCL
>>>> and getting the behavior described in the tutorial ?
>>>> what do you think about ?
>>>>
>>>> Regards
>>>>
>>>> Ed Merks a écrit :
>>>>> Cristina/Christian
>>>>>
>>>>> It wold probably be helpful to maintain something on the wiki
>>>>> <http://wiki.eclipse.org/MDT-OCL>
>>>>>
>>>>> http://wiki.eclipse.org/MDT-OCL
>>>>>
>>>>> Or maybe folks are more likely to find it among the EMF recipes:
>>>>> <http://wiki.eclipse.org/EMF/Recipes>
>>>>>
>>>>> http://wiki.eclipse.org/EMF/Recipes
>>>>>
>>>>>
>>>>> Cristina wrote:
>>>>>> Thank you very much for your answers !!
>>>>>>
>>>>>> If I manage to adapt/implement a solution for EMF 2.4 (Ganymede
>>>>>> version), I will post it for anyone having the same problem!! :D
>>>>>>
>>>>>> Cheers!
>>>>>>
>>>>>> Cristina
>>>>>>




Re: Model Integrity in EMF with MDT OCL [message #424725 is a reply to message #424719] Mon, 03 November 2008 13:43 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030805000402020906060808
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Tristan,

Patches in bugzillas or even helpful experience descriptions in the FAQ
or the EMF Recipes are always appreciated. :-)

http://wiki.eclipse.org/EMF/Recipes
http://wiki.eclipse.org/EMF/Getting_Source


Tristan FAURE wrote:
> Ed,
>
> Okay you answered my question thank you
> i will check my current tasks and I will see if it is possible for me
> to contribute for this request (but i'm not very familiar with eclipse
> process)
>
> Ed Merks a


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Model Integrity in EMF with MDT OCL [message #424726 is a reply to message #424628] Mon, 03 November 2008 14:38 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Ed,

I fork for another branch of discussion

I return into your contribution for settingDelegate and i have been
inspecting the code and the feature but i don't understand how does it work.

I've downloaded your Association test and it seems the feature permits
to define where a derived eattribute or ereference can be resolved but i
don't understand how to use it and i'm a little frustrated because it
seems a very interesting feature :)

For example in Association.ecore
package oneOwnedEndUnbounded
class A
ref bs
in the eannotation you defined settingDelegate using string :
org.eclipse.emf.ecore.Path#aBLinks/b

I don't understand how we can use org.eclipse.emf.ecore.Path and what is
the target reference

so if you can explain me or giving me link for documentation (sorry i
didn't find except the bugzilla you already given) i will be very glad

Best regards

Ed Merks a écrit :
> Tristan,
>
> There's https://bugs.eclipse.org/bugs/show_bug.cgi?id=191689 so I agree
> it would be useful, but nobody has copious spare time. In an ideal
> world, the design might be more like
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=216701 where downstream
> plugins could contribute their "validation language" extensions much
> like this bugzilla does for derived features. A potential advantage of
> that is that it could then be applied for dynamic as well as generated
> models. So many good ideas, so little time...
>
>
> Tristan FAURE wrote:
>> Hi everybody
>>
>> I've followed the discussion and i often visit the tutorial from Mr
>> Damus on Eclipse wiki.
>> And every time i answering why this kind of behaviour (putting ocl
>> constraints in eAnnotations) is not by default integrated in emf/ocl ?
>> it could be good to have an option in eclipse preferences : activate
>> JET templates for OCL
>> and getting the behavior described in the tutorial ?
>> what do you think about ?
>>
>> Regards
>>
>> Ed Merks a écrit :
>>> Cristina/Christian
>>>
>>> It wold probably be helpful to maintain something on the wiki
>>> <http://wiki.eclipse.org/MDT-OCL>
>>>
>>> http://wiki.eclipse.org/MDT-OCL
>>>
>>> Or maybe folks are more likely to find it among the EMF recipes:
>>> <http://wiki.eclipse.org/EMF/Recipes>
>>>
>>> http://wiki.eclipse.org/EMF/Recipes
>>>
>>>
>>> Cristina wrote:
>>>> Thank you very much for your answers !!
>>>>
>>>> If I manage to adapt/implement a solution for EMF 2.4 (Ganymede
>>>> version), I will post it for anyone having the same problem!! :D
>>>>
>>>> Cheers!
>>>>
>>>> Cristina
>>>>




Re: Model Integrity in EMF with MDT OCL [message #424727 is a reply to message #424726] Mon, 03 November 2008 15:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Tristan,

Comments below.


Tristan FAURE wrote:
> Ed,
>
> I fork for another branch of discussion
>
> I return into your contribution for settingDelegate and i have been
> inspecting the code and the feature but i don't understand how does it
> work.
:-)
>
> I've downloaded your Association test and it seems the feature permits
> to define where a derived eattribute or ereference can be resolved but
> i don't understand how to use it and i'm a little frustrated because
> it seems a very interesting feature :)
Dark mysteries. It's been a while since I looked...
>
> For example in Association.ecore
> package oneOwnedEndUnbounded
> class A
> ref bs
> in the eannotation you defined settingDelegate using string :
> org.eclipse.emf.ecore.Path#aBLinks/b
>
> I don't understand how we can use org.eclipse.emf.ecore.Path and what
> is the target reference
The part before the # is the key in the registry of factories for
creating setting delegates. See how it's registered in
EStructuralFeature.SettingDelegate.Factory.Registry.Impl?

>
> so if you can explain me or giving me link for documentation (sorry i
> didn't find except the bugzilla you already given) i will be very glad
See the code here where it extracts the fragment when creating the
setting delegate?

String namePath = URI.createURI(eStructuralFeature.getEAnnotation(EcorePackage .eNS_URI).getDetails().get( "settingDelegate")).fragment();


So the path is interpreted by the implementation class that's created...
>
> Best regards
>
> Ed Merks a écrit :
>> Tristan,
>>
>> There's https://bugs.eclipse.org/bugs/show_bug.cgi?id=191689 so I
>> agree it would be useful, but nobody has copious spare time. In an
>> ideal world, the design might be more like
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=216701 where downstream
>> plugins could contribute their "validation language" extensions much
>> like this bugzilla does for derived features. A potential advantage
>> of that is that it could then be applied for dynamic as well as
>> generated models. So many good ideas, so little time...
>>
>>
>> Tristan FAURE wrote:
>>> Hi everybody
>>>
>>> I've followed the discussion and i often visit the tutorial from Mr
>>> Damus on Eclipse wiki.
>>> And every time i answering why this kind of behaviour (putting ocl
>>> constraints in eAnnotations) is not by default integrated in emf/ocl ?
>>> it could be good to have an option in eclipse preferences : activate
>>> JET templates for OCL
>>> and getting the behavior described in the tutorial ?
>>> what do you think about ?
>>>
>>> Regards
>>>
>>> Ed Merks a écrit :
>>>> Cristina/Christian
>>>>
>>>> It wold probably be helpful to maintain something on the wiki
>>>> <http://wiki.eclipse.org/MDT-OCL>
>>>>
>>>> http://wiki.eclipse.org/MDT-OCL
>>>>
>>>> Or maybe folks are more likely to find it among the EMF recipes:
>>>> <http://wiki.eclipse.org/EMF/Recipes>
>>>>
>>>> http://wiki.eclipse.org/EMF/Recipes
>>>>
>>>>
>>>> Cristina wrote:
>>>>> Thank you very much for your answers !!
>>>>>
>>>>> If I manage to adapt/implement a solution for EMF 2.4 (Ganymede
>>>>> version), I will post it for anyone having the same problem!! :D
>>>>>
>>>>> Cheers!
>>>>>
>>>>> Cristina
>>>>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Model Integrity in EMF with MDT OCL [message #425147 is a reply to message #424727] Mon, 17 November 2008 08:33 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Hi !

I've been watched and executed EMF code for a long time. And i don't
really know how to implement the constraint mechanisms if I follow the
OCL tutorial I think this mechanism only works with EMF generated code
and not for dynamic instance
And when i see Dynamic instance mechanism I don't understand how it can
work with Generated code

In fact are the mechanisms duplicated to work with the two mechanisms ?

Ed Merks a écrit :
> Tristan,
>
> Comments below.
>
>
> Tristan FAURE wrote:
>> Ed,
>>
>> I fork for another branch of discussion
>>
>> I return into your contribution for settingDelegate and i have been
>> inspecting the code and the feature but i don't understand how does it
>> work.
> :-)
>>
>> I've downloaded your Association test and it seems the feature permits
>> to define where a derived eattribute or ereference can be resolved but
>> i don't understand how to use it and i'm a little frustrated because
>> it seems a very interesting feature :)
> Dark mysteries. It's been a while since I looked...
>>
>> For example in Association.ecore
>> package oneOwnedEndUnbounded
>> class A
>> ref bs
>> in the eannotation you defined settingDelegate using string :
>> org.eclipse.emf.ecore.Path#aBLinks/b
>>
>> I don't understand how we can use org.eclipse.emf.ecore.Path and what
>> is the target reference
> The part before the # is the key in the registry of factories for
> creating setting delegates. See how it's registered in
> EStructuralFeature.SettingDelegate.Factory.Registry.Impl?
>
>>
>> so if you can explain me or giving me link for documentation (sorry i
>> didn't find except the bugzilla you already given) i will be very glad
> See the code here where it extracts the fragment when creating the
> setting delegate?
>
> String namePath =
> URI.createURI(eStructuralFeature.getEAnnotation(EcorePackage .eNS_URI).getDetails().get( "settingDelegate")).fragment();
>
>
> So the path is interpreted by the implementation class that's created...
>>
>> Best regards
>>
>> Ed Merks a écrit :
>>> Tristan,
>>>
>>> There's https://bugs.eclipse.org/bugs/show_bug.cgi?id=191689 so I
>>> agree it would be useful, but nobody has copious spare time. In an
>>> ideal world, the design might be more like
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=216701 where downstream
>>> plugins could contribute their "validation language" extensions much
>>> like this bugzilla does for derived features. A potential advantage
>>> of that is that it could then be applied for dynamic as well as
>>> generated models. So many good ideas, so little time...
>>>
>>>
>>> Tristan FAURE wrote:
>>>> Hi everybody
>>>>
>>>> I've followed the discussion and i often visit the tutorial from Mr
>>>> Damus on Eclipse wiki.
>>>> And every time i answering why this kind of behaviour (putting ocl
>>>> constraints in eAnnotations) is not by default integrated in emf/ocl ?
>>>> it could be good to have an option in eclipse preferences : activate
>>>> JET templates for OCL
>>>> and getting the behavior described in the tutorial ?
>>>> what do you think about ?
>>>>
>>>> Regards
>>>>
>>>> Ed Merks a écrit :
>>>>> Cristina/Christian
>>>>>
>>>>> It wold probably be helpful to maintain something on the wiki
>>>>> <http://wiki.eclipse.org/MDT-OCL>
>>>>>
>>>>> http://wiki.eclipse.org/MDT-OCL
>>>>>
>>>>> Or maybe folks are more likely to find it among the EMF recipes:
>>>>> <http://wiki.eclipse.org/EMF/Recipes>
>>>>>
>>>>> http://wiki.eclipse.org/EMF/Recipes
>>>>>
>>>>>
>>>>> Cristina wrote:
>>>>>> Thank you very much for your answers !!
>>>>>>
>>>>>> If I manage to adapt/implement a solution for EMF 2.4 (Ganymede
>>>>>> version), I will post it for anyone having the same problem!! :D
>>>>>>
>>>>>> Cheers!
>>>>>>
>>>>>> Cristina
>>>>>>




Re: Model Integrity in EMF with MDT OCL [message #425155 is a reply to message #425147] Mon, 17 November 2008 17:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, Tristan,

The article that is the subject of this thread addresses only generated
Ecore models, as it extends the code generation process.

For early access to (and feed-back) on some ideas that will support
dynamic models, have a look at:

http://bugs.eclipse.org/216701
http://bugs.eclipse.org/255469

Cheers,

Christian

Tristan FAURE wrote:
> Hi !
>
> I've been watched and executed EMF code for a long time. And i don't
> really know how to implement the constraint mechanisms if I follow the
> OCL tutorial I think this mechanism only works with EMF generated code
> and not for dynamic instance
> And when i see Dynamic instance mechanism I don't understand how it can
> work with Generated code
>
> In fact are the mechanisms duplicated to work with the two mechanisms ?
>
> Ed Merks a écrit :
>> Tristan,
>>
>> Comments below.

-----8<-----
Re: Model Integrity in EMF with MDT OCL [message #425175 is a reply to message #425155] Tue, 18 November 2008 09:53 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Thank you for answer

i have a question we talk about providing feature for Model constraints

Are we talking about defining constraints validated during Validation
process or Integrity constraints where the constraints are checked for
each model notification ?

Christian W. Damus a écrit :
> Hi, Tristan,
>
> The article that is the subject of this thread addresses only generated
> Ecore models, as it extends the code generation process.
>
> For early access to (and feed-back) on some ideas that will support
> dynamic models, have a look at:
>
> http://bugs.eclipse.org/216701
> http://bugs.eclipse.org/255469
>
> Cheers,
>
> Christian
>
> Tristan FAURE wrote:
>> Hi !
>>
>> I've been watched and executed EMF code for a long time. And i don't
>> really know how to implement the constraint mechanisms if I follow the
>> OCL tutorial I think this mechanism only works with EMF generated code
>> and not for dynamic instance
>> And when i see Dynamic instance mechanism I don't understand how it
>> can work with Generated code
>>
>> In fact are the mechanisms duplicated to work with the two mechanisms ?
>>
>> Ed Merks a écrit :
>>> Tristan,
>>>
>>> Comments below.
>
> -----8<-----




Re: Model Integrity in EMF with MDT OCL [message #425179 is a reply to message #425175] Tue, 18 November 2008 14:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, Tristan,

The enhancements that I referenced in bugzilla are extensions to the
Ecore modeling capability. The core EMF run-time provides on-demand
validation through EValidators but never evaluates constraints
on-the-fly in setter methods, if that is what you mean.

The code-generation approach of the article fits within the same bounds
of the core run-time and the Ecore metamodel.

Of course, the constraints defined in an Ecore model that are recognized
by the EValidator API can also be evaluated in "live" or "batch" mode
validation in the EMF Validation Framework. It's a simple matter to
delegate from the constraint providers of that system to EValidators.

Cheers,

Christian

Tristan FAURE wrote:
> Thank you for answer
>
> i have a question we talk about providing feature for Model constraints
>
> Are we talking about defining constraints validated during Validation
> process or Integrity constraints where the constraints are checked for
> each model notification ?
>
> Christian W. Damus a écrit :
>> Hi, Tristan,
>>
>> The article that is the subject of this thread addresses only
>> generated Ecore models, as it extends the code generation process.
>>
>> For early access to (and feed-back) on some ideas that will support
>> dynamic models, have a look at:
>>
>> http://bugs.eclipse.org/216701
>> http://bugs.eclipse.org/255469
>>
>> Cheers,
>>
>> Christian
>>
>> Tristan FAURE wrote:
>>> Hi !
>>>
>>> I've been watched and executed EMF code for a long time. And i don't
>>> really know how to implement the constraint mechanisms if I follow
>>> the OCL tutorial I think this mechanism only works with EMF generated
>>> code and not for dynamic instance
>>> And when i see Dynamic instance mechanism I don't understand how it
>>> can work with Generated code
>>>
>>> In fact are the mechanisms duplicated to work with the two mechanisms ?
>>>
>>> Ed Merks a écrit :
>>>> Tristan,
>>>>
>>>> Comments below.
>>
>> -----8<-----
Re: Model Integrity in EMF with MDT OCL [message #425181 is a reply to message #425175] Tue, 18 November 2008 14:28 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Hi all

i didn't wait for your answer but if i go to the wrong direction i can
study other solution.

I have designed for my solution where models constraints are checked
with validate menu

the developer :

- creates a factory designed to create its validator
the validator has to implement a validate method :

"boolean validate(String value, EObject object, DiagnosticChain
theDiagnostics, Map<Object, Object> context)"

the parameter value is the string provided by the user it can be OCL
rule, class name, it's just a String and the method knows how to manage it

- adds an extension point referencing its factory and the uri associated
to it

the user :

- designs its metamodel
- puts its constraints with eannotations and the factory used (here for
example OCL)
- Ecore
+ constraints
-> constraint1 constraint2 constraint3
+ factory
-> org.eclipse.ocl#OCL
// org.eclipse.ocl : the factory uri
// OCL the key for defining the constraints
- OCL
+ constraint1
-> self....

To implement this i add behaviour to EObjectvalidator which
1) will check constraints
2) registers the factory and the key
3) check if there is key
4) check if there is constraints defining previously
5) ask the factory to create a validator and validate the current object

The factories are loaded with emf.ecore plugin with all other facotries
(factory_override for example)

I started to test and it seems it works with dynamic instance and
generated EMF code. Maybe i don't see limitations to my solutions
particularly i don't know if it is always possible to resolve EAnnotations

what do you think about ?


Tristan FAURE a écrit :
> Thank you for answer
>
> i have a question we talk about providing feature for Model constraints
>
> Are we talking about defining constraints validated during Validation
> process or Integrity constraints where the constraints are checked for
> each model notification ?
>
> Christian W. Damus a écrit :
>> Hi, Tristan,
>>
>> The article that is the subject of this thread addresses only
>> generated Ecore models, as it extends the code generation process.
>>
>> For early access to (and feed-back) on some ideas that will support
>> dynamic models, have a look at:
>>
>> http://bugs.eclipse.org/216701
>> http://bugs.eclipse.org/255469
>>
>> Cheers,
>>
>> Christian
>>
>> Tristan FAURE wrote:
>>> Hi !
>>>
>>> I've been watched and executed EMF code for a long time. And i don't
>>> really know how to implement the constraint mechanisms if I follow
>>> the OCL tutorial I think this mechanism only works with EMF generated
>>> code and not for dynamic instance
>>> And when i see Dynamic instance mechanism I don't understand how it
>>> can work with Generated code
>>>
>>> In fact are the mechanisms duplicated to work with the two mechanisms ?
>>>
>>> Ed Merks a écrit :
>>>> Tristan,
>>>>
>>>> Comments below.
>>
>> -----8<-----




Re: Model Integrity in EMF with MDT OCL [message #425193 is a reply to message #424725] Wed, 19 November 2008 08:22 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
sorry i double post my answer if anybody noticed my work

Hi all

i didn't wait for your answer but if i go to the wrong direction i can
study other solution.

I have designed for my solution where models constraints are checked
with validate menu

the developer :

- creates a factory designed to create its validator
the validator has to implement a validate method :

"boolean validate(String value, EObject object, DiagnosticChain
theDiagnostics, Map<Object, Object> context)"

the parameter value is the string provided by the user it can be OCL
rule, class name, it's just a String and the method knows how to manage it

- adds an extension point referencing its factory and the uri associated
to it

the user :

- designs its metamodel
- puts its constraints with eannotations and the factory used (here for
example OCL)
- Ecore
+ constraints
-> constraint1 constraint2 constraint3
+ factory
-> org.eclipse.ocl#OCL
// org.eclipse.ocl : the factory uri
// OCL the key for defining the constraints
- OCL
+ constraint1
-> self....

To implement this i add behaviour to EObjectvalidator which
1) will check constraints
2) registers the factory and the key
3) check if there is key
4) check if there is constraints defining previously
5) ask the factory to create a validator and validate the current object

The factories are loaded with emf.ecore plugin with all other facotries
(factory_override for example)

I started to test and it seems it works with dynamic instance and
generated EMF code. Maybe i don't see limitations to my solutions
particularly i don't know if it is always possible to resolve EAnnotations

what do you think about ?

Ed Merks a écrit :
> Tristan,
>
> Patches in bugzillas or even helpful experience descriptions in the FAQ
> or the EMF Recipes are always appreciated. :-)
>
> http://wiki.eclipse.org/EMF/Recipes
> http://wiki.eclipse.org/EMF/Getting_Source
>
>
> Tristan FAURE wrote:
>> Ed,
>>
>> Okay you answered my question thank you
>> i will check my current tasks and I will see if it is possible for me
>> to contribute for this request (but i'm not very familiar with eclipse
>> process)
>>
>> Ed Merks a écrit :
>>> Tristan,
>>>
>>> I'm not really quite sure what you're asking. Many folks like to use
>>> OCL to express constraints so I imagine a good solution would make
>>> that easy, but would be extensible so that any expression language
>>> could be used... The extended Validation Framework already has all
>>> kinds of support for this stuff, but it's more focused on
>>> contributing constraints that are external to the model and can be
>>> individually turned on and off, whereas in EMF core we're focused on
>>> constraints that are intrinsic to the model and must always be
>>> satisfied...
>>>
>>>
>>> Tristan FAURE wrote:
>>>> Hi Ed
>>>>
>>>> I have been visited your links and i agree with your solutions
>>>> but why can't we imagine a solution using EMF validation framework
>>>>
>>>> Don't you think it could be simpler to design a solution using it ?
>>>> (or maybe i didn't evaluate all the problems)
>>>>
>>>> Ed Merks a écrit :
>>>>> Tristan,
>>>>>
>>>>> There's https://bugs.eclipse.org/bugs/show_bug.cgi?id=191689 so I
>>>>> agree it would be useful, but nobody has copious spare time. In an
>>>>> ideal world, the design might be more like
>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=216701 where
>>>>> downstream plugins could contribute their "validation language"
>>>>> extensions much like this bugzilla does for derived features. A
>>>>> potential advantage of that is that it could then be applied for
>>>>> dynamic as well as generated models. So many good ideas, so little
>>>>> time...
>>>>>
>>>>>
>>>>> Tristan FAURE wrote:
>>>>>> Hi everybody
>>>>>>
>>>>>> I've followed the discussion and i often visit the tutorial from
>>>>>> Mr Damus on Eclipse wiki.
>>>>>> And every time i answering why this kind of behaviour (putting ocl
>>>>>> constraints in eAnnotations) is not by default integrated in
>>>>>> emf/ocl ?
>>>>>> it could be good to have an option in eclipse preferences :
>>>>>> activate JET templates for OCL
>>>>>> and getting the behavior described in the tutorial ?
>>>>>> what do you think about ?
>>>>>>
>>>>>> Regards
>>>>>>
>>>>>> Ed Merks a écrit :
>>>>>>> Cristina/Christian
>>>>>>>
>>>>>>> It wold probably be helpful to maintain something on the wiki
>>>>>>> <http://wiki.eclipse.org/MDT-OCL>
>>>>>>>
>>>>>>> http://wiki.eclipse.org/MDT-OCL
>>>>>>>
>>>>>>> Or maybe folks are more likely to find it among the EMF recipes:
>>>>>>> <http://wiki.eclipse.org/EMF/Recipes>
>>>>>>>
>>>>>>> http://wiki.eclipse.org/EMF/Recipes
>>>>>>>
>>>>>>>
>>>>>>> Cristina wrote:
>>>>>>>> Thank you very much for your answers !!
>>>>>>>>
>>>>>>>> If I manage to adapt/implement a solution for EMF 2.4 (Ganymede
>>>>>>>> version), I will post it for anyone having the same problem!! :D
>>>>>>>>
>>>>>>>> Cheers!
>>>>>>>>
>>>>>>>> Cristina
>>>>>>>>




Re: Model Integrity in EMF with MDT OCL [message #425198 is a reply to message #425193] Wed, 19 November 2008 10:13 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Tristan,

It sounds cool. :-)


Tristan FAURE wrote:
> sorry i double post my answer if anybody noticed my work
>
> Hi all
>
> i didn't wait for your answer but if i go to the wrong direction i can
> study other solution.
>
> I have designed for my solution where models constraints are checked
> with validate menu
>
> the developer :
>
> - creates a factory designed to create its validator
> the validator has to implement a validate method :
>
> "boolean validate(String value, EObject object, DiagnosticChain
> theDiagnostics, Map<Object, Object> context)"
>
> the parameter value is the string provided by the user it can be OCL
> rule, class name, it's just a String and the method knows how to
> manage it
>
> - adds an extension point referencing its factory and the uri
> associated to it
>
> the user :
>
> - designs its metamodel
> - puts its constraints with eannotations and the factory used (here
> for example OCL)
> - Ecore
> + constraints
> -> constraint1 constraint2 constraint3
> + factory
> -> org.eclipse.ocl#OCL
> // org.eclipse.ocl : the factory uri
> // OCL the key for defining the constraints
> - OCL
> + constraint1
> -> self....
>
> To implement this i add behaviour to EObjectvalidator which
> 1) will check constraints
> 2) registers the factory and the key
> 3) check if there is key
> 4) check if there is constraints defining previously
> 5) ask the factory to create a validator and validate the current object
>
> The factories are loaded with emf.ecore plugin with all other
> facotries (factory_override for example)
>
> I started to test and it seems it works with dynamic instance and
> generated EMF code. Maybe i don't see limitations to my solutions
> particularly i don't know if it is always possible to resolve
> EAnnotations
>
> what do you think about ?
>
> Ed Merks a écrit :
>> Tristan,
>>
>> Patches in bugzillas or even helpful experience descriptions in the
>> FAQ or the EMF Recipes are always appreciated. :-)
>>
>> http://wiki.eclipse.org/EMF/Recipes
>> http://wiki.eclipse.org/EMF/Getting_Source
>>
>>
>> Tristan FAURE wrote:
>>> Ed,
>>>
>>> Okay you answered my question thank you
>>> i will check my current tasks and I will see if it is possible for
>>> me to contribute for this request (but i'm not very familiar with
>>> eclipse process)
>>>
>>> Ed Merks a écrit :
>>>> Tristan,
>>>>
>>>> I'm not really quite sure what you're asking. Many folks like to
>>>> use OCL to express constraints so I imagine a good solution would
>>>> make that easy, but would be extensible so that any expression
>>>> language could be used... The extended Validation Framework
>>>> already has all kinds of support for this stuff, but it's more
>>>> focused on contributing constraints that are external to the model
>>>> and can be individually turned on and off, whereas in EMF core
>>>> we're focused on constraints that are intrinsic to the model and
>>>> must always be satisfied...
>>>>
>>>>
>>>> Tristan FAURE wrote:
>>>>> Hi Ed
>>>>>
>>>>> I have been visited your links and i agree with your solutions
>>>>> but why can't we imagine a solution using EMF validation framework
>>>>>
>>>>> Don't you think it could be simpler to design a solution using it
>>>>> ? (or maybe i didn't evaluate all the problems)
>>>>>
>>>>> Ed Merks a écrit :
>>>>>> Tristan,
>>>>>>
>>>>>> There's https://bugs.eclipse.org/bugs/show_bug.cgi?id=191689 so I
>>>>>> agree it would be useful, but nobody has copious spare time. In
>>>>>> an ideal world, the design might be more like
>>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=216701 where
>>>>>> downstream plugins could contribute their "validation language"
>>>>>> extensions much like this bugzilla does for derived features. A
>>>>>> potential advantage of that is that it could then be applied for
>>>>>> dynamic as well as generated models. So many good ideas, so
>>>>>> little time...
>>>>>>
>>>>>>
>>>>>> Tristan FAURE wrote:
>>>>>>> Hi everybody
>>>>>>>
>>>>>>> I've followed the discussion and i often visit the tutorial from
>>>>>>> Mr Damus on Eclipse wiki.
>>>>>>> And every time i answering why this kind of behaviour (putting
>>>>>>> ocl constraints in eAnnotations) is not by default integrated in
>>>>>>> emf/ocl ?
>>>>>>> it could be good to have an option in eclipse preferences :
>>>>>>> activate JET templates for OCL
>>>>>>> and getting the behavior described in the tutorial ?
>>>>>>> what do you think about ?
>>>>>>>
>>>>>>> Regards
>>>>>>>
>>>>>>> Ed Merks a écrit :
>>>>>>>> Cristina/Christian
>>>>>>>>
>>>>>>>> It wold probably be helpful to maintain something on the wiki
>>>>>>>> <http://wiki.eclipse.org/MDT-OCL>
>>>>>>>>
>>>>>>>> http://wiki.eclipse.org/MDT-OCL
>>>>>>>>
>>>>>>>> Or maybe folks are more likely to find it among the EMF recipes:
>>>>>>>> <http://wiki.eclipse.org/EMF/Recipes>
>>>>>>>>
>>>>>>>> http://wiki.eclipse.org/EMF/Recipes
>>>>>>>>
>>>>>>>>
>>>>>>>> Cristina wrote:
>>>>>>>>> Thank you very much for your answers !!
>>>>>>>>>
>>>>>>>>> If I manage to adapt/implement a solution for EMF 2.4
>>>>>>>>> (Ganymede version), I will post it for anyone having the same
>>>>>>>>> problem!! :D
>>>>>>>>>
>>>>>>>>> Cheers!
>>>>>>>>>
>>>>>>>>> Cristina
>>>>>>>>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Model Integrity in EMF with MDT OCL [message #425206 is a reply to message #425181] Wed, 19 November 2008 13:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, Tristan,

This looks like a clean design, a good approach. This sounds like it
would make a good contribution to complement the enhancements I
referenced, earlier.

What do you mean by your worry about always being able to resolve
annotations? Annotations cannot be cross-resource-contained, so they
can be expected never to be proxies. Also, AFAIK, only the GenModel
annotations can be suppressed from the generated package metadata
(because they are only needed by the generator, not the run-time). Or,
do you mean that the provider of the constraint factory may not be
available at run-time, depending on the Eclipse configuration?

Cheers,

Christian

Tristan FAURE wrote:
> Hi all
>
> i didn't wait for your answer but if i go to the wrong direction i can
> study other solution.
>
> I have designed for my solution where models constraints are checked
> with validate menu
>
> the developer :
>
> - creates a factory designed to create its validator
> the validator has to implement a validate method :
>
> "boolean validate(String value, EObject object, DiagnosticChain
> theDiagnostics, Map<Object, Object> context)"
>
> the parameter value is the string provided by the user it can be OCL
> rule, class name, it's just a String and the method knows how to manage it
>
> - adds an extension point referencing its factory and the uri associated
> to it
>
> the user :
>
> - designs its metamodel
> - puts its constraints with eannotations and the factory used (here for
> example OCL)
> - Ecore
> + constraints
> -> constraint1 constraint2 constraint3
> + factory
> -> org.eclipse.ocl#OCL
> // org.eclipse.ocl : the factory uri
> // OCL the key for defining the constraints
> - OCL
> + constraint1
> -> self....
>
> To implement this i add behaviour to EObjectvalidator which
> 1) will check constraints
> 2) registers the factory and the key
> 3) check if there is key
> 4) check if there is constraints defining previously
> 5) ask the factory to create a validator and validate the current object
>
> The factories are loaded with emf.ecore plugin with all other facotries
> (factory_override for example)
>
> I started to test and it seems it works with dynamic instance and
> generated EMF code. Maybe i don't see limitations to my solutions
> particularly i don't know if it is always possible to resolve EAnnotations
>
> what do you think about ?
>

-----8<-----
Re: Model Integrity in EMF with MDT OCL [message #425208 is a reply to message #425206] Wed, 19 November 2008 14:02 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Hi

bug created : https://bugs.eclipse.org/bugs/show_bug.cgi?id=255786

for EAnnotations yes i would like to know if there is some limitations
I'm quite sure that I don't realize EMF complexity and it's difficult to
say "hey the feature works in all case" :) Particularly when we see the
huge work made by Ed for delegate features

Christian W. Damus a écrit :
> Hi, Tristan,
>
> This looks like a clean design, a good approach. This sounds like it
> would make a good contribution to complement the enhancements I
> referenced, earlier.
>
> What do you mean by your worry about always being able to resolve
> annotations? Annotations cannot be cross-resource-contained, so they
> can be expected never to be proxies. Also, AFAIK, only the GenModel
> annotations can be suppressed from the generated package metadata
> (because they are only needed by the generator, not the run-time). Or,
> do you mean that the provider of the constraint factory may not be
> available at run-time, depending on the Eclipse configuration?
>
> Cheers,
>
> Christian
>
> Tristan FAURE wrote:
>> Hi all
>>
>> i didn't wait for your answer but if i go to the wrong direction i can
>> study other solution.
>>
>> I have designed for my solution where models constraints are checked
>> with validate menu
>>
>> the developer :
>>
>> - creates a factory designed to create its validator
>> the validator has to implement a validate method :
>>
>> "boolean validate(String value, EObject object, DiagnosticChain
>> theDiagnostics, Map<Object, Object> context)"
>>
>> the parameter value is the string provided by the user it can be OCL
>> rule, class name, it's just a String and the method knows how to
>> manage it
>>
>> - adds an extension point referencing its factory and the uri
>> associated to it
>>
>> the user :
>>
>> - designs its metamodel
>> - puts its constraints with eannotations and the factory used (here
>> for example OCL)
>> - Ecore
>> + constraints
>> -> constraint1 constraint2 constraint3
>> + factory
>> -> org.eclipse.ocl#OCL
>> // org.eclipse.ocl : the factory uri
>> // OCL the key for defining the constraints
>> - OCL
>> + constraint1
>> -> self....
>>
>> To implement this i add behaviour to EObjectvalidator which
>> 1) will check constraints
>> 2) registers the factory and the key
>> 3) check if there is key
>> 4) check if there is constraints defining previously
>> 5) ask the factory to create a validator and validate the current object
>>
>> The factories are loaded with emf.ecore plugin with all other
>> facotries (factory_override for example)
>>
>> I started to test and it seems it works with dynamic instance and
>> generated EMF code. Maybe i don't see limitations to my solutions
>> particularly i don't know if it is always possible to resolve
>> EAnnotations
>>
>> what do you think about ?
>>
>
> -----8<-----




Re: Model Integrity in EMF with MDT OCL [message #425458 is a reply to message #425208] Wed, 26 November 2008 17:00 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
no feedbacks :( ?
does somebody checked ? do i need to provide an implementation ?

Tristan FAURE a écrit :
> Hi
>
> bug created : https://bugs.eclipse.org/bugs/show_bug.cgi?id=255786
>
> for EAnnotations yes i would like to know if there is some limitations
> I'm quite sure that I don't realize EMF complexity and it's difficult to
> say "hey the feature works in all case" :) Particularly when we see the
> huge work made by Ed for delegate features
>
> Christian W. Damus a écrit :
>> Hi, Tristan,
>>
>> This looks like a clean design, a good approach. This sounds like it
>> would make a good contribution to complement the enhancements I
>> referenced, earlier.
>>
>> What do you mean by your worry about always being able to resolve
>> annotations? Annotations cannot be cross-resource-contained, so they
>> can be expected never to be proxies. Also, AFAIK, only the GenModel
>> annotations can be suppressed from the generated package metadata
>> (because they are only needed by the generator, not the run-time).
>> Or, do you mean that the provider of the constraint factory may not be
>> available at run-time, depending on the Eclipse configuration?
>>
>> Cheers,
>>
>> Christian
>>
>> Tristan FAURE wrote:
>>> Hi all
>>>
>>> i didn't wait for your answer but if i go to the wrong direction i
>>> can study other solution.
>>>
>>> I have designed for my solution where models constraints are checked
>>> with validate menu
>>>
>>> the developer :
>>>
>>> - creates a factory designed to create its validator
>>> the validator has to implement a validate method :
>>>
>>> "boolean validate(String value, EObject object, DiagnosticChain
>>> theDiagnostics, Map<Object, Object> context)"
>>>
>>> the parameter value is the string provided by the user it can be OCL
>>> rule, class name, it's just a String and the method knows how to
>>> manage it
>>>
>>> - adds an extension point referencing its factory and the uri
>>> associated to it
>>>
>>> the user :
>>>
>>> - designs its metamodel
>>> - puts its constraints with eannotations and the factory used (here
>>> for example OCL)
>>> - Ecore
>>> + constraints
>>> -> constraint1 constraint2 constraint3
>>> + factory
>>> -> org.eclipse.ocl#OCL
>>> // org.eclipse.ocl : the factory uri
>>> // OCL the key for defining the constraints
>>> - OCL
>>> + constraint1
>>> -> self....
>>>
>>> To implement this i add behaviour to EObjectvalidator which
>>> 1) will check constraints
>>> 2) registers the factory and the key
>>> 3) check if there is key
>>> 4) check if there is constraints defining previously
>>> 5) ask the factory to create a validator and validate the current object
>>>
>>> The factories are loaded with emf.ecore plugin with all other
>>> facotries (factory_override for example)
>>>
>>> I started to test and it seems it works with dynamic instance and
>>> generated EMF code. Maybe i don't see limitations to my solutions
>>> particularly i don't know if it is always possible to resolve
>>> EAnnotations
>>>
>>> what do you think about ?
>>>
>>
>> -----8<-----




Re: Model Integrity in EMF with MDT OCL [message #425459 is a reply to message #425458] Wed, 26 November 2008 17:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, Tristan,

Sorry, I've been rather busy and lost track of this ... I'll try to make
time for a closer review of your patch, especially with an eye to how it
would be implemented in OCL.

cW

Tristan FAURE wrote:
> no feedbacks :( ?
> does somebody checked ? do i need to provide an implementation ?
>
> Tristan FAURE a écrit :
>> Hi
>>
>> bug created : https://bugs.eclipse.org/bugs/show_bug.cgi?id=255786
>>
>> for EAnnotations yes i would like to know if there is some limitations
>> I'm quite sure that I don't realize EMF complexity and it's difficult
>> to say "hey the feature works in all case" :) Particularly when we see
>> the huge work made by Ed for delegate features
>>
>> Christian W. Damus a écrit :
>>> Hi, Tristan,
>>>
>>> This looks like a clean design, a good approach. This sounds like it
>>> would make a good contribution to complement the enhancements I
>>> referenced, earlier.
>>>
>>> What do you mean by your worry about always being able to resolve
>>> annotations? Annotations cannot be cross-resource-contained, so they
>>> can be expected never to be proxies. Also, AFAIK, only the GenModel
>>> annotations can be suppressed from the generated package metadata
>>> (because they are only needed by the generator, not the run-time).
>>> Or, do you mean that the provider of the constraint factory may not
>>> be available at run-time, depending on the Eclipse configuration?
>>>
>>> Cheers,
>>>
>>> Christian
>>>
>>> Tristan FAURE wrote:
>>>> Hi all
>>>>
>>>> i didn't wait for your answer but if i go to the wrong direction i
>>>> can study other solution.
>>>>
>>>> I have designed for my solution where models constraints are checked
>>>> with validate menu
>>>>
>>>> the developer :
>>>>
>>>> - creates a factory designed to create its validator
>>>> the validator has to implement a validate method :
>>>>
>>>> "boolean validate(String value, EObject object, DiagnosticChain
>>>> theDiagnostics, Map<Object, Object> context)"
>>>>
>>>> the parameter value is the string provided by the user it can be OCL
>>>> rule, class name, it's just a String and the method knows how to
>>>> manage it
>>>>
>>>> - adds an extension point referencing its factory and the uri
>>>> associated to it
>>>>
>>>> the user :
>>>>
>>>> - designs its metamodel
>>>> - puts its constraints with eannotations and the factory used (here
>>>> for example OCL)
>>>> - Ecore
>>>> + constraints
>>>> -> constraint1 constraint2 constraint3
>>>> + factory
>>>> -> org.eclipse.ocl#OCL
>>>> // org.eclipse.ocl : the factory uri
>>>> // OCL the key for defining the constraints
>>>> - OCL
>>>> + constraint1
>>>> -> self....
>>>>
>>>> To implement this i add behaviour to EObjectvalidator which
>>>> 1) will check constraints
>>>> 2) registers the factory and the key
>>>> 3) check if there is key
>>>> 4) check if there is constraints defining previously
>>>> 5) ask the factory to create a validator and validate the current
>>>> object
>>>>
>>>> The factories are loaded with emf.ecore plugin with all other
>>>> facotries (factory_override for example)
>>>>
>>>> I started to test and it seems it works with dynamic instance and
>>>> generated EMF code. Maybe i don't see limitations to my solutions
>>>> particularly i don't know if it is always possible to resolve
>>>> EAnnotations
>>>>
>>>> what do you think about ?
>>>>
>>>
>>> -----8<-----
Re: Model Integrity in EMF with MDT OCL [message #425482 is a reply to message #425459] Thu, 27 November 2008 08:23 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Thank's christian
i just was a little bit worry about missing some steps in the Eclipse
process

Christian W. Damus a écrit :
> Hi, Tristan,
>
> Sorry, I've been rather busy and lost track of this ... I'll try to make
> time for a closer review of your patch, especially with an eye to how it
> would be implemented in OCL.
>
> cW
>
> Tristan FAURE wrote:
>> no feedbacks :( ?
>> does somebody checked ? do i need to provide an implementation ?
>>
>> Tristan FAURE a écrit :
>>> Hi
>>>
>>> bug created : https://bugs.eclipse.org/bugs/show_bug.cgi?id=255786
>>>
>>> for EAnnotations yes i would like to know if there is some
>>> limitations I'm quite sure that I don't realize EMF complexity and
>>> it's difficult to say "hey the feature works in all case" :)
>>> Particularly when we see the huge work made by Ed for delegate features
>>>
>>> Christian W. Damus a écrit :
>>>> Hi, Tristan,
>>>>
>>>> This looks like a clean design, a good approach. This sounds like
>>>> it would make a good contribution to complement the enhancements I
>>>> referenced, earlier.
>>>>
>>>> What do you mean by your worry about always being able to resolve
>>>> annotations? Annotations cannot be cross-resource-contained, so
>>>> they can be expected never to be proxies. Also, AFAIK, only the
>>>> GenModel annotations can be suppressed from the generated package
>>>> metadata (because they are only needed by the generator, not the
>>>> run-time). Or, do you mean that the provider of the constraint
>>>> factory may not be available at run-time, depending on the Eclipse
>>>> configuration?
>>>>
>>>> Cheers,
>>>>
>>>> Christian
>>>>
>>>> Tristan FAURE wrote:
>>>>> Hi all
>>>>>
>>>>> i didn't wait for your answer but if i go to the wrong direction i
>>>>> can study other solution.
>>>>>
>>>>> I have designed for my solution where models constraints are
>>>>> checked with validate menu
>>>>>
>>>>> the developer :
>>>>>
>>>>> - creates a factory designed to create its validator
>>>>> the validator has to implement a validate method :
>>>>>
>>>>> "boolean validate(String value, EObject object, DiagnosticChain
>>>>> theDiagnostics, Map<Object, Object> context)"
>>>>>
>>>>> the parameter value is the string provided by the user it can be
>>>>> OCL rule, class name, it's just a String and the method knows how
>>>>> to manage it
>>>>>
>>>>> - adds an extension point referencing its factory and the uri
>>>>> associated to it
>>>>>
>>>>> the user :
>>>>>
>>>>> - designs its metamodel
>>>>> - puts its constraints with eannotations and the factory used (here
>>>>> for example OCL)
>>>>> - Ecore
>>>>> + constraints
>>>>> -> constraint1 constraint2 constraint3
>>>>> + factory
>>>>> -> org.eclipse.ocl#OCL
>>>>> // org.eclipse.ocl : the factory uri
>>>>> // OCL the key for defining the constraints
>>>>> - OCL
>>>>> + constraint1
>>>>> -> self....
>>>>>
>>>>> To implement this i add behaviour to EObjectvalidator which
>>>>> 1) will check constraints
>>>>> 2) registers the factory and the key
>>>>> 3) check if there is key
>>>>> 4) check if there is constraints defining previously
>>>>> 5) ask the factory to create a validator and validate the current
>>>>> object
>>>>>
>>>>> The factories are loaded with emf.ecore plugin with all other
>>>>> facotries (factory_override for example)
>>>>>
>>>>> I started to test and it seems it works with dynamic instance and
>>>>> generated EMF code. Maybe i don't see limitations to my solutions
>>>>> particularly i don't know if it is always possible to resolve
>>>>> EAnnotations
>>>>>
>>>>> what do you think about ?
>>>>>
>>>>
>>>> -----8<-----




Re: Model Integrity in EMF with MDT OCL [message #427011 is a reply to message #425482] Wed, 28 January 2009 07:58 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
I've added an OCL implementation. It is easier to check the functionality

Tristan FAURE a écrit :
> Thank's christian
> i just was a little bit worry about missing some steps in the Eclipse
> process
>
> Christian W. Damus a écrit :
>> Hi, Tristan,
>>
>> Sorry, I've been rather busy and lost track of this ... I'll try to
>> make time for a closer review of your patch, especially with an eye to
>> how it would be implemented in OCL.
>>
>> cW
>>
>> Tristan FAURE wrote:
>>> no feedbacks :( ?
>>> does somebody checked ? do i need to provide an implementation ?
>>>
>>> Tristan FAURE a écrit :
>>>> Hi
>>>>
>>>> bug created : https://bugs.eclipse.org/bugs/show_bug.cgi?id=255786
>>>>
>>>> for EAnnotations yes i would like to know if there is some
>>>> limitations I'm quite sure that I don't realize EMF complexity and
>>>> it's difficult to say "hey the feature works in all case" :)
>>>> Particularly when we see the huge work made by Ed for delegate features
>>>>
>>>> Christian W. Damus a écrit :
>>>>> Hi, Tristan,
>>>>>
>>>>> This looks like a clean design, a good approach. This sounds like
>>>>> it would make a good contribution to complement the enhancements I
>>>>> referenced, earlier.
>>>>>
>>>>> What do you mean by your worry about always being able to resolve
>>>>> annotations? Annotations cannot be cross-resource-contained, so
>>>>> they can be expected never to be proxies. Also, AFAIK, only the
>>>>> GenModel annotations can be suppressed from the generated package
>>>>> metadata (because they are only needed by the generator, not the
>>>>> run-time). Or, do you mean that the provider of the constraint
>>>>> factory may not be available at run-time, depending on the Eclipse
>>>>> configuration?
>>>>>
>>>>> Cheers,
>>>>>
>>>>> Christian
>>>>>
>>>>> Tristan FAURE wrote:
>>>>>> Hi all
>>>>>>
>>>>>> i didn't wait for your answer but if i go to the wrong direction i
>>>>>> can study other solution.
>>>>>>
>>>>>> I have designed for my solution where models constraints are
>>>>>> checked with validate menu
>>>>>>
>>>>>> the developer :
>>>>>>
>>>>>> - creates a factory designed to create its validator
>>>>>> the validator has to implement a validate method :
>>>>>>
>>>>>> "boolean validate(String value, EObject object, DiagnosticChain
>>>>>> theDiagnostics, Map<Object, Object> context)"
>>>>>>
>>>>>> the parameter value is the string provided by the user it can be
>>>>>> OCL rule, class name, it's just a String and the method knows how
>>>>>> to manage it
>>>>>>
>>>>>> - adds an extension point referencing its factory and the uri
>>>>>> associated to it
>>>>>>
>>>>>> the user :
>>>>>>
>>>>>> - designs its metamodel
>>>>>> - puts its constraints with eannotations and the factory used
>>>>>> (here for example OCL)
>>>>>> - Ecore
>>>>>> + constraints
>>>>>> -> constraint1 constraint2 constraint3
>>>>>> + factory
>>>>>> -> org.eclipse.ocl#OCL
>>>>>> // org.eclipse.ocl : the factory uri
>>>>>> // OCL the key for defining the constraints
>>>>>> - OCL
>>>>>> + constraint1
>>>>>> -> self....
>>>>>>
>>>>>> To implement this i add behaviour to EObjectvalidator which
>>>>>> 1) will check constraints
>>>>>> 2) registers the factory and the key
>>>>>> 3) check if there is key
>>>>>> 4) check if there is constraints defining previously
>>>>>> 5) ask the factory to create a validator and validate the current
>>>>>> object
>>>>>>
>>>>>> The factories are loaded with emf.ecore plugin with all other
>>>>>> facotries (factory_override for example)
>>>>>>
>>>>>> I started to test and it seems it works with dynamic instance and
>>>>>> generated EMF code. Maybe i don't see limitations to my solutions
>>>>>> particularly i don't know if it is always possible to resolve
>>>>>> EAnnotations
>>>>>>
>>>>>> what do you think about ?
>>>>>>
>>>>>
>>>>> -----8<-----




Re: Model Integrity in EMF with MDT OCL [message #427022 is a reply to message #427011] Wed, 28 January 2009 13:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, Tristan,

Good stuff! You've been truckin' :-)

Are you going to EclipseCon, by any chance? Perhaps we should meet with
Ed to see about closing this deal.

Christian

Tristan FAURE wrote:
> I've added an OCL implementation. It is easier to check the functionality
>
> Tristan FAURE a écrit :
>> Thank's christian
>> i just was a little bit worry about missing some steps in the Eclipse
>> process
>>
>> Christian W. Damus a écrit :
>>> Hi, Tristan,
>>>
>>> Sorry, I've been rather busy and lost track of this ... I'll try to
>>> make time for a closer review of your patch, especially with an eye
>>> to how it would be implemented in OCL.
>>>
>>> cW
>>>
>>> Tristan FAURE wrote:
>>>> no feedbacks :( ?
>>>> does somebody checked ? do i need to provide an implementation ?
>>>>

-----8<-----
Re: Model Integrity in EMF with MDT OCL [message #427023 is a reply to message #427022] Wed, 28 January 2009 14:05 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Hi Christian
Thank's did you try it ?

For eclipsecon don't rub it in, It would be a great pleasure to be
present :'( but i don't think my firm and my wallet will be OK :(


Christian W. Damus a écrit :
> Hi, Tristan,
>
> Good stuff! You've been truckin' :-)
>
> Are you going to EclipseCon, by any chance? Perhaps we should meet with
> Ed to see about closing this deal.
>
> Christian
>
> Tristan FAURE wrote:
>> I've added an OCL implementation. It is easier to check the functionality
>>
>> Tristan FAURE a écrit :
>>> Thank's christian
>>> i just was a little bit worry about missing some steps in the Eclipse
>>> process
>>>
>>> Christian W. Damus a écrit :
>>>> Hi, Tristan,
>>>>
>>>> Sorry, I've been rather busy and lost track of this ... I'll try to
>>>> make time for a closer review of your patch, especially with an eye
>>>> to how it would be implemented in OCL.
>>>>
>>>> cW
>>>>
>>>> Tristan FAURE wrote:
>>>>> no feedbacks :( ?
>>>>> does somebody checked ? do i need to provide an implementation ?
>>>>>
>
> -----8<-----




Re: Model Integrity in EMF with MDT OCL [message #427054 is a reply to message #427011] Fri, 30 January 2009 05:09 Go to previous messageGo to next message
Andrew H is currently offline Andrew HFriend
Messages: 117
Registered: July 2009
Senior Member
FWIW I for one would be quite interested in this or similar functionality
built into EMF. I tend to add a fair bit of OCL in comment boxes to Ecore
Diagrams, but this of course then is only doco and I'd have to duplicate
this when we get to the phase of the project where we will do OCL for real.

Ideally Ecore Diagrams would add explicit support for OCL constraints and
derived features expressed as OCL.

Tristan FAURE wrote:

> I've added an OCL implementation. It is easier to check the functionality

> Tristan FAURE a écrit :
>> Thank's christian
>> i just was a little bit worry about missing some steps in the Eclipse
>> process
>>
>> Christian W. Damus a écrit :
>>> Hi, Tristan,
>>>
>>> Sorry, I've been rather busy and lost track of this ... I'll try to
>>> make time for a closer review of your patch, especially with an eye to
>>> how it would be implemented in OCL.
>>>
>>> cW
>>>
>>> Tristan FAURE wrote:
>>>> no feedbacks :( ?
>>>> does somebody checked ? do i need to provide an implementation ?
>>>>
>>>> Tristan FAURE a écrit :
>>>>> Hi
>>>>>
>>>>> bug created : https://bugs.eclipse.org/bugs/show_bug.cgi?id=255786
>>>>>
>>>>> for EAnnotations yes i would like to know if there is some
>>>>> limitations I'm quite sure that I don't realize EMF complexity and
>>>>> it's difficult to say "hey the feature works in all case" :)
>>>>> Particularly when we see the huge work made by Ed for delegate features
>>>>>
>>>>> Christian W. Damus a écrit :
>>>>>> Hi, Tristan,
>>>>>>
>>>>>> This looks like a clean design, a good approach. This sounds like
>>>>>> it would make a good contribution to complement the enhancements I
>>>>>> referenced, earlier.
>>>>>>
>>>>>> What do you mean by your worry about always being able to resolve
>>>>>> annotations? Annotations cannot be cross-resource-contained, so
>>>>>> they can be expected never to be proxies. Also, AFAIK, only the
>>>>>> GenModel annotations can be suppressed from the generated package
>>>>>> metadata (because they are only needed by the generator, not the
>>>>>> run-time). Or, do you mean that the provider of the constraint
>>>>>> factory may not be available at run-time, depending on the Eclipse
>>>>>> configuration?
>>>>>>
>>>>>> Cheers,
>>>>>>
>>>>>> Christian
>>>>>>
>>>>>> Tristan FAURE wrote:
>>>>>>> Hi all
>>>>>>>
>>>>>>> i didn't wait for your answer but if i go to the wrong direction i
>>>>>>> can study other solution.
>>>>>>>
>>>>>>> I have designed for my solution where models constraints are
>>>>>>> checked with validate menu
>>>>>>>
>>>>>>> the developer :
>>>>>>>
>>>>>>> - creates a factory designed to create its validator
>>>>>>> the validator has to implement a validate method :
>>>>>>>
>>>>>>> "boolean validate(String value, EObject object, DiagnosticChain
>>>>>>> theDiagnostics, Map<Object, Object> context)"
>>>>>>>
>>>>>>> the parameter value is the string provided by the user it can be
>>>>>>> OCL rule, class name, it's just a String and the method knows how
>>>>>>> to manage it
>>>>>>>
>>>>>>> - adds an extension point referencing its factory and the uri
>>>>>>> associated to it
>>>>>>>
>>>>>>> the user :
>>>>>>>
>>>>>>> - designs its metamodel
>>>>>>> - puts its constraints with eannotations and the factory used
>>>>>>> (here for example OCL)
>>>>>>> - Ecore
>>>>>>> + constraints
>>>>>>> -> constraint1 constraint2 constraint3
>>>>>>> + factory
>>>>>>> -> org.eclipse.ocl#OCL
>>>>>>> // org.eclipse.ocl : the factory uri
>>>>>>> // OCL the key for defining the constraints
>>>>>>> - OCL
>>>>>>> + constraint1
>>>>>>> -> self....
>>>>>>>
>>>>>>> To implement this i add behaviour to EObjectvalidator which
>>>>>>> 1) will check constraints
>>>>>>> 2) registers the factory and the key
>>>>>>> 3) check if there is key
>>>>>>> 4) check if there is constraints defining previously
>>>>>>> 5) ask the factory to create a validator and validate the current
>>>>>>> object
>>>>>>>
>>>>>>> The factories are loaded with emf.ecore plugin with all other
>>>>>>> facotries (factory_override for example)
>>>>>>>
>>>>>>> I started to test and it seems it works with dynamic instance and
>>>>>>> generated EMF code. Maybe i don't see limitations to my solutions
>>>>>>> particularly i don't know if it is always possible to resolve
>>>>>>> EAnnotations
>>>>>>>
>>>>>>> what do you think about ?
>>>>>>>
>>>>>>
>>>>>> -----8<-----
Re: Model Integrity in EMF with MDT OCL [message #427057 is a reply to message #427054] Fri, 30 January 2009 11:01 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Hi

i would ask for (maybe) modifying the design
Currently :
for each ECLass
Eclass A
EAnnotation : Ecore
constraints -> constraint1 constraint2
factory -> factoryID
EAnnotation : factoryID
constraint1 -> String interpreted by constraint delegator
EAnnotation : factoryID
constraint2 -> String interpreted by constraint delegator
Eclass B
EAnnotation : Ecore
constraints -> constraint1 constraint2
factory -> factoryID
EAnnotation : factoryID
constraint1 -> String interpreted by constraint delegator
EAnnotation : factoryID
constraint2 -> String interpreted by constraint delegator

Do you think filling factory for each ECLass is irritating ? maybe we
should consider an EAnnotation in EPackage defining Factory example :

EPackage
Eannotation : Ecore
factory -> factoryID#Key
Eclass A
EAnnotation : Ecore
constraints -> constraint1 constraint2
EAnnotation : Key
constraint1 -> String interpreted by constraint delegator
EAnnotation : Key
constraint2 -> String interpreted by constraint delegator
Eclass B
EAnnotation : Ecore
constraints -> constraint1 constraint2
EAnnotation : Key
constraint1 -> String interpreted by constraint delegator
EAnnotation : Key
constraint2 -> String interpreted by constraint delegator

In this example I used the notation with the Key but we keep the factory id

what is your opinion ?


Andrew H a écrit :
> FWIW I for one would be quite interested in this or similar
> functionality built into EMF. I tend to add a fair bit of OCL in comment
> boxes to Ecore Diagrams, but this of course then is only doco and I'd
> have to duplicate this when we get to the phase of the project where we
> will do OCL for real.
>
> Ideally Ecore Diagrams would add explicit support for OCL constraints
> and derived features expressed as OCL.
>
> Tristan FAURE wrote:
>
>> I've added an OCL implementation. It is easier to check the functionality
>
>> Tristan FAURE a écrit :
>>> Thank's christian
>>> i just was a little bit worry about missing some steps in the Eclipse
>>> process
>>>
>>> Christian W. Damus a écrit :
>>>> Hi, Tristan,
>>>>
>>>> Sorry, I've been rather busy and lost track of this ... I'll try to
>>>> make time for a closer review of your patch, especially with an eye
>>>> to how it would be implemented in OCL.
>>>>
>>>> cW
>>>>
>>>> Tristan FAURE wrote:
>>>>> no feedbacks :( ?
>>>>> does somebody checked ? do i need to provide an implementation ?
>>>>>
>>>>> Tristan FAURE a écrit :
>>>>>> Hi
>>>>>>
>>>>>> bug created : https://bugs.eclipse.org/bugs/show_bug.cgi?id=255786
>>>>>>
>>>>>> for EAnnotations yes i would like to know if there is some
>>>>>> limitations I'm quite sure that I don't realize EMF complexity and
>>>>>> it's difficult to say "hey the feature works in all case" :)
>>>>>> Particularly when we see the huge work made by Ed for delegate
>>>>>> features
>>>>>>
>>>>>> Christian W. Damus a écrit :
>>>>>>> Hi, Tristan,
>>>>>>>
>>>>>>> This looks like a clean design, a good approach. This sounds
>>>>>>> like it would make a good contribution to complement the
>>>>>>> enhancements I referenced, earlier.
>>>>>>>
>>>>>>> What do you mean by your worry about always being able to resolve
>>>>>>> annotations? Annotations cannot be cross-resource-contained, so
>>>>>>> they can be expected never to be proxies. Also, AFAIK, only the
>>>>>>> GenModel annotations can be suppressed from the generated package
>>>>>>> metadata (because they are only needed by the generator, not the
>>>>>>> run-time). Or, do you mean that the provider of the constraint
>>>>>>> factory may not be available at run-time, depending on the
>>>>>>> Eclipse configuration?
>>>>>>>
>>>>>>> Cheers,
>>>>>>>
>>>>>>> Christian
>>>>>>>
>>>>>>> Tristan FAURE wrote:
>>>>>>>> Hi all
>>>>>>>>
>>>>>>>> i didn't wait for your answer but if i go to the wrong direction
>>>>>>>> i can study other solution.
>>>>>>>>
>>>>>>>> I have designed for my solution where models constraints are
>>>>>>>> checked with validate menu
>>>>>>>>
>>>>>>>> the developer :
>>>>>>>>
>>>>>>>> - creates a factory designed to create its validator
>>>>>>>> the validator has to implement a validate method :
>>>>>>>>
>>>>>>>> "boolean validate(String value, EObject object, DiagnosticChain
>>>>>>>> theDiagnostics, Map<Object, Object> context)"
>>>>>>>>
>>>>>>>> the parameter value is the string provided by the user it can be
>>>>>>>> OCL rule, class name, it's just a String and the method knows
>>>>>>>> how to manage it
>>>>>>>>
>>>>>>>> - adds an extension point referencing its factory and the uri
>>>>>>>> associated to it
>>>>>>>>
>>>>>>>> the user :
>>>>>>>>
>>>>>>>> - designs its metamodel
>>>>>>>> - puts its constraints with eannotations and the factory used
>>>>>>>> (here for example OCL)
>>>>>>>> - Ecore
>>>>>>>> + constraints
>>>>>>>> -> constraint1 constraint2 constraint3
>>>>>>>> + factory
>>>>>>>> -> org.eclipse.ocl#OCL
>>>>>>>> // org.eclipse.ocl : the factory uri
>>>>>>>> // OCL the key for defining the constraints
>>>>>>>> - OCL
>>>>>>>> + constraint1
>>>>>>>> -> self....
>>>>>>>>
>>>>>>>> To implement this i add behaviour to EObjectvalidator which
>>>>>>>> 1) will check constraints
>>>>>>>> 2) registers the factory and the key
>>>>>>>> 3) check if there is key
>>>>>>>> 4) check if there is constraints defining previously
>>>>>>>> 5) ask the factory to create a validator and validate the
>>>>>>>> current object
>>>>>>>>
>>>>>>>> The factories are loaded with emf.ecore plugin with all other
>>>>>>>> facotries (factory_override for example)
>>>>>>>>
>>>>>>>> I started to test and it seems it works with dynamic instance
>>>>>>>> and generated EMF code. Maybe i don't see limitations to my
>>>>>>>> solutions particularly i don't know if it is always possible to
>>>>>>>> resolve EAnnotations
>>>>>>>>
>>>>>>>> what do you think about ?
>>>>>>>>
>>>>>>>
>>>>>>> -----8<-----
>




Re: Model Integrity in EMF with MDT OCL [message #427094 is a reply to message #427057] Mon, 02 February 2009 03:37 Go to previous messageGo to next message
Andrew H is currently offline Andrew HFriend
Messages: 117
Registered: July 2009
Senior Member
To be honest I'm not familiar with how things work behind the scenes here
with factories and extension points. From a users point of view though I
would say the less I would need to do the better.

Could you get away with simply something like the following?

EAnnotation : <some uri for ocl>
constraint1 -> books.authors.age > 20
constraint2 -> books.authors.name <> "fred"
etc.

i.e. can we put many constraints in one annotation and can we avoid
needing to list them (like in constraints -> constraint1 constraint2)?

I guess the problem with that though is it limits other data that may need
to be attached to the constraint. e.g. severity etc.

In that case you might be better then to go for something like:

EAnnotation : <some uri for ocl>
name -> authorsAge
constraint -> books.authors.age > 20
severity -> ERROR
message -> author's must be at least 20 years old

Note these fields should align with the validation frameworks fields.

This is more powerful and useful in the long run and if tool support is
added to Ecore Diagrams for this then it won't matter to users that it is
long winded.

my 2c worth

cheers

Andrew

Tristan FAURE wrote:

> Hi

> i would ask for (maybe) modifying the design
> Currently :
> for each ECLass
> Eclass A
> EAnnotation : Ecore
> constraints -> constraint1 constraint2
> factory -> factoryID
> EAnnotation : factoryID
> constraint1 -> String interpreted by constraint delegator
> EAnnotation : factoryID
> constraint2 -> String interpreted by constraint delegator
> Eclass B
> EAnnotation : Ecore
> constraints -> constraint1 constraint2
> factory -> factoryID
> EAnnotation : factoryID
> constraint1 -> String interpreted by constraint delegator
> EAnnotation : factoryID
> constraint2 -> String interpreted by constraint delegator

> Do you think filling factory for each ECLass is irritating ? maybe we
> should consider an EAnnotation in EPackage defining Factory example :

> EPackage
> Eannotation : Ecore
> factory -> factoryID#Key
> Eclass A
> EAnnotation : Ecore
> constraints -> constraint1 constraint2
> EAnnotation : Key
> constraint1 -> String interpreted by constraint delegator
> EAnnotation : Key
> constraint2 -> String interpreted by constraint delegator
> Eclass B
> EAnnotation : Ecore
> constraints -> constraint1 constraint2
> EAnnotation : Key
> constraint1 -> String interpreted by constraint delegator
> EAnnotation : Key
> constraint2 -> String interpreted by constraint delegator

> In this example I used the notation with the Key but we keep the factory id

> what is your opinion ?


> Andrew H a écrit :
>> FWIW I for one would be quite interested in this or similar
>> functionality built into EMF. I tend to add a fair bit of OCL in comment
>> boxes to Ecore Diagrams, but this of course then is only doco and I'd
>> have to duplicate this when we get to the phase of the project where we
>> will do OCL for real.
>>
>> Ideally Ecore Diagrams would add explicit support for OCL constraints
>> and derived features expressed as OCL.
>>
>> Tristan FAURE wrote:
>>
>>> I've added an OCL implementation. It is easier to check the functionality
>>
>>> Tristan FAURE a écrit :
>>>> Thank's christian
>>>> i just was a little bit worry about missing some steps in the Eclipse
>>>> process
>>>>
>>>> Christian W. Damus a écrit :
>>>>> Hi, Tristan,
>>>>>
>>>>> Sorry, I've been rather busy and lost track of this ... I'll try to
>>>>> make time for a closer review of your patch, especially with an eye
>>>>> to how it would be implemented in OCL.
>>>>>
>>>>> cW
>>>>>
>>>>> Tristan FAURE wrote:
>>>>>> no feedbacks :( ?
>>>>>> does somebody checked ? do i need to provide an implementation ?
>>>>>>
>>>>>> Tristan FAURE a écrit :
>>>>>>> Hi
>>>>>>>
>>>>>>> bug created : https://bugs.eclipse.org/bugs/show_bug.cgi?id=255786
>>>>>>>
>>>>>>> for EAnnotations yes i would like to know if there is some
>>>>>>> limitations I'm quite sure that I don't realize EMF complexity and
>>>>>>> it's difficult to say "hey the feature works in all case" :)
>>>>>>> Particularly when we see the huge work made by Ed for delegate
>>>>>>> features
>>>>>>>
>>>>>>> Christian W. Damus a écrit :
>>>>>>>> Hi, Tristan,
>>>>>>>>
>>>>>>>> This looks like a clean design, a good approach. This sounds
>>>>>>>> like it would make a good contribution to complement the
>>>>>>>> enhancements I referenced, earlier.
>>>>>>>>
>>>>>>>> What do you mean by your worry about always being able to resolve
>>>>>>>> annotations? Annotations cannot be cross-resource-contained, so
>>>>>>>> they can be expected never to be proxies. Also, AFAIK, only the
>>>>>>>> GenModel annotations can be suppressed from the generated package
>>>>>>>> metadata (because they are only needed by the generator, not the
>>>>>>>> run-time). Or, do you mean that the provider of the constraint
>>>>>>>> factory may not be available at run-time, depending on the
>>>>>>>> Eclipse configuration?
>>>>>>>>
>>>>>>>> Cheers,
>>>>>>>>
>>>>>>>> Christian
>>>>>>>>
>>>>>>>> Tristan FAURE wrote:
>>>>>>>>> Hi all
>>>>>>>>>
>>>>>>>>> i didn't wait for your answer but if i go to the wrong direction
>>>>>>>>> i can study other solution.
>>>>>>>>>
>>>>>>>>> I have designed for my solution where models constraints are
>>>>>>>>> checked with validate menu
>>>>>>>>>
>>>>>>>>> the developer :
>>>>>>>>>
>>>>>>>>> - creates a factory designed to create its validator
>>>>>>>>> the validator has to implement a validate method :
>>>>>>>>>
>>>>>>>>> "boolean validate(String value, EObject object, DiagnosticChain
>>>>>>>>> theDiagnostics, Map<Object, Object> context)"
>>>>>>>>>
>>>>>>>>> the parameter value is the string provided by the user it can be
>>>>>>>>> OCL rule, class name, it's just a String and the method knows
>>>>>>>>> how to manage it
>>>>>>>>>
>>>>>>>>> - adds an extension point referencing its factory and the uri
>>>>>>>>> associated to it
>>>>>>>>>
>>>>>>>>> the user :
>>>>>>>>>
>>>>>>>>> - designs its metamodel
>>>>>>>>> - puts its constraints with eannotations and the factory used
>>>>>>>>> (here for example OCL)
>>>>>>>>> - Ecore
>>>>>>>>> + constraints
>>>>>>>>> -> constraint1 constraint2 constraint3
>>>>>>>>> + factory
>>>>>>>>> -> org.eclipse.ocl#OCL
>>>>>>>>> // org.eclipse.ocl : the factory uri
>>>>>>>>> // OCL the key for defining the constraints
>>>>>>>>> - OCL
>>>>>>>>> + constraint1
>>>>>>>>> -> self....
>>>>>>>>>
>>>>>>>>> To implement this i add behaviour to EObjectvalidator which
>>>>>>>>> 1) will check constraints
>>>>>>>>> 2) registers the factory and the key
>>>>>>>>> 3) check if there is key
>>>>>>>>> 4) check if there is constraints defining previously
>>>>>>>>> 5) ask the factory to create a validator and validate the
>>>>>>>>> current object
>>>>>>>>>
>>>>>>>>> The factories are loaded with emf.ecore plugin with all other
>>>>>>>>> facotries (factory_override for example)
>>>>>>>>>
>>>>>>>>> I started to test and it seems it works with dynamic instance
>>>>>>>>> and generated EMF code. Maybe i don't see limitations to my
>>>>>>>>> solutions particularly i don't know if it is always possible to
>>>>>>>>> resolve EAnnotations
>>>>>>>>>
>>>>>>>>> what do you think about ?
>>>>>>>>>
>>>>>>>>
>>>>>>>> -----8<-----
>>
Re: Model Integrity in EMF with MDT OCL [message #427095 is a reply to message #427094] Mon, 02 February 2009 03:39 Go to previous messageGo to next message
Andrew H is currently offline Andrew HFriend
Messages: 117
Registered: July 2009
Senior Member
One more thing. To be useful to me it would need to work standalone.

Andrew H wrote:

> To be honest I'm not familiar with how things work behind the scenes here
> with factories and extension points. From a users point of view though I
> would say the less I would need to do the better.

> Could you get away with simply something like the following?

> EAnnotation : <some uri for ocl>
> constraint1 -> books.authors.age > 20
> constraint2 -> books.authors.name <> "fred"
> etc.

> i.e. can we put many constraints in one annotation and can we avoid
> needing to list them (like in constraints -> constraint1 constraint2)?

> I guess the problem with that though is it limits other data that may need
> to be attached to the constraint. e.g. severity etc.

> In that case you might be better then to go for something like:

> EAnnotation : <some uri for ocl>
> name -> authorsAge
> constraint -> books.authors.age > 20
> severity -> ERROR
> message -> author's must be at least 20 years old

> Note these fields should align with the validation frameworks fields.

> This is more powerful and useful in the long run and if tool support is
> added to Ecore Diagrams for this then it won't matter to users that it is
> long winded.

> my 2c worth

> cheers

> Andrew

> Tristan FAURE wrote:

>> Hi

>> i would ask for (maybe) modifying the design
>> Currently :
>> for each ECLass
>> Eclass A
>> EAnnotation : Ecore
>> constraints -> constraint1 constraint2
>> factory -> factoryID
>> EAnnotation : factoryID
>> constraint1 -> String interpreted by constraint delegator
>> EAnnotation : factoryID
>> constraint2 -> String interpreted by constraint delegator
>> Eclass B
>> EAnnotation : Ecore
>> constraints -> constraint1 constraint2
>> factory -> factoryID
>> EAnnotation : factoryID
>> constraint1 -> String interpreted by constraint delegator
>> EAnnotation : factoryID
>> constraint2 -> String interpreted by constraint delegator

>> Do you think filling factory for each ECLass is irritating ? maybe we
>> should consider an EAnnotation in EPackage defining Factory example :

>> EPackage
>> Eannotation : Ecore
>> factory -> factoryID#Key
>> Eclass A
>> EAnnotation : Ecore
>> constraints -> constraint1 constraint2
>> EAnnotation : Key
>> constraint1 -> String interpreted by constraint delegator
>> EAnnotation : Key
>> constraint2 -> String interpreted by constraint delegator
>> Eclass B
>> EAnnotation : Ecore
>> constraints -> constraint1 constraint2
>> EAnnotation : Key
>> constraint1 -> String interpreted by constraint delegator
>> EAnnotation : Key
>> constraint2 -> String interpreted by constraint delegator

>> In this example I used the notation with the Key but we keep the factory id

>> what is your opinion ?


>> Andrew H a écrit :
>>> FWIW I for one would be quite interested in this or similar
>>> functionality built into EMF. I tend to add a fair bit of OCL in comment
>>> boxes to Ecore Diagrams, but this of course then is only doco and I'd
>>> have to duplicate this when we get to the phase of the project where we
>>> will do OCL for real.
>>>
>>> Ideally Ecore Diagrams would add explicit support for OCL constraints
>>> and derived features expressed as OCL.
>>>
>>> Tristan FAURE wrote:
>>>
>>>> I've added an OCL implementation. It is easier to check the functionality
>>>
>>>> Tristan FAURE a écrit :
>>>>> Thank's christian
>>>>> i just was a little bit worry about missing some steps in the Eclipse
>>>>> process
>>>>>
>>>>> Christian W. Damus a écrit :
>>>>>> Hi, Tristan,
>>>>>>
>>>>>> Sorry, I've been rather busy and lost track of this ... I'll try to
>>>>>> make time for a closer review of your patch, especially with an eye
>>>>>> to how it would be implemented in OCL.
>>>>>>
>>>>>> cW
>>>>>>
>>>>>> Tristan FAURE wrote:
>>>>>>> no feedbacks :( ?
>>>>>>> does somebody checked ? do i need to provide an implementation ?
>>>>>>>
>>>>>>> Tristan FAURE a écrit :
>>>>>>>> Hi
>>>>>>>>
>>>>>>>> bug created : https://bugs.eclipse.org/bugs/show_bug.cgi?id=255786
>>>>>>>>
>>>>>>>> for EAnnotations yes i would like to know if there is some
>>>>>>>> limitations I'm quite sure that I don't realize EMF complexity and
>>>>>>>> it's difficult to say "hey the feature works in all case" :)
>>>>>>>> Particularly when we see the huge work made by Ed for delegate
>>>>>>>> features
>>>>>>>>
>>>>>>>> Christian W. Damus a écrit :
>>>>>>>>> Hi, Tristan,
>>>>>>>>>
>>>>>>>>> This looks like a clean design, a good approach. This sounds
>>>>>>>>> like it would make a good contribution to complement the
>>>>>>>>> enhancements I referenced, earlier.
>>>>>>>>>
>>>>>>>>> What do you mean by your worry about always being able to resolve
>>>>>>>>> annotations? Annotations cannot be cross-resource-contained, so
>>>>>>>>> they can be expected never to be proxies. Also, AFAIK, only the
>>>>>>>>> GenModel annotations can be suppressed from the generated package
>>>>>>>>> metadata (because they are only needed by the generator, not the
>>>>>>>>> run-time). Or, do you mean that the provider of the constraint
>>>>>>>>> factory may not be available at run-time, depending on the
>>>>>>>>> Eclipse configuration?
>>>>>>>>>
>>>>>>>>> Cheers,
>>>>>>>>>
>>>>>>>>> Christian
>>>>>>>>>
>>>>>>>>> Tristan FAURE wrote:
>>>>>>>>>> Hi all
>>>>>>>>>>
>>>>>>>>>> i didn't wait for your answer but if i go to the wrong direction
>>>>>>>>>> i can study other solution.
>>>>>>>>>>
>>>>>>>>>> I have designed for my solution where models constraints are
>>>>>>>>>> checked with validate menu
>>>>>>>>>>
>>>>>>>>>> the developer :
>>>>>>>>>>
>>>>>>>>>> - creates a factory designed to create its validator
>>>>>>>>>> the validator has to implement a validate method :
>>>>>>>>>>
>>>>>>>>>> "boolean validate(String value, EObject object, DiagnosticChain
>>>>>>>>>> theDiagnostics, Map<Object, Object> context)"
>>>>>>>>>>
>>>>>>>>>> the parameter value is the string provided by the user it can be
>>>>>>>>>> OCL rule, class name, it's just a String and the method knows
>>>>>>>>>> how to manage it
>>>>>>>>>>
>>>>>>>>>> - adds an extension point referencing its factory and the uri
>>>>>>>>>> associated to it
>>>>>>>>>>
>>>>>>>>>> the user :
>>>>>>>>>>
>>>>>>>>>> - designs its metamodel
>>>>>>>>>> - puts its constraints with eannotations and the factory used
>>>>>>>>>> (here for example OCL)
>>>>>>>>>> - Ecore
>>>>>>>>>> + constraints
>>>>>>>>>> -> constraint1 constraint2 constraint3
>>>>>>>>>> + factory
>>>>>>>>>> -> org.eclipse.ocl#OCL
>>>>>>>>>> // org.eclipse.ocl : the factory uri
>>>>>>>>>> // OCL the key for defining the constraints
>>>>>>>>>> - OCL
>>>>>>>>>> + constraint1
>>>>>>>>>> -> self....
>>>>>>>>>>
>>>>>>>>>> To implement this i add behaviour to EObjectvalidator which
>>>>>>>>>> 1) will check constraints
>>>>>>>>>> 2) registers the factory and the key
>>>>>>>>>> 3) check if there is key
>>>>>>>>>> 4) check if there is constraints defining previously
>>>>>>>>>> 5) ask the factory to create a validator and validate the
>>>>>>>>>> current object
>>>>>>>>>>
>>>>>>>>>> The factories are loaded with emf.ecore plugin with all other
>>>>>>>>>> facotries (factory_override for example)
>>>>>>>>>>
>>>>>>>>>> I started to test and it seems it works with dynamic instance
>>>>>>>>>> and generated EMF code. Maybe i don't see limitations to my
>>>>>>>>>> solutions particularly i don't know if it is always possible to
>>>>>>>>>> resolve EAnnotations
>>>>>>>>>>
>>>>>>>>>> what do you think about ?
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> -----8<-----
>>>
Re: Model Integrity in EMF with MDT OCL [message #427099 is a reply to message #427095] Mon, 02 February 2009 07:57 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
you opinion doesn't disturb me, we just need to see if this satisfy
everybody. For my design i copy the OCL tutorial presented on the web
with the list of constraints.

I can use your syntax but i think it could be better to keep a root
eannotation static like "Ecore" to not check for each root if it is a
factory

to be conform to your idea we can have

EAnnotation : Ecore
factory -> factoryName
name -> authorsAge
constraint -> books.authors.age > 20
severity -> ERROR
message -> author's must be at least 20 years old

or like i said previously factory declared in Epackage
factory -> keydeclaredInEPackage

Andrew H a écrit :
> One more thing. To be useful to me it would need to work standalone.
>
> Andrew H wrote:
>
>> To be honest I'm not familiar with how things work behind the scenes
>> here with factories and extension points. From a users point of view
>> though I would say the less I would need to do the better.
>
>> Could you get away with simply something like the following?
>
>> EAnnotation : <some uri for ocl>
>> constraint1 -> books.authors.age > 20
>> constraint2 -> books.authors.name <> "fred"
>> etc.
>
>> i.e. can we put many constraints in one annotation and can we avoid
>> needing to list them (like in constraints -> constraint1 constraint2)?
>
>> I guess the problem with that though is it limits other data that may
>> need to be attached to the constraint. e.g. severity etc.
>
>> In that case you might be better then to go for something like:
>
>> EAnnotation : <some uri for ocl>
>> name -> authorsAge
>> constraint -> books.authors.age > 20
>> severity -> ERROR
>> message -> author's must be at least 20 years old
>
>> Note these fields should align with the validation frameworks fields.
>
>> This is more powerful and useful in the long run and if tool support
>> is added to Ecore Diagrams for this then it won't matter to users that
>> it is long winded.
>
>> my 2c worth
>
>> cheers
>
>> Andrew
>
>> Tristan FAURE wrote:
>
>>> Hi
>
>>> i would ask for (maybe) modifying the design
>>> Currently :
>>> for each ECLass
>>> Eclass A
>>> EAnnotation : Ecore
>>> constraints -> constraint1 constraint2
>>> factory -> factoryID
>>> EAnnotation : factoryID
>>> constraint1 -> String interpreted by constraint delegator
>>> EAnnotation : factoryID
>>> constraint2 -> String interpreted by constraint delegator
>>> Eclass B
>>> EAnnotation : Ecore
>>> constraints -> constraint1 constraint2
>>> factory -> factoryID
>>> EAnnotation : factoryID
>>> constraint1 -> String interpreted by constraint delegator
>>> EAnnotation : factoryID
>>> constraint2 -> String interpreted by constraint delegator
>
>>> Do you think filling factory for each ECLass is irritating ? maybe we
>>> should consider an EAnnotation in EPackage defining Factory example :
>
>>> EPackage
>>> Eannotation : Ecore
>>> factory -> factoryID#Key
>>> Eclass A
>>> EAnnotation : Ecore
>>> constraints -> constraint1 constraint2
>>> EAnnotation : Key
>>> constraint1 -> String interpreted by constraint
>>> delegator
>>> EAnnotation : Key
>>> constraint2 -> String interpreted by constraint
>>> delegator
>>> Eclass B
>>> EAnnotation : Ecore
>>> constraints -> constraint1 constraint2
>>> EAnnotation : Key
>>> constraint1 -> String interpreted by
>>> constraint delegator
>>> EAnnotation : Key
>>> constraint2 -> String interpreted by
>>> constraint delegator
>
>>> In this example I used the notation with the Key but we keep the
>>> factory id
>
>>> what is your opinion ?
>
>
>>> Andrew H a écrit :
>>>> FWIW I for one would be quite interested in this or similar
>>>> functionality built into EMF. I tend to add a fair bit of OCL in
>>>> comment boxes to Ecore Diagrams, but this of course then is only
>>>> doco and I'd have to duplicate this when we get to the phase of the
>>>> project where we will do OCL for real.
>>>>
>>>> Ideally Ecore Diagrams would add explicit support for OCL
>>>> constraints and derived features expressed as OCL.
>>>>
>>>> Tristan FAURE wrote:
>>>>
>>>>> I've added an OCL implementation. It is easier to check the
>>>>> functionality
>>>>
>>>>> Tristan FAURE a écrit :
>>>>>> Thank's christian
>>>>>> i just was a little bit worry about missing some steps in the
>>>>>> Eclipse process
>>>>>>
>>>>>> Christian W. Damus a écrit :
>>>>>>> Hi, Tristan,
>>>>>>>
>>>>>>> Sorry, I've been rather busy and lost track of this ... I'll try
>>>>>>> to make time for a closer review of your patch, especially with
>>>>>>> an eye to how it would be implemented in OCL.
>>>>>>>
>>>>>>> cW
>>>>>>>
>>>>>>> Tristan FAURE wrote:
>>>>>>>> no feedbacks :( ?
>>>>>>>> does somebody checked ? do i need to provide an implementation ?
>>>>>>>>
>>>>>>>> Tristan FAURE a écrit :
>>>>>>>>> Hi
>>>>>>>>>
>>>>>>>>> bug created : https://bugs.eclipse.org/bugs/show_bug.cgi?id=255786
>>>>>>>>>
>>>>>>>>> for EAnnotations yes i would like to know if there is some
>>>>>>>>> limitations I'm quite sure that I don't realize EMF complexity
>>>>>>>>> and it's difficult to say "hey the feature works in all case"
>>>>>>>>> :) Particularly when we see the huge work made by Ed for
>>>>>>>>> delegate features
>>>>>>>>>
>>>>>>>>> Christian W. Damus a écrit :
>>>>>>>>>> Hi, Tristan,
>>>>>>>>>>
>>>>>>>>>> This looks like a clean design, a good approach. This sounds
>>>>>>>>>> like it would make a good contribution to complement the
>>>>>>>>>> enhancements I referenced, earlier.
>>>>>>>>>>
>>>>>>>>>> What do you mean by your worry about always being able to
>>>>>>>>>> resolve annotations? Annotations cannot be
>>>>>>>>>> cross-resource-contained, so they can be expected never to be
>>>>>>>>>> proxies. Also, AFAIK, only the GenModel annotations can be
>>>>>>>>>> suppressed from the generated package metadata (because they
>>>>>>>>>> are only needed by the generator, not the run-time). Or, do
>>>>>>>>>> you mean that the provider of the constraint factory may not
>>>>>>>>>> be available at run-time, depending on the Eclipse configuration?
>>>>>>>>>>
>>>>>>>>>> Cheers,
>>>>>>>>>>
>>>>>>>>>> Christian
>>>>>>>>>>
>>>>>>>>>> Tristan FAURE wrote:
>>>>>>>>>>> Hi all
>>>>>>>>>>>
>>>>>>>>>>> i didn't wait for your answer but if i go to the wrong
>>>>>>>>>>> direction i can study other solution.
>>>>>>>>>>>
>>>>>>>>>>> I have designed for my solution where models constraints are
>>>>>>>>>>> checked with validate menu
>>>>>>>>>>>
>>>>>>>>>>> the developer :
>>>>>>>>>>>
>>>>>>>>>>> - creates a factory designed to create its validator
>>>>>>>>>>> the validator has to implement a validate method :
>>>>>>>>>>>
>>>>>>>>>>> "boolean validate(String value, EObject object,
>>>>>>>>>>> DiagnosticChain theDiagnostics, Map<Object, Object> context)"
>>>>>>>>>>>
>>>>>>>>>>> the parameter value is the string provided by the user it can
>>>>>>>>>>> be OCL rule, class name, it's just a String and the method
>>>>>>>>>>> knows how to manage it
>>>>>>>>>>>
>>>>>>>>>>> - adds an extension point referencing its factory and the uri
>>>>>>>>>>> associated to it
>>>>>>>>>>>
>>>>>>>>>>> the user :
>>>>>>>>>>>
>>>>>>>>>>> - designs its metamodel
>>>>>>>>>>> - puts its constraints with eannotations and the factory used
>>>>>>>>>>> (here for example OCL)
>>>>>>>>>>> - Ecore
>>>>>>>>>>> + constraints
>>>>>>>>>>> -> constraint1 constraint2 constraint3
>>>>>>>>>>> + factory
>>>>>>>>>>> -> org.eclipse.ocl#OCL
>>>>>>>>>>> // org.eclipse.ocl : the factory uri
>>>>>>>>>>> // OCL the key for defining the constraints
>>>>>>>>>>> - OCL
>>>>>>>>>>> + constraint1
>>>>>>>>>>> -> self....
>>>>>>>>>>>
>>>>>>>>>>> To implement this i add behaviour to EObjectvalidator which
>>>>>>>>>>> 1) will check constraints
>>>>>>>>>>> 2) registers the factory and the key
>>>>>>>>>>> 3) check if there is key
>>>>>>>>>>> 4) check if there is constraints defining previously
>>>>>>>>>>> 5) ask the factory to create a validator and validate the
>>>>>>>>>>> current object
>>>>>>>>>>>
>>>>>>>>>>> The factories are loaded with emf.ecore plugin with all other
>>>>>>>>>>> facotries (factory_override for example)
>>>>>>>>>>>
>>>>>>>>>>> I started to test and it seems it works with dynamic instance
>>>>>>>>>>> and generated EMF code. Maybe i don't see limitations to my
>>>>>>>>>>> solutions particularly i don't know if it is always possible
>>>>>>>>>>> to resolve EAnnotations
>>>>>>>>>>>
>>>>>>>>>>> what do you think about ?
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> -----8<-----
>>>>
>




Re: Model Integrity in EMF with MDT OCL [message #427659 is a reply to message #427099] Wed, 25 February 2009 14:54 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Tristan FAURE a écrit :
> you opinion doesn't disturb me, we just need to see if this satisfy
> everybody. For my design i copy the OCL tutorial presented on the web
> with the list of constraints.
>
> I can use your syntax but i think it could be better to keep a root
> eannotation static like "Ecore" to not check for each root if it is a
> factory
>
> to be conform to your idea we can have
>
> EAnnotation : Ecore
> factory -> factoryName
> name -> authorsAge
> constraint -> books.authors.age > 20
> severity -> ERROR
> message -> author's must be at least 20 years old
>
> or like i said previously factory declared in Epackage
> factory -> keydeclaredInEPackage
>
> Andrew H a écrit :
>> One more thing. To be useful to me it would need to work standalone.
>>
>> Andrew H wrote:
>>
>>> To be honest I'm not familiar with how things work behind the scenes
>>> here with factories and extension points. From a users point of view
>>> though I would say the less I would need to do the better.
>>
>>> Could you get away with simply something like the following?
>>
>>> EAnnotation : <some uri for ocl>
>>> constraint1 -> books.authors.age > 20
>>> constraint2 -> books.authors.name <> "fred"
>>> etc.
>>
>>> i.e. can we put many constraints in one annotation and can we avoid
>>> needing to list them (like in constraints -> constraint1 constraint2)?
>>
>>> I guess the problem with that though is it limits other data that may
>>> need to be attached to the constraint. e.g. severity etc.
>>
>>> In that case you might be better then to go for something like:
>>
>>> EAnnotation : <some uri for ocl>
>>> name -> authorsAge
>>> constraint -> books.authors.age > 20
>>> severity -> ERROR
>>> message -> author's must be at least 20 years old
>>
>>> Note these fields should align with the validation frameworks fields.
>>
>>> This is more powerful and useful in the long run and if tool support
>>> is added to Ecore Diagrams for this then it won't matter to users
>>> that it is long winded.
>>
>>> my 2c worth
>>
>>> cheers
>>
>>> Andrew
>>
>>> Tristan FAURE wrote:
>>
>>>> Hi
>>
>>>> i would ask for (maybe) modifying the design
>>>> Currently :
>>>> for each ECLass
>>>> Eclass A
>>>> EAnnotation : Ecore
>>>> constraints -> constraint1 constraint2
>>>> factory -> factoryID
>>>> EAnnotation : factoryID
>>>> constraint1 -> String interpreted by constraint
>>>> delegator
>>>> EAnnotation : factoryID
>>>> constraint2 -> String interpreted by constraint
>>>> delegator
>>>> Eclass B
>>>> EAnnotation : Ecore
>>>> constraints -> constraint1 constraint2
>>>> factory -> factoryID
>>>> EAnnotation : factoryID
>>>> constraint1 -> String interpreted by constraint
>>>> delegator
>>>> EAnnotation : factoryID
>>>> constraint2 -> String interpreted by constraint
>>>> delegator
>>
>>>> Do you think filling factory for each ECLass is irritating ? maybe
>>>> we should consider an EAnnotation in EPackage defining Factory
>>>> example :
>>
>>>> EPackage
>>>> Eannotation : Ecore
>>>> factory -> factoryID#Key
>>>> Eclass A
>>>> EAnnotation : Ecore
>>>> constraints -> constraint1 constraint2
>>>> EAnnotation : Key
>>>> constraint1 -> String interpreted by
>>>> constraint delegator
>>>> EAnnotation : Key
>>>> constraint2 -> String interpreted by
>>>> constraint delegator
>>>> Eclass B
>>>> EAnnotation : Ecore
>>>> constraints -> constraint1 constraint2
>>>> EAnnotation : Key
>>>> constraint1 -> String interpreted by
>>>> constraint delegator
>>>> EAnnotation : Key
>>>> constraint2 -> String interpreted by
>>>> constraint delegator
>>
>>>> In this example I used the notation with the Key but we keep the
>>>> factory id
>>
>>>> what is your opinion ?
>>
>>
>>>> Andrew H a écrit :
>>>>> FWIW I for one would be quite interested in this or similar
>>>>> functionality built into EMF. I tend to add a fair bit of OCL in
>>>>> comment boxes to Ecore Diagrams, but this of course then is only
>>>>> doco and I'd have to duplicate this when we get to the phase of the
>>>>> project where we will do OCL for real.
>>>>>
>>>>> Ideally Ecore Diagrams would add explicit support for OCL
>>>>> constraints and derived features expressed as OCL.
>>>>>
>>>>> Tristan FAURE wrote:
>>>>>
>>>>>> I've added an OCL implementation. It is easier to check the
>>>>>> functionality
>>>>>
>>>>>> Tristan FAURE a écrit :
>>>>>>> Thank's christian
>>>>>>> i just was a little bit worry about missing some steps in the
>>>>>>> Eclipse process
>>>>>>>
>>>>>>> Christian W. Damus a écrit :
>>>>>>>> Hi, Tristan,
>>>>>>>>
>>>>>>>> Sorry, I've been rather busy and lost track of this ... I'll try
>>>>>>>> to make time for a closer review of your patch, especially with
>>>>>>>> an eye to how it would be implemented in OCL.
>>>>>>>>
>>>>>>>> cW
>>>>>>>>
>>>>>>>> Tristan FAURE wrote:
>>>>>>>>> no feedbacks :( ?
>>>>>>>>> does somebody checked ? do i need to provide an implementation ?
>>>>>>>>>
>>>>>>>>> Tristan FAURE a écrit :
>>>>>>>>>> Hi
>>>>>>>>>>
>>>>>>>>>> bug created :
>>>>>>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=255786
>>>>>>>>>>
>>>>>>>>>> for EAnnotations yes i would like to know if there is some
>>>>>>>>>> limitations I'm quite sure that I don't realize EMF complexity
>>>>>>>>>> and it's difficult to say "hey the feature works in all case"
>>>>>>>>>> :) Particularly when we see the huge work made by Ed for
>>>>>>>>>> delegate features
>>>>>>>>>>
>>>>>>>>>> Christian W. Damus a écrit :
>>>>>>>>>>> Hi, Tristan,
>>>>>>>>>>>
>>>>>>>>>>> This looks like a clean design, a good approach. This sounds
>>>>>>>>>>> like it would make a good contribution to complement the
>>>>>>>>>>> enhancements I referenced, earlier.
>>>>>>>>>>>
>>>>>>>>>>> What do you mean by your worry about always being able to
>>>>>>>>>>> resolve annotations? Annotations cannot be
>>>>>>>>>>> cross-resource-contained, so they can be expected never to be
>>>>>>>>>>> proxies. Also, AFAIK, only the GenModel annotations can be
>>>>>>>>>>> suppressed from the generated package metadata (because they
>>>>>>>>>>> are only needed by the generator, not the run-time). Or, do
>>>>>>>>>>> you mean that the provider of the constraint factory may not
>>>>>>>>>>> be available at run-time, depending on the Eclipse
>>>>>>>>>>> configuration?
>>>>>>>>>>>
>>>>>>>>>>> Cheers,
>>>>>>>>>>>
>>>>>>>>>>> Christian
>>>>>>>>>>>
>>>>>>>>>>> Tristan FAURE wrote:
>>>>>>>>>>>> Hi all
>>>>>>>>>>>>
>>>>>>>>>>>> i didn't wait for your answer but if i go to the wrong
>>>>>>>>>>>> direction i can study other solution.
>>>>>>>>>>>>
>>>>>>>>>>>> I have designed for my solution where models constraints are
>>>>>>>>>>>> checked with validate menu
>>>>>>>>>>>>
>>>>>>>>>>>> the developer :
>>>>>>>>>>>>
>>>>>>>>>>>> - creates a factory designed to create its validator
>>>>>>>>>>>> the validator has to implement a validate method :
>>>>>>>>>>>>
>>>>>>>>>>>> "boolean validate(String value, EObject object,
>>>>>>>>>>>> DiagnosticChain theDiagnostics, Map<Object, Object> context)"
>>>>>>>>>>>>
>>>>>>>>>>>> the parameter value is the string provided by the user it
>>>>>>>>>>>> can be OCL rule, class name, it's just a String and the
>>>>>>>>>>>> method knows how to manage it
>>>>>>>>>>>>
>>>>>>>>>>>> - adds an extension point referencing its factory and the
>>>>>>>>>>>> uri associated to it
>>>>>>>>>>>>
>>>>>>>>>>>> the user :
>>>>>>>>>>>>
>>>>>>>>>>>> - designs its metamodel
>>>>>>>>>>>> - puts its constraints with eannotations and the factory
>>>>>>>>>>>> used (here for example OCL)
>>>>>>>>>>>> - Ecore
>>>>>>>>>>>> + constraints
>>>>>>>>>>>> -> constraint1 constraint2 constraint3
>>>>>>>>>>>> + factory
>>>>>>>>>>>> -> org.eclipse.ocl#OCL
>>>>>>>>>>>> // org.eclipse.ocl : the factory uri
>>>>>>>>>>>> // OCL the key for defining the constraints
>>>>>>>>>>>> - OCL
>>>>>>>>>>>> + constraint1
>>>>>>>>>>>> -> self....
>>>>>>>>>>>>
>>>>>>>>>>>> To implement this i add behaviour to EObjectvalidator which
>>>>>>>>>>>> 1) will check constraints
>>>>>>>>>>>> 2) registers the factory and the key
>>>>>>>>>>>> 3) check if there is key
>>>>>>>>>>>> 4) check if there is constraints defining previously
>>>>>>>>>>>> 5) ask the factory to create a validator and validate the
>>>>>>>>>>>> current object
>>>>>>>>>>>>
>>>>>>>>>>>> The factories are loaded with emf.ecore plugin with all
>>>>>>>>>>>> other facotries (factory_override for example)
>>>>>>>>>>>>
>>>>>>>>>>>> I started to test and it seems it works with dynamic
>>>>>>>>>>>> instance and generated EMF code. Maybe i don't see
>>>>>>>>>>>> limitations to my solutions particularly i don't know if it
>>>>>>>>>>>> is always possible to resolve EAnnotations
>>>>>>>>>>>>
>>>>>>>>>>>> what do you think about ?
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> -----8<-----
>>>>>
>>




Re: Model Integrity in EMF with MDT OCL [message #427660 is a reply to message #427659] Wed, 25 February 2009 14:55 Go to previous message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Sorry for triple post

i've taken in consideration feedbacks and modify in consequence please
consult bug for more information

https://bugs.eclipse.org/bugs/show_bug.cgi?id=255786

Tristan FAURE a écrit :
> Tristan FAURE a écrit :
>> you opinion doesn't disturb me, we just need to see if this satisfy
>> everybody. For my design i copy the OCL tutorial presented on the web
>> with the list of constraints.
>>
>> I can use your syntax but i think it could be better to keep a root
>> eannotation static like "Ecore" to not check for each root if it is a
>> factory
>>
>> to be conform to your idea we can have
>>
>> EAnnotation : Ecore
>> factory -> factoryName
>> name -> authorsAge
>> constraint -> books.authors.age > 20
>> severity -> ERROR
>> message -> author's must be at least 20 years old
>>
>> or like i said previously factory declared in Epackage
>> factory -> keydeclaredInEPackage
>>
>> Andrew H a écrit :
>>> One more thing. To be useful to me it would need to work standalone.
>>>
>>> Andrew H wrote:
>>>
>>>> To be honest I'm not familiar with how things work behind the scenes
>>>> here with factories and extension points. From a users point of view
>>>> though I would say the less I would need to do the better.
>>>
>>>> Could you get away with simply something like the following?
>>>
>>>> EAnnotation : <some uri for ocl>
>>>> constraint1 -> books.authors.age > 20
>>>> constraint2 -> books.authors.name <> "fred"
>>>> etc.
>>>
>>>> i.e. can we put many constraints in one annotation and can we avoid
>>>> needing to list them (like in constraints -> constraint1 constraint2)?
>>>
>>>> I guess the problem with that though is it limits other data that
>>>> may need to be attached to the constraint. e.g. severity etc.
>>>
>>>> In that case you might be better then to go for something like:
>>>
>>>> EAnnotation : <some uri for ocl>
>>>> name -> authorsAge
>>>> constraint -> books.authors.age > 20
>>>> severity -> ERROR
>>>> message -> author's must be at least 20 years old
>>>
>>>> Note these fields should align with the validation frameworks fields.
>>>
>>>> This is more powerful and useful in the long run and if tool support
>>>> is added to Ecore Diagrams for this then it won't matter to users
>>>> that it is long winded.
>>>
>>>> my 2c worth
>>>
>>>> cheers
>>>
>>>> Andrew
>>>
>>>> Tristan FAURE wrote:
>>>
>>>>> Hi
>>>
>>>>> i would ask for (maybe) modifying the design
>>>>> Currently :
>>>>> for each ECLass
>>>>> Eclass A
>>>>> EAnnotation : Ecore
>>>>> constraints -> constraint1 constraint2
>>>>> factory -> factoryID
>>>>> EAnnotation : factoryID
>>>>> constraint1 -> String interpreted by constraint
>>>>> delegator
>>>>> EAnnotation : factoryID
>>>>> constraint2 -> String interpreted by constraint
>>>>> delegator
>>>>> Eclass B
>>>>> EAnnotation : Ecore
>>>>> constraints -> constraint1 constraint2
>>>>> factory -> factoryID
>>>>> EAnnotation : factoryID
>>>>> constraint1 -> String interpreted by constraint
>>>>> delegator
>>>>> EAnnotation : factoryID
>>>>> constraint2 -> String interpreted by constraint
>>>>> delegator
>>>
>>>>> Do you think filling factory for each ECLass is irritating ? maybe
>>>>> we should consider an EAnnotation in EPackage defining Factory
>>>>> example :
>>>
>>>>> EPackage
>>>>> Eannotation : Ecore
>>>>> factory -> factoryID#Key
>>>>> Eclass A
>>>>> EAnnotation : Ecore
>>>>> constraints -> constraint1 constraint2
>>>>> EAnnotation : Key
>>>>> constraint1 -> String interpreted by
>>>>> constraint delegator
>>>>> EAnnotation : Key
>>>>> constraint2 -> String interpreted by
>>>>> constraint delegator
>>>>> Eclass B
>>>>> EAnnotation : Ecore
>>>>> constraints -> constraint1 constraint2
>>>>> EAnnotation : Key
>>>>> constraint1 -> String interpreted by
>>>>> constraint delegator
>>>>> EAnnotation : Key
>>>>> constraint2 -> String interpreted by
>>>>> constraint delegator
>>>
>>>>> In this example I used the notation with the Key but we keep the
>>>>> factory id
>>>
>>>>> what is your opinion ?
>>>
>>>
>>>>> Andrew H a écrit :
>>>>>> FWIW I for one would be quite interested in this or similar
>>>>>> functionality built into EMF. I tend to add a fair bit of OCL in
>>>>>> comment boxes to Ecore Diagrams, but this of course then is only
>>>>>> doco and I'd have to duplicate this when we get to the phase of
>>>>>> the project where we will do OCL for real.
>>>>>>
>>>>>> Ideally Ecore Diagrams would add explicit support for OCL
>>>>>> constraints and derived features expressed as OCL.
>>>>>>
>>>>>> Tristan FAURE wrote:
>>>>>>
>>>>>>> I've added an OCL implementation. It is easier to check the
>>>>>>> functionality
>>>>>>
>>>>>>> Tristan FAURE a écrit :
>>>>>>>> Thank's christian
>>>>>>>> i just was a little bit worry about missing some steps in the
>>>>>>>> Eclipse process
>>>>>>>>
>>>>>>>> Christian W. Damus a écrit :
>>>>>>>>> Hi, Tristan,
>>>>>>>>>
>>>>>>>>> Sorry, I've been rather busy and lost track of this ... I'll
>>>>>>>>> try to make time for a closer review of your patch, especially
>>>>>>>>> with an eye to how it would be implemented in OCL.
>>>>>>>>>
>>>>>>>>> cW
>>>>>>>>>
>>>>>>>>> Tristan FAURE wrote:
>>>>>>>>>> no feedbacks :( ?
>>>>>>>>>> does somebody checked ? do i need to provide an implementation ?
>>>>>>>>>>
>>>>>>>>>> Tristan FAURE a écrit :
>>>>>>>>>>> Hi
>>>>>>>>>>>
>>>>>>>>>>> bug created :
>>>>>>>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=255786
>>>>>>>>>>>
>>>>>>>>>>> for EAnnotations yes i would like to know if there is some
>>>>>>>>>>> limitations I'm quite sure that I don't realize EMF
>>>>>>>>>>> complexity and it's difficult to say "hey the feature works
>>>>>>>>>>> in all case" :) Particularly when we see the huge work made
>>>>>>>>>>> by Ed for delegate features
>>>>>>>>>>>
>>>>>>>>>>> Christian W. Damus a écrit :
>>>>>>>>>>>> Hi, Tristan,
>>>>>>>>>>>>
>>>>>>>>>>>> This looks like a clean design, a good approach. This
>>>>>>>>>>>> sounds like it would make a good contribution to complement
>>>>>>>>>>>> the enhancements I referenced, earlier.
>>>>>>>>>>>>
>>>>>>>>>>>> What do you mean by your worry about always being able to
>>>>>>>>>>>> resolve annotations? Annotations cannot be
>>>>>>>>>>>> cross-resource-contained, so they can be expected never to
>>>>>>>>>>>> be proxies. Also, AFAIK, only the GenModel annotations can
>>>>>>>>>>>> be suppressed from the generated package metadata (because
>>>>>>>>>>>> they are only needed by the generator, not the run-time).
>>>>>>>>>>>> Or, do you mean that the provider of the constraint factory
>>>>>>>>>>>> may not be available at run-time, depending on the Eclipse
>>>>>>>>>>>> configuration?
>>>>>>>>>>>>
>>>>>>>>>>>> Cheers,
>>>>>>>>>>>>
>>>>>>>>>>>> Christian
>>>>>>>>>>>>
>>>>>>>>>>>> Tristan FAURE wrote:
>>>>>>>>>>>>> Hi all
>>>>>>>>>>>>>
>>>>>>>>>>>>> i didn't wait for your answer but if i go to the wrong
>>>>>>>>>>>>> direction i can study other solution.
>>>>>>>>>>>>>
>>>>>>>>>>>>> I have designed for my solution where models constraints
>>>>>>>>>>>>> are checked with validate menu
>>>>>>>>>>>>>
>>>>>>>>>>>>> the developer :
>>>>>>>>>>>>>
>>>>>>>>>>>>> - creates a factory designed to create its validator
>>>>>>>>>>>>> the validator has to implement a validate method :
>>>>>>>>>>>>>
>>>>>>>>>>>>> "boolean validate(String value, EObject object,
>>>>>>>>>>>>> DiagnosticChain theDiagnostics, Map<Object, Object> context)"
>>>>>>>>>>>>>
>>>>>>>>>>>>> the parameter value is the string provided by the user it
>>>>>>>>>>>>> can be OCL rule, class name, it's just a String and the
>>>>>>>>>>>>> method knows how to manage it
>>>>>>>>>>>>>
>>>>>>>>>>>>> - adds an extension point referencing its factory and the
>>>>>>>>>>>>> uri associated to it
>>>>>>>>>>>>>
>>>>>>>>>>>>> the user :
>>>>>>>>>>>>>
>>>>>>>>>>>>> - designs its metamodel
>>>>>>>>>>>>> - puts its constraints with eannotations and the factory
>>>>>>>>>>>>> used (here for example OCL)
>>>>>>>>>>>>> - Ecore
>>>>>>>>>>>>> + constraints
>>>>>>>>>>>>> -> constraint1 constraint2 constraint3
>>>>>>>>>>>>> + factory
>>>>>>>>>>>>> -> org.eclipse.ocl#OCL
>>>>>>>>>>>>> // org.eclipse.ocl : the factory uri
>>>>>>>>>>>>> // OCL the key for defining the constraints
>>>>>>>>>>>>> - OCL
>>>>>>>>>>>>> + constraint1
>>>>>>>>>>>>> -> self....
>>>>>>>>>>>>>
>>>>>>>>>>>>> To implement this i add behaviour to EObjectvalidator which
>>>>>>>>>>>>> 1) will check constraints
>>>>>>>>>>>>> 2) registers the factory and the key
>>>>>>>>>>>>> 3) check if there is key
>>>>>>>>>>>>> 4) check if there is constraints defining previously
>>>>>>>>>>>>> 5) ask the factory to create a validator and validate the
>>>>>>>>>>>>> current object
>>>>>>>>>>>>>
>>>>>>>>>>>>> The factories are loaded with emf.ecore plugin with all
>>>>>>>>>>>>> other facotries (factory_override for example)
>>>>>>>>>>>>>
>>>>>>>>>>>>> I started to test and it seems it works with dynamic
>>>>>>>>>>>>> instance and generated EMF code. Maybe i don't see
>>>>>>>>>>>>> limitations to my solutions particularly i don't know if it
>>>>>>>>>>>>> is always possible to resolve EAnnotations
>>>>>>>>>>>>>
>>>>>>>>>>>>> what do you think about ?
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> -----8<-----
>>>>>>
>>>




Previous Topic:[CDO] ERROR: Could not find feature CDOFeature ...
Next Topic:Re: teneo downloads
Goto Forum:
  


Current Time: Thu Apr 25 08:34:10 GMT 2024

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

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

Back to the top