Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Load Hutn file programmatically
Load Hutn file programmatically [message #1839614] Wed, 24 March 2021 15:22 Go to next message
jo ber is currently offline jo berFriend
Messages: 94
Registered: August 2018
Member
Hi

I'm trying to load programmatically an hutn file. However, I'm getting the following error:
Exception in thread "main" Could not parse HUTN: 
Line: 3, Column: 2, Reason: Unrecognised namespace URI: families
	at org.eclipse.epsilon.emc.hutn.HutnModel.load(HutnModel.java:79)
	at org.eclipse.epsilon.emc.hutn.HutnModel.load(HutnModel.java:95)
	at org.eclipse.epsilon.eol.models.Model.load(Model.java:92)
	at home.experiments.epsilon.Transformation.<init>(Transformation.java:22)
	at home.experiments.epsilon.Transformation.main(Transformation.java:11)
Caused by: Could not parse HUTN: 
Line: 3, Column: 2, Reason: Unrecognised namespace URI: families
	... 5 more
Caused by: org.eclipse.epsilon.hutn.exceptions.HutnGenerationException: Could not parse HUTN: 
Line: 3, Column: 2, Reason: Unrecognised namespace URI: families
	... 5 more

Even if I can understand the problem, I don't see how I can specify the meta model to use when instantiating "HutnModel". I've attached a minimal example.

Thank you for your help and kind regards,
Re: Load Hutn file programmatically [message #1839625 is a reply to message #1839614] Wed, 24 March 2021 18:27 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 Jo,

Before you can load the HUTN model you will need to parse the metamodel file and put its Families EPackage in the global EMF package registry as shown in https://www.eclipse.org/epsilon/doc/articles/epsilon-emf/#how-do-i-load-an-ecore-metamodel

Best,
Dimitris
Re: Load Hutn file programmatically [message #1839647 is a reply to message #1839625] Thu, 25 March 2021 07:50 Go to previous messageGo to next message
jo ber is currently offline jo berFriend
Messages: 94
Registered: August 2018
Member
Hi Dimitris

Thank you for your answer. Unfortunately, it didn't help (see attachment, just in case I missed something)...

I've tried to investigate to build my own understanding. An 'HutnModel' will automatically trigger the generation of an 'EmfModel'. I noticed that this generator requires a the meta model file which seems to be always null:
https://git.eclipse.org/c/epsilon/org.eclipse.epsilon.git/tree/plugins/org.eclipse.epsilon.hutn.engine/src/org/eclipse/epsilon/hutn/HutnModule.java#n211

Is there a way to set this parameter 'spec.modelFile'?

Kind regards,
Re: Load Hutn file programmatically [message #1839652 is a reply to message #1839647] Thu, 25 March 2021 08: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,

Adding the following statement before ecoreResourceSet.createResource should do the trick.

ecoreResourceSet.getPackageRegistry().put(EcorePackage.eINSTANCE.getNsURI(), EcorePackage.eINSTANCE); 


Best,
Dimitris
Re: Load Hutn file programmatically [message #1839654 is a reply to message #1839652] Thu, 25 March 2021 09:08 Go to previous message
jo ber is currently offline jo berFriend
Messages: 94
Registered: August 2018
Member
this solution fixed my issue. thank you
Previous Topic:Broken link in Epsilon Hutn documentation
Next Topic:Junit eunit example - test with resource models
Goto Forum:
  


Current Time: Fri Apr 26 10:35:11 GMT 2024

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

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

Back to the top