Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » importing subpackages of external ecore models
importing subpackages of external ecore models [message #44086] Mon, 18 May 2009 14:28 Go to next message
Oliver is currently offline OliverFriend
Messages: 6
Registered: July 2009
Junior Member
hi all,

i am developing a dsl for (parts of) an existing ecore model with TMF
(0.7.0M7). this ecore model is very very large and has a complex package
structure.

i can import the whole model from the workspace with:
import " platform:/resource/org.my.projectname/model/externalmodel.ec ore "
as ExternalModel

however, when i try to reference a model element from inside the imported
model, i do not know how to "navigate" to the desired element inside the
package structure. for example:

Class :
'attribute'=[ExternalModel::Some::Packages::ExternalClass] ;

lets the editor return a "Cannot resolve reference to ExternalClass" error
message.

so question 1 is: if i import an external model as described above, how
can i make a reference to a class in a subpackage of that external model?

and question 2 is: if i do not want to import the entire external model,
how can i import only one specific subpackage inside it?

thanks in advance for you help!
Re: importing subpackages of external ecore models [message #44121 is a reply to message #44086] Mon, 18 May 2009 15:55 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Oliver,

please find my comments inline.

Am 18.05.2009 16:28 Uhr, schrieb Oliver:
> hi all,
>
> i am developing a dsl for (parts of) an existing ecore model with TMF
> (0.7.0M7). this ecore model is very very large and has a complex package
> structure.
>
> i can import the whole model from the workspace with:
> import " platform:/resource/org.my.projectname/model/externalmodel.ec ore "
> as ExternalModel

That is correct. This will import the root element from your ecore-resource.

>
> however, when i try to reference a model element from inside the
> imported model, i do not know how to "navigate" to the desired element
> inside the package structure. for example:
>
> Class :
> 'attribute'=[ExternalModel::Some::Packages::ExternalClass] ;

I'm afraid that navigating into subpackages is out of Xtext's scope.
The metamodel alias "ExternalModel" can be used to refer to exactly one
EPackage and provide access to all contained EClassifiers.

>
> lets the editor return a "Cannot resolve reference to ExternalClass"
> error message.
>
> so question 1 is: if i import an external model as described above, how
> can i make a reference to a class in a subpackage of that external model?
>
> and question 2 is: if i do not want to import the entire external model,
> how can i import only one specific subpackage inside it?

If you want to refer to elements from subpackages, you'll have to import
them in the same way as the toplevel package. This can either be done by
an URI that includes a fragment to point directly to the subpackage, or
by the ns-URI of the subpackage. I think the latter will only work in
the editor, if the subpackage has been registered in the EPackage
registry through a plugin.xml.

>
> thanks in advance for you help!
>

Hope that helps,
Sebastian
Re: importing subpackages of external ecore models [message #44152 is a reply to message #44121] Mon, 18 May 2009 16:24 Go to previous messageGo to next message
Oliver is currently offline OliverFriend
Messages: 6
Registered: July 2009
Junior Member
hi sebastian,

thanks for your answer. yes, i can now import only the needed subpackage
with:
import
" platform:/resource/org.my.projectname/model/externalmodel.ec ore#//subpackage/subsubpackage "
as ExternalModel

i guess this is the first of your proposed solutions.

another thing:
because of the huge model, the editor gets very slow. after each and every
key stroke the validator seems to validate the grammar. can this feature
be disabled? in my case it would be sufficient to validate "on save"
instead of while typing. this would be a nice feature of TMF.
Re: importing subpackages of external ecore models [message #44183 is a reply to message #44152] Mon, 18 May 2009 17:11 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Oliver,

do you mean the grammar editor gets very slow? Or are you talking about
your specific DSL-Editor?

I assume you mean the latter :-)

If you really mean the editor for the Xtext grammar itself, I would be
glad to have a look into this performance issue. It would be very
helpful, if you can send me your metamodel and your xtext-file to
Sebastian(dot)Zarnekow(at)itemis(dot)de.

However, it is currently not possible to disable the on-keystroke
validator. This may be a serious problem with existing metamodels and
existing EValidators. Would you please be so kind and file a bug?

Regards,
Sebastian


Am 18.05.2009 18:24 Uhr, schrieb Oliver:
> hi sebastian,
>
> thanks for your answer. yes, i can now import only the needed subpackage
> with:
> import
> " platform:/resource/org.my.projectname/model/externalmodel.ec ore#//subpackage/subsubpackage "
> as ExternalModel
>
> i guess this is the first of your proposed solutions.
>
> another thing:
> because of the huge model, the editor gets very slow. after each and
> every key stroke the validator seems to validate the grammar. can this
> feature be disabled? in my case it would be sufficient to validate "on
> save" instead of while typing. this would be a nice feature of TMF.
>
Re: importing subpackages of external ecore models [message #44276 is a reply to message #44152] Mon, 18 May 2009 20:40 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Hi Oliver,

if you really ment your DSL editor is slow, this is because the syntax
colorer shipped in M7 was based on parsing the model.
We've changed and improved that, so that validation is not triggered
while you type but in the reconciler (500 ms after you stopped typing).

With the next release (due tomorrow) this will be solved.
Not that this also effects the grammar editor since it used the same
slow implementation.

Regards,
Sven

Oliver schrieb:
> another thing:
> because of the huge model, the editor gets very slow. after each and
> every key stroke the validator seems to validate the grammar. can this
> feature be disabled? in my case it would be sufficient to validate "on
> save" instead of while typing. this would be a nice feature of TMF.
>
Re: importing subpackages of external ecore models [message #44502 is a reply to message #44276] Tue, 19 May 2009 08:44 Go to previous messageGo to next message
Oliver is currently offline OliverFriend
Messages: 6
Registered: July 2009
Junior Member
Hi Sebastian and Sven,

i am really talking about the grammar editor, not my DSL editor.
when i import the existing meta-model as described in this thread
(complete or just one subpackage) it gets slow on every key-stroke.

unfortunatelly i cannot provide you the meta-model as is, due to the fact
that it is part of an industrial project. just to mention some key data:
the ecore meta-model has about 850 classes, 800 attributes, 1650
references and a file size of about 6.7 Mb.

Bye,
Oliver.
Re: importing subpackages of external ecore models [message #44532 is a reply to message #44502] Tue, 19 May 2009 09:02 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Oliver,

6.7 Mb is quite impressive for a metamodel.
We are about to release a new Xtext build this afternoon. Please try to
use the grammar editor with this release candidate 1. As Sven already
mentioned, we made several changes that affect the editor's performance
significantly.

Regards,
Sebastian

Am 19.05.2009 10:44 Uhr, schrieb Oliver:
> Hi Sebastian and Sven,
>
> i am really talking about the grammar editor, not my DSL editor.
> when i import the existing meta-model as described in this thread
> (complete or just one subpackage) it gets slow on every key-stroke.
>
> unfortunatelly i cannot provide you the meta-model as is, due to the
> fact that it is part of an industrial project. just to mention some key
> data: the ecore meta-model has about 850 classes, 800 attributes, 1650
> references and a file size of about 6.7 Mb.
>
> Bye,
> Oliver.
>
Re: importing subpackages of external ecore models [message #44592 is a reply to message #44502] Wed, 20 May 2009 04:52 Go to previous messageGo to next message
Ioan Salau is currently offline Ioan SalauFriend
Messages: 69
Registered: July 2009
Location: Toronto
Member

Oliver wrote:

> Hi Sebastian and Sven,

> i am really talking about the grammar editor, not my DSL editor.
> when i import the existing meta-model as described in this thread
> (complete or just one subpackage) it gets slow on every key-stroke.

> unfortunatelly i cannot provide you the meta-model as is, due to the fact
> that it is part of an industrial project. just to mention some key data:
> the ecore meta-model has about 850 classes, 800 attributes, 1650
> references and a file size of about 6.7 Mb.

> Bye,
> Oliver.

Hi Oliver,

You should probably split your huge domain model (of 850 classes) to
smaller sub-domain models and provide different DSL for each sub-domain
model you intend to provide a textual editor. I am using a similar domain
model (HL7 MIF2 with aprox. 850 classes, maybe is the same hehe), but I
never considered importing all classes at once into Xtext. I focus at one
aspect at the time and I use intermediate models to import in Xtext or to
apply other M2M/M2T transformations or graphical editors (using GMF).

Ioan
Re: importing subpackages of external ecore models [message #45187 is a reply to message #44532] Mon, 25 May 2009 07:55 Go to previous message
Oliver is currently offline OliverFriend
Messages: 6
Registered: July 2009
Junior Member
Hi all,

I now installed the newest Xtext release and must say: good work! The
performance of the grammar editor improved significantly.
However, I also must consider Ioan's proposal of not to import (packages
of) the whole model, but to create a splitted small model of the parts of
interest.

Thank you all for your help.

Oliver.

> We are about to release a new Xtext build this afternoon. Please try to
> use the grammar editor with this release candidate 1. As Sven already
> mentioned, we made several changes that affect the editor's performance
> significantly.

> Regards,
> Sebastian
Previous Topic:[Xtext] Can any compare Xtext with TCS?
Next Topic:XML Meta Model
Goto Forum:
  


Current Time: Thu Jan 02 19:17:04 GMT 2025

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

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

Back to the top