Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Model Validation from Java Code(Unexpected errors when running validations (EVL) from Java Code instead of Ant (build.xml))
Model Validation from Java Code [message #1843465] Sat, 31 July 2021 01:17 Go to next message
Miguel Fernandes is currently offline Miguel FernandesFriend
Messages: 7
Registered: July 2021
Junior Member
Hello!

I was working with the Epsilon languages, doing a Validation (of UML Activity Diagrams) followed by a Generation, which was working perfectly from a build.xml (using the epsilon ant tasks) but when I put it into code it gives me unexpected errors in the Validations, and if I skip validating, in the Generation also throws unexpected errors. I will only tackle the Validation problem for now, to make it more simple.

The code related to the validations in the build.xml file was this:

<target name="validateModel" depends="loadModel">
	<epsilon.evl src="${basedir}/validateActivity.evl" failOnErrors="true" failOnWarnings="false">
	    <model ref="loadedModel"/>
	</epsilon.evl>
	<record name="${basedir}/checkreport.txt" action="stop"/>
</target>
	
	<target name="loadModel">
		<record name="${basedir}/checkreport.txt" action="start"/>
		<epsilon.loadModel name="loadedModel" type="UML">
		    <parameter name="modelFile" value="${basedir}/modelact.uml"/>
		    <parameter name="metamodelFile" value="${basedir}/UML.ecore"/>
		    <parameter name="isMetamodelFileBased" value="true"/>
		</epsilon.loadModel>
    </target> 


This was working perfectly. The way I now do this and that gives me these errors is the following:

String filename = "src/main/activity/modelact.uml";
    		String res = "";
    		
            EvlModule module = new EvlModule();
            UmlModel model = new UmlModel();
            
            model.setModelFile(filename);
            
            model.load();

            module.getContext().getModelRepository().addModel(model);
            File fileEvl = new File("src/main/activity/validateActivity.evl");
            module.parse(fileEvl);
            module.execute();
            Collection<UnsatisfiedConstraint> unsatisfiedList = module.getContext().getUnsatisfiedConstraints();

            for (UnsatisfiedConstraint constraint : unsatisfiedList) {
            	res+=constraint.getMessage()+"\n";
            }
           


This gives me the persistent error: "Called feature 'name' on undefined object", an exception which did not appear when I did this via the build.xml file.

This error basically is saying that, on the code below, "type()" is not defined, but the thing is that a Control Flow source is an Activity Node, and if it is defined, it always has a type, so the error is nonsensical.

context ControlFlow{

constraint HasOnlyBasicNodes{
		guard : self.source.isDefined() and self.target.isDefined()
		check : isValidType(self.source.type().name.toString()) and isValidType(self.target.type().name.toString())
		message : 'Control Flow target and source are reduced to the subset: {Opaque Actions + Initial, Decision, Fork, Join, Merge, and Final activity nodes}'
	}


Can someone help me with this?
Thanks in advance
Bests,

Miguel
Re: Model Validation from Java Code [message #1843486 is a reply to message #1843465] Mon, 02 August 2021 09:26 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Hi Miguel,

Could you please share a minimal example [1] we can use to reproduce this?

Best,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/minimal-examples/
Previous Topic:Adapting IModel to reveal EMF
Next Topic:Load second UML model with ANT
Goto Forum:
  


Current Time: Sat Apr 27 05:25:17 GMT 2024

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

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

Back to the top