Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » EVL Validation on Diagram with references
EVL Validation on Diagram with references [message #777525] Tue, 10 January 2012 16:25 Go to next message
Snakebyte Missing name is currently offline Snakebyte Missing nameFriend
Messages: 130
Registered: November 2011
Senior Member
Hello,

i got the following problem. I try to use validation like mentioned in the tutorial here :

http://www.eclipse.org/gmt/epsilon/doc/articles/evl-gmf-integration/

And it works well as long as i dont create referecences between two or more files.
I use only one model.

In my UseCase i have special nodes. These nodes can reference external nodes.
So i use the Load Resource Action to load an external resource to my local file and set the references of these nodes.
I do this to achieve a special kind of partitioning.

If i dont use these nodes, or simply dont set there reference everything works well.
But if i set one of these references and validate the diagram, i got the following exception :

!MESSAGE Validation failed
!STACK 0
java.lang.NullPointerException
	at org.eclipse.epsilon.evl.emf.validation.EvlValidator.validate(EvlValidator.java:149)
	at org.eclipse.epsilon.evl.emf.validation.EvlValidator.validate(EvlValidator.java:73)
	at org.eclipse.epsilon.evl.emf.validation.CompositeEValidator.validate(CompositeEValidator.java:44)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:165)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:143)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:114)
	at gsnModel.diagram.part.ValidateAction.runEMFValidator(ValidateAction.java:148)
	at gsnModel.diagram.part.ValidateAction.validate(ValidateAction.java:163)
	at gsnModel.diagram.part.ValidateAction.access$0(ValidateAction.java:156)
	at gsnModel.diagram.part.ValidateAction$2.run(ValidateAction.java:132)
	at gsnModel.diagram.providers.GsnModelValidationProvider$1.run(GsnModelValidationProvider.java:36)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328)
	at gsnModel.diagram.providers.GsnModelValidationProvider.runWithConstraints(GsnModelValidationProvider.java:44)
	at gsnModel.diagram.part.ValidateAction.runValidation(ValidateAction.java:129)
	at gsnModel.diagram.part.ValidateAction$1.run(ValidateAction.java:75)
	at org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation.execute(WorkspaceModifyDelegatingOperation.java:69)
	at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
	at gsnModel.diagram.part.ValidateAction.run(ValidateAction.java:78)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)


I dont really know if this is the same issue like in the post here :

http://www.eclipse.org/forums/index.php/t/246423/

because this uses special kind of module instances doesnt starting with the root element.

My files all start with the root element.

I seems like the validation doesnt work correctly with these external references.
I doesn't work if the validation should work on several files.
This is a feature i dont really need. I only want to check the current file for itself.

Is that possible ?

[Updated on: Thu, 12 January 2012 17:46]

Report message to a moderator

Re: EVL Validation on Diagram with references [message #778340 is a reply to message #777525] Thu, 12 January 2012 13:17 Go to previous messageGo to next message
Snakebyte Missing name is currently offline Snakebyte Missing nameFriend
Messages: 130
Registered: November 2011
Senior Member
So i suggest there is no solution for this ?
Or is my problem not understandable ?
Re: EVL Validation on Diagram with references [message #778390 is a reply to message #778340] Thu, 12 January 2012 17:55 Go to previous messageGo to next message
Snakebyte Missing name is currently offline Snakebyte Missing nameFriend
Messages: 130
Registered: November 2011
Senior Member
OK i just realized i linked the wrong post, then its indeed not so easy to understand my question. I corrected the link in my first post and i will give some more information on what i did.

Here is a part of my metamodel.

@gmf.node(label="identifier", border.width="2", border.color="0,0,0", size="130,50", figure="rectangle", label.icon="false")
class Goal{
  attr String identifier;
  @gmf.link(target.decoration="filledclosedarrow", color="0,0,0")
  ref AwayGoal[*] SupportingAwaySubgoalsOfGoal;
  ref AwayGoal[*]#ReferencedGoal isReferencedByAwayGoals;
}

@gmf.node(label="identifier", border.width="1", border.color="0,0,0", size="130,50", label.icon="false", figure="rectangle")
class AwayGoal {
  ref Goal[1]#isReferencedByAwayGoals ReferencedGoal;
  attr String AwayGoalModuleIdentifier;
}


So i model a bidrectional connection between Goal und AwayGoal.

Now i create 2 Files.
File A contains the AwayGoal.
File B contains the Goal.
Then i open File A, choose the load resource action und load File B.
Then i set the reference ReferencedGoal to my Goal.
So i have a bidirectional reference between 2 files.
Now i created a new plugin, to use some validation on my models as shown in this tutorial.

http://www.eclipse.org/gmt/epsilon/doc/articles/evl-gmf-integration/

This evl file seems to work on single files and is defined with a simple rule like this:

context Goal {
	constraint identifierIsSet {
		check 	: self.identifier.isDefined()
		message : 'Goal identifier is not set.'
	}



And when doing some more investigation, this fails everytime when there is a validation rule error found in File B. When opening File A, load resource B (containing the AwayGoal) and start validation it crashes.

So it seems like the validation crashes, when referenced Files contain errors.
If the external files dont contain any errors the validation finished showing all error in the current file.

Is this a bug ?

How can i fix this?
I dont even need the validation to check my complete resource. I just want to check the current file.
Is this possible ?

[Updated on: Fri, 13 January 2012 02:09]

Report message to a moderator

Re: EVL Validation on Diagram with references [message #778519 is a reply to message #778390] Fri, 13 January 2012 02:21 Go to previous messageGo to next message
Snakebyte Missing name is currently offline Snakebyte Missing nameFriend
Messages: 130
Registered: November 2011
Senior Member
I try debugging a little bit and im now here.

In EvlValidator.class there is a method :

protected ValidationResults validate(Resource resource)


This method uses the following in line 149

for (EvlUnsatisfiedConstraint unsatisfied : module.getContext().getUnsatisfiedConstraints()) {
			results.get(unsatisfied.getInstance()).add(unsatisfied);
		}


The UnsatisfiedConstraints contains all found constraints in all files.

This result map seems to contain only objects from the main file (File A) from which the validation started and so this returns null for any object in external files.

Is there any workaround about this ?
The best solution would be to make sure that the UnsatisfiedConstraints only contains Constraints from the current File. But im not sure on how to do this.

[Updated on: Fri, 13 January 2012 02:22]

Report message to a moderator

Re: EVL Validation on Diagram with references [message #778616 is a reply to message #778519] Fri, 13 January 2012 14:19 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi,

This sounds like a bug. Could you please submit a bug report using the link below and post the new bug link back here?

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=GMT&component=Epsilon

Cheers,
Dimitris
Re: EVL Validation on Diagram with references [message #778783 is a reply to message #778616] Fri, 13 January 2012 20:28 Go to previous messageGo to next message
Snakebyte Missing name is currently offline Snakebyte Missing nameFriend
Messages: 130
Registered: November 2011
Senior Member
I made a bug report explaining the situation as good as possible.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=368586

Would be really glad about a fix. Or about any suggestions for a quick fix.
Re: EVL Validation on Diagram with references [message #803663 is a reply to message #778783] Tue, 21 February 2012 16:42 Go to previous messageGo to next message
Snakebyte Missing name is currently offline Snakebyte Missing nameFriend
Messages: 130
Registered: November 2011
Senior Member
Ok i currently tried a workaround for the problem.

Simply add a null check at validate method in EvlValidator.java.

Here is the code for it :

TreeIterator<EObject> allContents = resource.getAllContents();
		
		while (allContents.hasNext()) {
			EObject eObject =  allContents.next();
			ArrayList<EvlUnsatisfiedConstraint> unsatisfied = new ArrayList<EvlUnsatisfiedConstraint>();
			results.put(eObject, unsatisfied);
		}
			
		for (EvlUnsatisfiedConstraint unsatisfied : module.getContext().getUnsatisfiedConstraints()) {
			if(results.get(unsatisfied.getInstance()) != null)
			results.get(unsatisfied.getInstance()).add(unsatisfied);
		}


@EpsilonDevelopers : This Workaround just avoid the null pointer exception mentioned here. All other exception are not avoided. While doing this, only the current Resource is checked. Maybe it would be great to add support for checking multiple ResourceSets together.

Greetings
Re: EVL Validation on Diagram with references [message #803805 is a reply to message #803663] Tue, 21 February 2012 20:56 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

As you said, I'd rather have this working normally than adding a workaround. I'll have a look at this during this week and let you know how it goes Smile.
Re: EVL Validation on Diagram with references [message #803939 is a reply to message #803805] Wed, 22 February 2012 01:55 Go to previous messageGo to next message
Snakebyte Missing name is currently offline Snakebyte Missing nameFriend
Messages: 130
Registered: November 2011
Senior Member
GREAT !
I would be really happy if you can give me any information about your progress as fast as possible, because i like working things, like you. Wink
Re: EVL Validation on Diagram with references [message #805470 is a reply to message #803939] Thu, 23 February 2012 20:17 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

I've just committed a fix to SVN for this. If you work straight from SVN, you just need to update your working copy. Otherwise, you'll have to wait for the next interim release.
Re: EVL Validation on Diagram with references [message #806810 is a reply to message #805470] Sat, 25 February 2012 14:27 Go to previous message
Snakebyte Missing name is currently offline Snakebyte Missing nameFriend
Messages: 130
Registered: November 2011
Senior Member
I will test it.
THANKS !
Previous Topic:About ETL rules
Next Topic:Using EVL in rekursive context
Goto Forum:
  


Current Time: Sat Apr 20 01:44:52 GMT 2024

Powered by FUDForum. Page generated in 0.04255 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top