Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Validating a weaving model programmatically
Validating a weaving model programmatically [message #1740734] Wed, 17 August 2016 22:02 Go to next message
Leila S is currently offline Leila SFriend
Messages: 36
Registered: January 2015
Member
Hi,
I want to validate a weaving model, which weaves two ecore metamodel. When I use the launch configuration there is no any problem. However, if I use java, the below error will be appeared.
Undefined variable, type or model: 'Source!EClass'


The minimal example is attached. Please run the validation.java file.
In the example:
GeneralTrace.ecore is the weaving metamodel.
TraceSMMtoTMM.model is the weaving model.
SourceMM.ecore is the source metamodel.
TargetMM.ecore is the target metamodel.
WeavingValidation.evl is the code written in evl for validating the weaving model.

The error is because of the sourceEndType constraint:
context GeneralTrace!TraceLinkEnd{

--TraceLinkEnd type must be set
constraint notEmptyLinkEndType{
check: self.type.isDefined
}

-- the type of SourceEnd must be related to one of Source meta-classes
constraint sourceEndType{
guard: self.satisfies('notEmptyLinkEndType') and self.sowner.isDefined()
check:Source!EClass.all.select(c|c.name = self.type.name).size() = 1
message: "The meta-class "+self.type.name+"SourceEnd refers to incorrect element"
}
}


I register three metamodels correctly but I don't know why the error occurs.

Bests,
Leila.
  • Attachment: TestEVL.zip
    (Size: 15.17KB, Downloaded 102 times)

[Updated on: Wed, 17 August 2016 22:03]

Report message to a moderator

Re: Validating a weaving model programmatically [message #1740976 is a reply to message #1740734] Mon, 22 August 2016 04:44 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Leila,

Injecting the following line of code just before the return statement in your "createEmfMetaModel" method should fix this.

emfMetaModel.getResource().getResourceSet().getPackageRegistry().put(EcorePackage.eINSTANCE.getNsURI(), EcorePackage.eINSTANCE);


Cheers,
Dimitris
Re: Validating a weaving model programmatically [message #1740988 is a reply to message #1740976] Mon, 22 August 2016 08:28 Go to previous message
Leila S is currently offline Leila SFriend
Messages: 36
Registered: January 2015
Member
Hi Dimitris,
Thank you so much.

Bests,
Leila.
Previous Topic:How to Copy a Model File?
Next Topic:show validation view programmatically
Goto Forum:
  


Current Time: Fri Mar 29 04:56:35 GMT 2024

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

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

Back to the top