Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Load Resources
Load Resources [message #1858276] Sun, 26 March 2023 16:40 Go to next message
John Henbergs is currently offline John HenbergsFriend
Messages: 239
Registered: October 2020
Senior Member
Hi,

1. I have defined an Xtext grammar "University" and I have generated an Ecore metamodel. The metamodel has a class named "Building" with a non containment reference "source" and Type "EPackage".
2. I launch a new runtime instance and inside a Java project named "ModelProject" I create a model instance "UniversityInstance" where I want to load a resource because I want to be able to add it as a value for the reference "source". The resource is located inside a jar file in the "Downloads" folder.
3. What I did was to create a new Java project named "Resource" in the eclipse workspace, unzip the jar file and add it in the java project. Then, I opened the runtime instance, and I right click on the "ModelProject" -> Configure Build Path -> Libraries -> Classpath -> Add External Class Folder and I choose the "Resource" folder in the workspace.

However, when I open the "UniversityInstance" textual editor and I try to reference the resource, it says it cannot resolve it. Am I doing something wrong? What would be the steps to properly be able to load the resource?

For clarification:
The structure of the "Resource" folder is as follows:
Resource
-src
-JRE System Library
-META INF
-org.eclipse.uml2.uml .... (contains)
--META INF
--org
--schema
--model (contains)
---UML.ecore (the resource I want to load).

Thank you for any help.
Re: Load Resources [message #1858277 is a reply to message #1858276] Sun, 26 March 2023 17:03 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Xtext and UML are not normally used together.

The most obvious joint use would be to create a UML model then use UML2Ecore to create an Ecore file against which an Xext grammar could be parsed.

Of course you could use Xtext and UML in other ways too....

You initial 3 points have nothing to do with UML, so perhaps the later mention is a red herring.

So you will have to be much clearer about what you are trying to do and to provide a repro so that we don't have to guess at your simplifications such as no file extensions or registrations.
Re: Load Resources [message #1858278 is a reply to message #1858277] Sun, 26 March 2023 17:38 Go to previous messageGo to next message
John Henbergs is currently offline John HenbergsFriend
Messages: 239
Registered: October 2020
Senior Member
Hi Ed,

Thank you for your answer. Unfortunately, I cannot provide a repro as the files are confidential, but it is in fact not related to UML, because I am using the Ecore metamodel that represent UML. So I would consider it a metamodel same as others. I was wondering if it was related to the structure of the folder where UML.ecore is located or the steps I have taken to load the resource.
Re: Load Resources [message #1858279 is a reply to message #1858278] Sun, 26 March 2023 17:59 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
i am not sure if i get it.

do you want to refer to a epackage? do you want to refer to an element in an other emf based model?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Load Resources [message #1858281 is a reply to message #1858279] Sun, 26 March 2023 19:32 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
"UniversityInstance" does not sound very confidential to me.

I suggest you do some reaming so that you can show us something that we can try to understand.

Re: Load Resources [message #1858282 is a reply to message #1858279] Sun, 26 March 2023 20:04 Go to previous messageGo to next message
John Henbergs is currently offline John HenbergsFriend
Messages: 239
Registered: October 2020
Senior Member
Yes exactly.
Re: Load Resources [message #1858283 is a reply to message #1858282] Sun, 26 March 2023 20:08 Go to previous messageGo to next message
John Henbergs is currently offline John HenbergsFriend
Messages: 239
Registered: October 2020
Senior Member
You have an EPackage (e.g., uml) in a metamodel (UML.ecore) and UML.ecore is located inside a jar file. This jar file is located in your downloads folder. You also have another metamodel, and when you create model instances conforming to this metamodel in the runtime workspace, you want to reference the EPackage (e.g. uml). How would you do that?
Re: Load Resources [message #1858284 is a reply to message #1858283] Mon, 27 March 2023 05:29 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
For an epackage it should work ootb as Xtext already has a resource service provider for it.
For other ecore it does not.

Thus it is important what you exactly try to do.
Maybe you can give some pseudomodel code of how the
Thing you reference looks like
And how the model looks like


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Load Resources [message #1858293 is a reply to message #1858284] Mon, 27 March 2023 17:13 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
EPackage and UML is a far from trivial usage, since UML has no EPackage, although one may be stereotyped and UML.ecore is an Ecore formulation using EPackage at the metalevel. Further when you define a profile you create nested EPackages within EAnnotations within your UML model. It all gets very messy so without a repro we are left with three or four alternatives as to what you might mean by EPackage.
Previous Topic:Behaviour of terminals
Next Topic:Generating edit/editor project
Goto Forum:
  


Current Time: Fri Mar 29 12:32:03 GMT 2024

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

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

Back to the top