[Eugenia] Validation Problem [message #758303] |
Tue, 22 November 2011 11:32  |
Eclipse User |
|
|
|
Hello,
i got a new problem with Eugenia.
Here is my .emf code.
@namespace(uri="argumentmodel", prefix="argumentmodel")
@gmf(foo="bar")
package argumentmodel;
@gmf.diagram(onefile="false")
class ArgumentModel {
val Claim[*] claims;
val Assumption[*] assumptions;
}
@gmf.node(label="name")
class Claim {
attr String name;
attr String description;
@gmf.link(incoming="true")
val ArgumentStrategy[*] ConnectArg;
}
@gmf.node(label="name",phantom="true")
class ArgumentStrategy {
attr String description;
attr String name;
@gmf.link(incoming="true")
ref Assumption [*] assumptions;
}
@gmf.node(label="name")
class Assumption {
attr String description;
attr String name;
}
Really simple for now.
What i want to do now is adding a constraint.
I want to achieve that there can be no Assumption in the model, that is not referenced by any ArgumentStrategy.
But how i start doing that ?
Because the attributes are only set in ArgumentStrategy Nodes.
What i want to see is an error at every Assumption that is not connected to any ArgumentStrategy.
So i started with this:
context Assumption {
constraint AssumptionConnected {
check : ???
}
}
I already finished the plugin and can model simple constraints like mentioned in the tutorial.
But now its getting a bit more complex.
Any suggestions ? Is that possible at all ?
Greetings
Snakebyte
[Updated on: Tue, 22 November 2011 11:41] by Moderator
|
|
|
|
|
|
|
Re: [Eugenia] Validation Problem [message #758329 is a reply to message #758318] |
Tue, 22 November 2011 13:48   |
Eclipse User |
|
|
|
How does this change if i want to check if there are ArgumentStrategies not connected to any Upper Claim (in the .ecore file this is a containing relation)?
I tried it like this:
context ArgumentStrategy {
constraint isConnectedUpper {
check : Claim.all.exists(as|as.ConnectArg.contains(self))
message : 'ArgumentStrategy ' + self.name + ' has no parent'
}
}
That doesn't work.
Normally i want the validation to check all inconsistent relation from the .ecore file.
So in that example, if i validate the model with a modeled ArgumentStrategy that is not in a total relation with any Claim (modeled in .emf with containing relation), that should appear in the problems window.
But it only appears when i validate the emf file!
Is there any chance to achieve this, or did i have to rewrite everything in EVL ?
I really wondering about that because when i change the model above like that :
@gmf.node(label="name",phantom="true")
class ArgumentStrategy {
attr String description;
attr String name;
@gmf.link(incoming="true")
ref Assumption [*] assumptions;
@gmf.link(incoming="true")
val Warrant[1] warrant;
}
@gmf.node(label="name",phantom="true")
class Warrant {
attr String name;
}
And now i don't model the warrant.I can see the error in the validation-plugin.
Now my question : Why i can see this in some cases and in some cases not ?
When i mark the node in the textual emf view and validate it, i dont get the errors.
Only when i mark the node in the textual view itself and validate it, i got the right errors.
Is that a problem of EMF ?
In the graphical view, i dont get the errors at all.
Can i change that in any way ?
[Updated on: Tue, 22 November 2011 14:40] by Moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05502 seconds