Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Referencing external resources(Grammar syntax for Inline-references for model elements in external resources)
icon5.gif  Referencing external resources [message #871852] Tue, 15 May 2012 02:12 Go to next message
Joern Suess is currently offline Joern SuessFriend
Messages: 83
Registered: July 2009
Location: Germany
Member

Hello!

I have a simple beginners question: I have model instances of language 'A' that I want to decorate with a new language ('B'). The xText grammar consequently imports and resolves metamodel 'A'.

Now I would like to refer (cross-reference) to elements of 'A' within the 'B' instances. This means I need a notation that allows to define the location of the resource. It would allow me to write something like:

ObjectInB dependsOn ObjectInA<file:///C:/temp/aResources/theArequired.aStoreFile>


EMFText accomplishes it in
this way.

Help appreciated, as this is a project blocker...

Thanks, JG
Re: Referencing external resources [message #871906 is a reply to message #871852] Tue, 15 May 2012 05:56 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13488
Registered: July 2009
Senior Member
Hi,

i am not quite sure what your question is targeting
(1) how to i cross referecing
(2) how to i use uri based imports
(3) how to i import absolute file paths that do not reside in the workspace

A good reading source for (1) + (2) are the docs and http://blogs.itemis.de/stundzig/archives/773

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Referencing external resources [message #871923 is a reply to message #871906] Tue, 15 May 2012 06:37 Go to previous messageGo to next message
Joern Suess is currently offline Joern SuessFriend
Messages: 83
Registered: July 2009
Location: Germany
Member

Sorry for not being imprecise/fuzzy in my description of the issue. I understand cross referencing, but my question is really about resource loading, as described in the question below. I am looking for an xText grammar language construct that is equivalent to a 'load the resource into resource set' command, so I can access model elements in a different file. EMFText does this by allowing the user to directly enter the URL of the resource to load. Doex xText do the same?

==== below a more explicit rephrase of my question by W. ====
> Hi,
> Assume that a meta model has been created and a tree based editor has
> been generated (or a dynamic instance is created using the reflective
> editor). In these situations eclipse provides the ability to load
> additional resources which enables referring to their contents from the
> model in the editor.
> How should that best be realized using EMFText? Prefereably, I'd like to
> have the ability to 'load a resource' in a similar fashion. Or is there
> a way to 'include' or 'import' an additional model without polluting the
> meta model and/or textual concrete syntax?
> Greetings,
> Wilbert.
Re: Referencing external resources [message #871928 is a reply to message #871923] Tue, 15 May 2012 06:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13488
Registered: July 2009
Senior Member
Still do not understand why you make a difference between access
model element and loading the resource.


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Referencing external resources [message #871936 is a reply to message #871923] Tue, 15 May 2012 07:20 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3108
Registered: July 2009
Senior Member
Jörn,

Xtext maintains an index of all available model resources thus renders
the need for explicit uri usages unnecessary.

Instead of

resourceA.entity
entity Subject {}

resourceB.entity
entity Person extends Subject<resourceA> {}

you'll just use

somewhere.entity
entity Subject {}

myfile.entity
entity Person extends Subject {}

and the framework will figure out autoamtically where Subject is contained.

Does that answer your question?

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 15.05.12 08:37, schrieb Jörn Guy Süß:
> Sorry for not being imprecise/fuzzy in my description of the issue. I
> understand cross referencing, but my question is really about resource
> loading, as described in the question below. I am looking for an xText
> grammar language construct that is equivalent to a 'load the resource
> into resource set' command, so I can access model elements in a
> different file. EMFText does this by allowing the user to directly enter
> the URL of the resource to load. Doex xText do the same?
>
> ==== below a more explicit rephrase of my question by W. ====
>> Hi,
>> Assume that a meta model has been created and a tree based editor has
>> been generated (or a dynamic instance is created using the reflective
>> editor). In these situations eclipse provides the ability to load
>> additional resources which enables referring to their contents from the
>> model in the editor.
>> How should that best be realized using EMFText? Prefereably, I'd like to
>> have the ability to 'load a resource' in a similar fashion. Or is there
>> a way to 'include' or 'import' an additional model without polluting the
>> meta model and/or textual concrete syntax?
>> Greetings,
>> Wilbert.
Previous Topic:Xtext picking unexpected rules
Next Topic:need to accept backslashes in the language
Goto Forum:
  


Current Time: Tue Jul 07 16:56:55 GMT 2020

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

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

Back to the top