[Eugenia] Validation Problem [message #758303] |
Tue, 22 November 2011 16:32 |
Snakebyte Missing name Messages: 130 Registered: November 2011 |
Senior Member |
|
|
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 16:41] Report message to a moderator
|
|
|
|
|
Re: [Eugenia] Validation Problem [message #758309 is a reply to message #758306] |
Tue, 22 November 2011 17:04 |
|
Hi,
Please try the following:
check : ArgumentStrategy.all.exists(as|as.assumptions.includes(self))
Could I perhaps ask which examples you found hard to understand so that we can do something about it (e.g. explain them in more detail)?
Cheers,
Dimitris
|
|
|
|
Re: [Eugenia] Validation Problem [message #758329 is a reply to message #758318] |
Tue, 22 November 2011 18:48 |
Snakebyte Missing name Messages: 130 Registered: November 2011 |
Senior Member |
|
|
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 19:40] Report message to a moderator
|
|
|
Re: [Eugenia] Validation Problem [message #758343 is a reply to message #758329] |
Tue, 22 November 2011 20:44 |
|
Try check : Claim.all.exists(as|as.ConnectArg.includes(self)) // notice includes vs. contains
Regarding your other question, [1] references get validated automatically by EMF - everything else doesn't so you'll indeed need to validate them with EVL.
Cheers,
Dimitris
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04901 seconds