[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.modeling.gmf] Re: GMF mapping Audit Rules
|
- From: "Christian W. Damus" <cdamus@xxxxxxxxxxxxx>
- Date: Wed, 04 Feb 2009 10:06:18 -0500
- Newsgroups: eclipse.modeling.gmf
- Organization: Zeligsoft Inc.
- User-agent: Thunderbird 2.0.0.19 (Macintosh/20081209)
Hi, Achilleas,
I'm glad that it looks like a resolution to your problem is in sight!
My second suggestion would result only in a problem marker on the
particular Root instance that contained conflicting Class1 and Class2
instances. Unfortunately, it would be difficult in that case to
actually present the user with useful error messages: how to indicate
*which* Class1 and Class2 instances are at fault?
My first suggestion is slightly better, because at least it puts a
problem marker on each violating Class1 instance. However, it doesn't
allow a Class1 to have the same attribute value as a Class2 in some
other Root than the one containing the Class1 in question.
Assuming you have a back-reference to the containing Root element in a
Class1, you could do:
context Class1
inv:
self.root.classes2->forAll(value2 <> self.value1)
Lacking the back-reference, you could do this which is actually quite
similar to what you already had:
context Class1
inv:
let root : Root = Root.allInstances()->any(classes1->includes(self)
in
root.classes2->forAll(value2 <> self.value1)
I think this gets you as close as possible, given the current EMF
Validation / GMF Audits implementation.
cW
Achilleas wrote:
Hi Christian,
I did it as follows:
context Class1:
inv:
Root.allInstances()->forAll(e | e.classes2->exists(c | c.value =
self.value))
But i believe both of your ways are better!
I thought that only for the Root class we can use the allInstances()
when the context (domain element target) is set to another class.
Your 2nd example is even more expressive and resolves the problem I
have, where the error is depicted on all instances of the element,e.g.
when i impose the constraint:
context Class:
inv:
Class.allInstances()->forAll( c1, c2 | c1 <> c2 implies c1.id <> c2.id )
This produces an error that appears on all instances. I believe with
your 2nd constraint this is contained only to the two specific instances
that have the same "id"??? Anyway I will try it out to see if that's the
case!
Thanks,
Achilleas