Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Programmtically load genmymodel XMI export file with Epsilon(Looking)
Programmtically load genmymodel XMI export file with Epsilon [message #1858315] Tue, 28 March 2023 19:41 Go to next message
Jeff Garratt is currently offline Jeff GarrattFriend
Messages: 4
Registered: March 2023
Junior Member
I am trying to load an XMI export from genmymodel using Epsilon and specifically with a model constructed from org.eclipse.epsilon.emc.uml.UmlModel(), then calling model.load using the below props:

properties.put(EmfModel.PROPERTY_MODEL_URI, s"${modelURI.toString}")
properties.put(
EmfModel.PROPERTY_METAMODEL_URI,
"http://www.eclipse.org/uml2/5.0.0/UML,http://www.eclipse.org/emf/2002/Ecore"
)

I can successfully construct one but I believe it is not loading without error. I am also trying to get access to and ECore extension I added in genmymodel which I see inside the XMI file as an xmi:Extension extender="http://www.eclipse.org/emf/2002/Ecore" but when I try to access the attr.getEAnnotations() method, I get back nothing though I see it in the xmi file for the attribute.

I would like to get full access to the annotations from genmymodel as this is how I wish to get additional information into the model. Any suggestions are greatly appreciated.
Re: Programmtically load genmymodel XMI export file with Epsilon [message #1858316 is a reply to message #1858315] Tue, 28 March 2023 19:59 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Could you please share a minimal example we can use to reproduce the issue you're encountering?

Thanks,
Dimitris
Re: Programmtically load genmymodel XMI export file with Epsilon [message #1858317 is a reply to message #1858316] Tue, 28 March 2023 20:04 Go to previous messageGo to next message
Jeff Garratt is currently offline Jeff GarrattFriend
Messages: 4
Registered: March 2023
Junior Member
// NOTE: This is Scala code, may need to tweak for Java.

model = new org.eclipse.epsilon.emc.uml.UmlModel()
properties = new StringProperties
properties.put(EmfModel.PROPERTY_MODEL_URI, s"${modelURI.toString}")
properties.put(EmfModel.PROPERTY_METAMODEL_URI, "http://www.eclipse.org/uml2/5.0.0/UML,http://www.eclipse.org/emf/2002/Ecore")
model.load(properties, new DefaultRelativePathResolver())

I can access the model and all Classes using below:
val allClasses = model
.getAllOfType("Class")
.asScala
.map(_.asInstanceOf[org.eclipse.uml2.uml.Class])

It is reading the model, but none of the annotations seem to be accessible.
Re: Programmtically load genmymodel XMI export file with Epsilon [message #1858318 is a reply to message #1858317] Tue, 28 March 2023 20:12 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

If you could share a complete and self-contained minimal example (including a sample model) in Java that would help a lot.

Thanks,
Dimitris
Re: Programmtically load genmymodel XMI export file with Epsilon [message #1858319 is a reply to message #1858318] Tue, 28 March 2023 20:27 Go to previous messageGo to next message
Jeff Garratt is currently offline Jeff GarrattFriend
Messages: 4
Registered: March 2023
Junior Member
I am trying to do it in the sandbox with a minimal exported genmymodel model. I am not sure what I need to place into the metamodel window. I assume I paste the XMI text into the model window? If so, what goes into the metamodel window?

I attached the XMI file as it is the smallest I could create with an EAnnotation.
Re: Programmtically load genmymodel XMI export file with Epsilon [message #1858320 is a reply to message #1858319] Tue, 28 March 2023 21:15 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

I'm not sure that EMF supports xmi:Extension: https://www.eclipse.org/forums/index.php?t=tree&th=124679&goto=381546&#page_top

In the attached example, querying the contents of the root Model element, only returns the package import and the class under it.

Thanks,
Dimitris
Re: Programmtically load genmymodel XMI export file with Epsilon [message #1858546 is a reply to message #1858320] Thu, 06 April 2023 17:29 Go to previous messageGo to next message
Jeff Garratt is currently offline Jeff GarrattFriend
Messages: 4
Registered: March 2023
Junior Member
Thank you for your assistance. I switched to Paypyrus from genmymodel and seems much better now. I am very grateful for all the work done on this tooling.

[Updated on: Thu, 06 April 2023 17:30]

Report message to a moderator

Re: Programmtically load genmymodel XMI export file with Epsilon [message #1858549 is a reply to message #1858546] Thu, 06 April 2023 19:05 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

That's good to hear and please let us know if you run into any further issues.

Thanks,
Dimitris

Previous Topic:Type 'model1!School' not found
Next Topic:Model copy
Goto Forum:
  


Current Time: Thu Apr 18 23:10:14 GMT 2024

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

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

Back to the top