Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [XText] how import package in an ecore metamodel using platform url?
[XText] how import package in an ecore metamodel using platform url? [message #46415] Fri, 29 May 2009 14:21 Go to next message
Mikai Yang is currently offline Mikai YangFriend
Messages: 149
Registered: July 2009
Senior Member
Hi,
I created an XText project, called ALxDSL, using the XText wizard. My dsl is named 'alx'. The XText grammar file of this dsl is located in the
package src.hw., and in the same directory is my ecore metamodel of this dsl, called alxmm.ecore. In the grammar file, I import this metamodel using
the folling line:

import "platform:/resource/ALxDSL/src/hw/alxmm.ecore"

It is imported succesfully. I would also like to import all sub-packages of this metamodel. For example, the top package of this metamodel is
'alxmm'; the sub-packages are 'declaration','statement', 'expression'.

Would you please give me some hints about importing these subpackages using platform url?


Regards.

Michael.
Re: [XText] how import package in an ecore metamodel using platform url? [message #46509 is a reply to message #46415] Fri, 29 May 2009 20:45 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
You have to import each epackage using its URI.
It depends on the structure of your ecore model how the URIs look like.
If alxmm is the only root package and the other three are direct
subpackages the uris look like so:

import "platform:/resource/ALxDSL/src/hw/alxmm.ecore#/"
import "platform:/resource/ALxDSL/src/hw/alxmm.ecore#//declaration"
import "platform:/resource/ALxDSL/src/hw/alxmm.ecore#//statement"
import "platform:/resource/ALxDSL/src/hw/alxmm.ecore#//expression"

Cheers,
Sven

Michael schrieb:
> Hi,
> I created an XText project, called ALxDSL, using the XText wizard.
> My dsl is named 'alx'. The XText grammar file of this dsl is located in
> the package src.hw., and in the same directory is my ecore metamodel of
> this dsl, called alxmm.ecore. In the grammar file, I import this
> metamodel using the folling line:
>
> import "platform:/resource/ALxDSL/src/hw/alxmm.ecore"
>
> It is imported succesfully. I would also like to import all
> sub-packages of this metamodel. For example, the top package of this
> metamodel is 'alxmm'; the sub-packages are 'declaration','statement',
> 'expression'.
>
> Would you please give me some hints about importing these subpackages
> using platform url?
>
>
> Regards.
>
> Michael.
Re: [XText] how import package in an ecore metamodel using platform url? [message #638532 is a reply to message #46509] Thu, 11 November 2010 15:14 Go to previous message
chuck  is currently offline chuck Friend
Messages: 160
Registered: July 2010
Senior Member
i found this post...and i have the same problem...
in my sample i have a metamodel like this:

platform:/resource/.../MM.ecore
p1
p2
p3

in my xtext grammar i wrote:

import "platform:/resource/.../MM.ecore#/"

import "platform:/resource/.../MM.ecore#//p1"

import "platform:/resource/.../MM.ecore#//p2"

but i receive Couldn't resolve reference to EPackage p1...
Previous Topic:How to get the domain model?
Next Topic:How to obtain the IEObjectDescription from an EObject?
Goto Forum:
  


Current Time: Thu Dec 26 13:15:06 GMT 2024

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

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

Back to the top