Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [Eugenia] Validation Problem
[Eugenia] Validation Problem [message #758303] Tue, 22 November 2011 11:32 Go to next message
Snakebyte Missing name is currently offline 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 11:41]

Report message to a moderator

Re: [Eugenia] Validation Problem [message #758304 is a reply to message #758303] Tue, 22 November 2011 11:39 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-Dominguez
Messages: 304
Registered: January 2010
Senior Member
You'd need to write your own validation script in EVL and integrate it with your GMF-based editor. Have you checked this article?
Re: [Eugenia] Validation Problem [message #758306 is a reply to message #758304] Tue, 22 November 2011 11:52 Go to previous messageGo to next message
Snakebyte Missing name is currently offline Snakebyte Missing name
Messages: 130
Registered: November 2011
Senior Member
Yes i did, is i already said in the previous post Wink.

What i need is a quick more introduction on how to express this special case.
Or some more Examples.

The Examples and References from the sites and books are really hard to understand.

The problem is there is no real reference in the Assumption...so i have to look at all ArgumentStrategies and see if any references the actual element.
But how can i do that in EVL ?

[Updated on: Tue, 22 November 2011 11:54]

Report message to a moderator

Re: [Eugenia] Validation Problem [message #758309 is a reply to message #758306] Tue, 22 November 2011 12:04 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 795
Registered: July 2009
Senior Member
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 #758318 is a reply to message #758309] Tue, 22 November 2011 12:29 Go to previous messageGo to next message
Snakebyte Missing name is currently offline Snakebyte Missing name
Messages: 130
Registered: November 2011
Senior Member
Thanks Dimitris !

It's working. I think i simply don't understand the syntax of EVL correctly.
I think this example helps me a lot.

About your Question.
I think some more complex examples would be great.
Maybe one more Tutorial for experienced Users about EVL.

Greeting
Snakebyte
Re: [Eugenia] Validation Problem [message #758329 is a reply to message #758318] Tue, 22 November 2011 13:48 Go to previous messageGo to next message
Snakebyte Missing name is currently offline 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 14:40]

Report message to a moderator

Re: [Eugenia] Validation Problem [message #758343 is a reply to message #758329] Tue, 22 November 2011 15:44 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 795
Registered: July 2009
Senior Member
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
Re: [Eugenia] Validation Problem [message #758344 is a reply to message #758343] Tue, 22 November 2011 15:50 Go to previous messageGo to next message
Snakebyte Missing name is currently offline Snakebyte Missing name
Messages: 130
Registered: November 2011
Senior Member
Tried.

But it doesnt work.
The problem is, when i model the node as a phantom node and add it to canvas, afterwards looking at the .argumentmodel file, i can see that this node is not included in the ArgumentModel.

It appears as a sibling of the current model. I think this is why it is not checked at all.

Can i change this ?
Re: [Eugenia] Validation Problem [message #758347 is a reply to message #758344] Tue, 22 November 2011 15:56 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 795
Registered: July 2009
Senior Member
To add it under a Claim you need to draw a ConnectArg between them.

Cheers,
Dimitris
Re: [Eugenia] Validation Problem [message #758357 is a reply to message #758347] Tue, 22 November 2011 16:21 Go to previous messageGo to next message
Snakebyte Missing name is currently offline Snakebyte Missing name
Messages: 130
Registered: November 2011
Senior Member
Yes you are right.

But the problem is the following.
When i dont connect it to a claim, this should be reported as an error.
But the validation simply would not validate it.

Because for the editor the ArgumentStrategy is not even seen as part of the Argumentmodel.
But exactly that case should be shown as an error.

You know what i mean ?
Re: [Eugenia] Validation Problem [message #758364 is a reply to message #758357] Tue, 22 November 2011 16:29 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 795
Registered: July 2009
Senior Member
EVL expects that all elements are placed somewhere under the root element of the model so any elements outside it won't be validated (I think).

Cheers,
Dimitris
Re: [Eugenia] Validation Problem [message #758376 is a reply to message #758364] Tue, 22 November 2011 17:48 Go to previous message
Snakebyte Missing name is currently offline Snakebyte Missing name
Messages: 130
Registered: November 2011
Senior Member
In EMF files you can validate the whole file, not just the root node.
Is there any possibility to do that in the graphical editor too ?

Previous Topic:[Eugenia] Changing Icons / Canvas
Next Topic:[EuGENia | EOL] delete creation tool
Goto Forum:
  


Current Time: Sat Jul 26 09:13:34 EDT 2014

Powered by FUDForum. Page generated in 0.02681 seconds