Constraint problem (one instance constraint) [message #207555] |
Tue, 30 September 2008 16:26 |
Eclipse User |
|
|
|
Originally posted by: balancedblend.gmx.de
Hello,
I just tested the gmf constraints. Link constraints work well, I
successfully prohibited linking to certain nodes.
Now however I want to ensure, that "node x" (inheriting from "node y")
might only be created once, whereas "node y" can exist arbitrary often.
I added a constraint to "node x's" node mapping, but the mechanism seems
not to work at all. Regardless of what I specify in the constraint body
(even "awdwadaw"), the effect is always the same:
When I create a node x, the editor is dirty, but no visible node was
created. If I create a node y now, it appears twice, one of them being a
node x looking like node y.
Validation is enabled. What am I doing wrong? And could you make a
suggestion for a "one instance" constraint?
Thanks in advance!
Regards,
Johannes
|
|
|
|
Re: Constraint problem (one instance constraint) [message #207674 is a reply to message #207619] |
Thu, 02 October 2008 09:51 |
Eclipse User |
|
|
|
Originally posted by: balancedblend.gmx.de
Hello Alex,
thanks for your help. To be honest, I don't really understand yet, how
to correctly formulate ocl constraints for gmf and where to place them.
I searched around a lot, but found nothing helpful.
So far, I added my constraints to the node mapping. This always caused
errors upon creation of the node (editor was dirty, but no visual
representation). The constraint you suggested was the first one that did
not destroy the node creation, but I don't really understand what it does.
I've tried the following to get a singleton contraint for node x:
self.allInstances()->size() < 2
after assuming "self" refers to an object instance I tried
X.allInstances()->size() < 2
I also tried
context X inv:
self.allInstances()->size() < 2
which also didn't work.
I followed the mindmap tutoria's validation part and created an audit
containter, but my constraint was always disabled.
So to sum it up, my questions are:
What is the difference between putting a constraint into an audit
container and adding it directly to the node mapping?
And how can I enforce, that only one instance of node X is created?
Alex Shatalin schrieb:
> Hello Johannes,
>
> looks like you have to add following constraint to Node Y mapping: "not
> oclIsKindOf(X)"
>
> -----------------
> Alex Shatalin
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.02077 seconds