Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [EVL] Epsilon validation for multiple diagrams on a single model?!(validate diagram that does not correspond to the root of a model)
[EVL] Epsilon validation for multiple diagrams on a single model?! [message #736829] Fri, 14 October 2011 11:17 Go to next message
Hristina Moneva is currently offline Hristina MonevaFriend
Messages: 31
Registered: October 2009
Member
Hi all,

I am trying to use Epsilon Validation on my GMF diagrams, but I run into a problem...

The situation is as follows: I have a single model and two diagrams (using shared editing domain). One of the diagrams corresponds to the root of my model and represents only a few elements. From there a sub-diagram ca be initiated that visualizes but part of the full model. When I add the validation, it works fine on the main diagram (no exceptions raised, but I do not have any validation there as well) but it always raises exception on the sub-diagram... The exception is:
!ENTRY nl.esi.design.diagram.view 4 0 2011-10-14 13:10:56.384
!MESSAGE Validation failed
!STACK 0
java.lang.NullPointerException
	at org.eclipse.epsilon.evl.emf.validation.EvlValidator.validate(EvlValidator.java:76)
	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 nl.esi.design.diagram.view.part.ValidateAction.runEMFValidator(ValidateAction.java:159)
	at nl.esi.design.diagram.view.part.ValidateAction.validate(ValidateAction.java:173)
	at nl.esi.design.diagram.view.part.ValidateAction.access$0(ValidateAction.java:167)
	at nl.esi.design.diagram.view.part.ValidateAction$2.run(ValidateAction.java:144)
	at nl.esi.design.diagram.view.providers.DesignValidationProvider$1.run(DesignValidationProvider.java:62)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328)
	at nl.esi.design.diagram.view.providers.DesignValidationProvider.runWithConstraints(DesignValidationProvider.java:70)
	at nl.esi.design.diagram.view.part.ValidateAction.runValidation(ValidateAction.java:141)
	at nl.esi.design.diagram.view.part.ValidateAction$1.run(ValidateAction.java:89)
	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:1975)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
	at nl.esi.design.diagram.view.part.ValidateAction.run(ValidateAction.java:92)
	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:4066)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	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:369)
	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:620)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1384)


When I was debugging and looking at the code, the only thing that I can find "wrong" is that the Epsilon Validation assumes that it takes diagram that corresponds to the root of the model, see EvlValidator class, validate(EClass eClass, EObject eObject, DiagnosticChain diagnostics, Map<Object, Object> context) method, lines 69-74:
		// If it is the root that is validated
		// validate the whole resource and cache
		// the results
		if (eObject.eContainer() == null) {
			results = validate(eObject.eResource());
		}


The exception raised is just the next line:
		Collection<EvlUnsatisfiedConstraint> unsatisfiedConstraints = results.get(eObject);

The problem is that "results" is null.

That assumption (check) would never be correct for diagrams that do not start from the root of a model as well! Even if not multiple diagrams for a single model...

I am not sure if my understanding is correct! But if yes, do you plan to remove this check and enable validating "partial" models?!

That can be also beneficial for cases where not the full model has to be validated. I believe that is very reasonable and required use case...

Looking forward you reply!

Greetings,
Hristina
Re: [EVL] Epsilon validation for multiple diagrams on a single model?! [message #736914 is a reply to message #736829] Fri, 14 October 2011 13:11 Go to previous messageGo to next message
Hristina Moneva is currently offline Hristina MonevaFriend
Messages: 31
Registered: October 2009
Member
Small update...

I found temporal solution for now, but now the Quick Fixes do not work...

Clarification: I call the solution temporal, because it is not really good solution and this issue really have to be tackled in Epsilon Validation itself.

The solution is as follows:
I your diagram project, something.diagram.view.part package, ValidateAction class, runEMFValidator(View target) method --> replace the "target.getElement()" with your model root element. See example below.
	 /**
	 * @generated NOT
	 */
	private static Diagnostic runEMFValidator(View target) {
		if (target.isSetElement() && target.getElement() != null) {
			return new Diagnostician() {

				public String getObjectLabel(EObject eObject) {
					return EMFCoreUtil.getQualifiedName(eObject, true);
				}
			//}.validate(target.getElement());
			}.validate( ...<your model root element here!>... );
		}
		return Diagnostic.OK_INSTANCE;
	}


In this way, the exception from the post above is avoided, because we feed Epsilon Validation with the expected model root element.

With this solution, all constrains and critiques are found and executed correctly, but... this time the Quick Fixes fail to be found!!!

More details about the Quick Fixes problem... There are three possible situations: 1) when the validation is called from the top-level diagram, 2) when it is called from the sub-diagram which is invoked from the top-level diagram (so it is seen as part of it or with other words it has the type of the top-level diagram), and 3) when it is called from sub-diagram which is separate file (in contrast with case 2, it is seen as its own type).

Now, when we execute the validation in all these situations, the Quick Fixes are found only in case 3, in the first two situations - they are not found at all and the following exception is raised:
java.lang.NullPointerException
	at org.eclipse.epsilon.evl.emf.validation.GmfMarkerResolver.getAbsoluteElementId(GmfMarkerResolver.java:33)
	at org.eclipse.epsilon.evl.emf.validation.EvlMarkerResolverManager.getAbsoluteElementId(EvlMarkerResolverManager.java:51)
	at org.eclipse.epsilon.evl.emf.validation.EvlMarkerResolutionGenerator.getResolutions(EvlMarkerResolutionGenerator.java:51)
	at org.eclipse.epsilon.evl.emf.validation.EvlMarkerResolutionGenerator.getResolutions(EvlMarkerResolutionGenerator.java:43)
	at org.eclipse.ui.internal.ide.registry.MarkerHelpRegistry.getResolutions(MarkerHelpRegistry.java:253)
	at org.eclipse.ui.internal.views.markers.QuickFixHandler$1.run(QuickFixHandler.java:87)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
	at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
	at org.eclipse.ui.internal.progress.ProgressManager$RunnableWithStatus.run(ProgressManager.java:1346)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.progress.ProgressManager$7.run(ProgressManager.java:1184)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:179)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4584)
	at org.eclipse.ui.internal.progress.ProgressManager.runInUI(ProgressManager.java:1182)
	at org.eclipse.ui.internal.progress.WorkbenchSiteProgressService.runInUI(WorkbenchSiteProgressService.java:376)
	at org.eclipse.ui.internal.views.markers.QuickFixHandler.execute(QuickFixHandler.java:124)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
	at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:820)
	at org.eclipse.ui.menus.CommandContributionItem.access$19(CommandContributionItem.java:806)
	at org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(CommandContributionItem.java:796)
	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:4066)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	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:369)
	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:620)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1384)


I am looking for any ideas how to overcome this one!

Greetings,
Hristina
Re: [EVL] Epsilon validation for multiple diagrams on a single model?! [message #737741 is a reply to message #736914] Sat, 15 October 2011 11:33 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 Hristina,

Thanks for reporting this. I'll need to investigate this, so could you please send me a minimal example I can use to reproduce the above at epsilondevs gmail com?

Cheers,
Dimitris
Re: [EVL] Epsilon validation for multiple diagrams on a single model?! [message #740342 is a reply to message #737741] Tue, 18 October 2011 12:06 Go to previous messageGo to next message
Hristina Moneva is currently offline Hristina MonevaFriend
Messages: 31
Registered: October 2009
Member
Hi Dimitris,

I just sent you a long email with example and explanations...

Just to make it clear, your email is "epsilon.devs" at gmail, right?!

Looking forward your reply!!

Greetings,
Hristina
Re: [EVL] Epsilon validation for multiple diagrams on a single model?! [message #740495 is a reply to message #740342] Tue, 18 October 2011 15:13 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 Hristina,

I've received both of your emails and will have a look at this as soon as I can.

Cheers,
Dimitris
Re: [EVL] Epsilon validation for multiple diagrams on a single model?! [message #777022 is a reply to message #740495] Mon, 09 January 2012 17:04 Go to previous messageGo to next message
Snakebyte Missing name is currently offline Snakebyte Missing nameFriend
Messages: 130
Registered: November 2011
Senior Member
hello everybody.

i got the same problem.
Are there any solutions on this right now ?

I dont need QuickFixes really.
And i only want a validation for the current file.


[Updated on: Mon, 09 January 2012 17:26]

Report message to a moderator

Re: [EVL] Epsilon validation for multiple diagrams on a single model?! [message #777481 is a reply to message #777022] Tue, 10 January 2012 15:29 Go to previous messageGo to next message
Snakebyte Missing name is currently offline Snakebyte Missing nameFriend
Messages: 130
Registered: November 2011
Senior Member
Can somebody give me some more information on Hristina Monevas solution.

How i can get my root element to achieve that temporal fix?

Whats the correct code for that ?
Re: [EVL] Epsilon validation for multiple diagrams on a single model?! [message #987894 is a reply to message #777481] Wed, 28 November 2012 15:05 Go to previous messageGo to next message
Joost van Pinxten is currently offline Joost van PinxtenFriend
Messages: 51
Registered: November 2012
Member
This is an interesting topic and I would like to know if there has been any progress on this part.

For example, models in the Design Framework used at ESI can become quite large and only small pieces change when a user is editing models. There are also multiple views, as Hristina described, which each may have a different set of active validation rules.

Is it possible (now or in the future) to provide validation for (small) parts of a model? Validating the whole model is just a very inefficient task; my colleagues indicate that several custom validations can be run 'while-you-type' and this does not impact the performance. For example; Xtext also does not validate the whole model at once, it also breaks it up into smaller pieces.

I realize that the nature of an EOL module (in this case an EVL module) is not very suitable to use for real-time validations, but is it possible to have some other kind of componente that can be used like a normal Eclipse validator?
Re: [EVL] Epsilon validation for multiple diagrams on a single model?! [message #987897 is a reply to message #777481] Wed, 28 November 2012 15:05 Go to previous messageGo to next message
Joost van Pinxten is currently offline Joost van PinxtenFriend
Messages: 51
Registered: November 2012
Member
This is an interesting topic and I would like to know if there has been any progress on this part.

For example, models in the Design Framework used at ESI can become quite large and only small pieces change when a user is editing models. There are also multiple views, as Hristina described, which each may have a different set of active validation rules.

Is it possible (now or in the future) to provide validation for (small) parts of a model? Validating the whole model is just a very inefficient task; my colleagues indicate that several custom validations can be run 'while-you-type' and this does not impact the performance. For example; Xtext also does not validate the whole model at once, it also breaks it up into smaller pieces.

I realize that the nature of an EOL module (in this case an EVL module) is not very suitable to use for real-time validations, but is it possible to have some other kind of componente that can be used like a normal Eclipse validator?
Re: [EVL] Epsilon validation for multiple diagrams on a single model?! [message #988299 is a reply to message #987897] Thu, 29 November 2012 10:21 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 Joost,

EVL does not support incremental model validation so I suspect that the only way to achieve this would be to split your model into several smaller resources and then evaluate the EVL constraints on the resources of interest using custom code.

Cheers,
Dimitris
Re: [EVL] Epsilon validation for multiple diagrams on a single model?! [message #988499 is a reply to message #988299] Fri, 30 November 2012 09:28 Go to previous messageGo to next message
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
Registered: February 2012
Senior Member
Hi Dimitris and others,

Any reason not to support this?
I would like to have support for this as well Very Happy
Because validating a complete model when just a (tiny) thing got changed is a waste of time (especially on large models).

Currently, I cache the validation results (by keeping a modified copy of the EVL EMF validation plugin) by adding adapters to mark objects dirty.
When such a dirty object needs validation I rerun the validation code.
This speeds up validation when multiple objects are changed with one (transactional) command, but it still validates everything when something got changed.

If you like this feature to be integrated into the code base, I can submit a bug report containing a patch?

I took also a peek at the validation code, but I did not see an easy way in for partial validation... I suppose this is the problem why it is not available? (complete code rewrite)

Cheers,
Maarten
Re: [EVL] Epsilon validation for multiple diagrams on a single model?! [message #988508 is a reply to message #988499] Fri, 30 November 2012 10:04 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 Maarten,

To support incremental validation, a constraint language needs to be statically typed so that impact analysis can be performed when something changes in the model and a set of "dirty" objects/constraints that need to be re-validated can be computed. EVL is dynamically-typed by design and as such it doesn't lend itself to static/impact analysis. One of my colleagues is currently working on a relaxed approach for static analysis of Epsilon programs which should eventually make this possible but I don't foresee releasing any publicly-available tools within the next year or so.

Having said this, there has been work on incremental evaluation of OCL constraints (OCL is statically typed); I believe the Eclipse OCL implementation provides some support for this [1]. To explore this direction further I'd suggest googling for "incremental OCL" and also checking out the EMF-IncQuery project http://viatra.inf.mit.bme.hu/incquery.

Cheers,
Dimitris

[1] http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.ocl.doc%2Fhelp%2FImpactAnalyzer.html
Re: [EVL] Epsilon validation for multiple diagrams on a single model?! [message #988509 is a reply to message #988508] Fri, 30 November 2012 10:12 Go to previous messageGo to next message
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
Registered: February 2012
Senior Member
Hello,

Thanks, it looks interesting! I will check this out.

But to keep things more simple: the EMF validation framework provides (live validation) events for modified objects. So partial validation support in Epsilon, that is able to only validate a single object instead of the complete model/resource, is enough for this situation.
This is certainly less complex than using incremental evaluation that is able to tell the differences itself?

Cheers,
Maarten
Re: [EVL] Epsilon validation for multiple diagrams on a single model?! [message #988513 is a reply to message #988509] Fri, 30 November 2012 10:25 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 Maarten,

This would indeed be a partial solution to the problem as often not only modified objects need to be revalidated. For example consider the following scenario

class A {
ref B[*] bs;
}

class B {
attr String name;
}

context A {
constraint X {
check : self.bs.forAll(b|b.name <> "foo")
}
}

If a B is modified, all A's that link to it need to be revalidated - which one can't tell unless one is able to analyse constraint X.

In any case extending EvlModule to support validating only selected objects shouldn't be too much work (start by adding an execute(Collection objects) method and propagate downstream). I've added this to my todo list but any help with this would be also appreciated.

Cheers,
Dimitris
Re: [EVL] Epsilon validation for multiple diagrams on a single model?! [message #1221398 is a reply to message #988513] Tue, 17 December 2013 15:41 Go to previous messageGo to next message
Hammad A is currently offline Hammad AFriend
Messages: 6
Registered: December 2013
Junior Member
Hi All,
Desperately looking for solution to support multiple views to same model.
Please suggest if there is some solution to it?

GMF editor code generated by Eugenia by default doesnt support it.

Thanks,
Hammad
Re: [EVL] Epsilon validation for multiple diagrams on a single model?! [message #1221955 is a reply to message #1221398] Wed, 18 December 2013 20:40 Go to previous message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

Dear Hammad,

I am sorry to say that this topic is quite old. Could we continue the discussion for this on a new topic?

Thanks!
Antonio
Previous Topic:File has changed in disk
Next Topic:[Eugenia] How to set base package ecore name
Goto Forum:
  


Current Time: Tue Apr 23 11:07:19 GMT 2024

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

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

Back to the top