Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [xtext-dev] Importing EMF model inside subpackages

Hi Christian,

feel free to file a bug for that or even fix it.

Nevertheless, I remember nested packages being like a quilt that is to short: If you pull it over your head then your feet will get cold etc... From many conversations with Ed I know that nested packages are not really a well designed and that they can cause trouble even with plain EMF. So if someone sees a chance to change their Ecore if necessary, I'd always vote for that.

Cheers
Jan

--
Dr. Jan Köhnlein
jan.koehnlein@xxxxxxxxxx

TypeFox GmbH
Am Germaniahafen 1
24143 Kiel

Phone: +49 151 17396687
Skype: jankoehnlein
Twitter: jankoehnlein

Sitz: Kiel, Registergericht: Amtsgericht Kiel, HRB 17385
Geschäftsführer: Sven Efftinge, Moritz Eysholdt, Dr. Jan Köhnlein

> On 11 Jul 2016, at 22:59, Christian Dietrich <christian.dietrich@xxxxxxxxx> wrote:
> 
> Hi Jan,
> 
> ntl we should fix
> org.eclipse.xtext.xtext.generator.XtextGeneratorResourceSetInitializer.each(ResourceSet,
> Class<Type>, (Type)=>void)
> 
> which does not handle nested packages.
> thus you have to
> 
> list all subpackages
> with
> 
> uritoecore#//..... e.g
> import
> "platform:/resource/org.xtext.example.mydsl7.model/model/demo.ecore#//b"
> as b
> 
> ~Christian
> 
> Am 11.07.16 um 22:48 schrieb Jan Köhnlein:
>> Hi Kasper,
>> 
>> using subpackages in EMF is strongly discouraged, not only with Xtext (even Ed Merks himself considers them evil).
>> So the best solution is to split up your nested Ecore model into multiple flat ones.
>> 
>> Best regards
>> Jan
>> 
>> 
>> --
>> Dr. Jan Köhnlein
>> jan.koehnlein@xxxxxxxxxx
>> 
>> TypeFox GmbH
>> Am Germaniahafen 1
>> 24143 Kiel
>> 
>> Phone: +49 151 17396687
>> Skype: jankoehnlein
>> Twitter: jankoehnlein
>> 
>> Sitz: Kiel, Registergericht: Amtsgericht Kiel, HRB 17385
>> Geschäftsführer: Sven Efftinge, Moritz Eysholdt, Dr. Jan Köhnlein
>> 
>>> On 11 Jul 2016, at 21:42, kaspergam <kaspergam@xxxxxxxxxxxxx> wrote:
>>> 
>>> Hi all,
>>> 
>>> I am trying to use an existing EMF model as a base for a parser written in XText. However, I am having trouble getting the grammar to build with an ecore model that is in a series of sub-packages- The referenced EObjects are in org/eclipse/january/geometry (org is the top EPackage), where the last nsURI is "http://www.eclipse.org/january/geometry";. There are no errors with the workflow or the grammar, but when generating the Xtext artifacts, there is an error stating that the package "http:/www.eclipse.org/january/geometry" cannot be resolved. I made sure the xtext nature is added to the project, as well as registered the package in the StandaloneSetup class. I should also mention that for dependency reasons, I have the xtext and EMF model code all in the same plugin project. 
>>> 
>>> In my grammar (.xtext file), I simply import the package:
>>> 
>>> import "http://www.eclipse.org/january/geometry";
>>> 
>>> And in the mwe2:
>>> 
>>> referencedResource = "platform:/resource/org.eclipse.january.geometry.model/model/geometry.genmodel
>>> 
>>> And the first error line when generating the artifacts is something like this:
>>> 
>>> 672  [main] ERROR xt.generator.XtextGeneratorLanguage  - [XtextLinkingDiagnostic: null:3 Couldn't resolve reference to EPackage 'http://www.eclipse.org/january/geometry'., XtextLinkingDiagnostic: null:6 Couldn't resolve reference to EClassifier 'Geometry'., XtextLinkingDiagnostic: null:7 Couldn't resolve reference to EClassifier 'Geometry'., XtextLinkingDiagnostic: null:14 Couldn't resolve reference to EClassifier 'Shape'., XtextLinkingDiagnostic: null:15 Couldn't resolve reference to EClassifier 'Shape'., XtextLinkingDiagnostic: null:19 Couldn't resolve reference to EClassifier 'Triangle'., XtextLinkingDiagnostic: null:20 Couldn't resolve reference to EClassifier 'Triangle'., XtextLinkingDiagnostic: null:28 Couldn't resolve reference to EClassifier 'Vertex'., XtextLinkingDiagnostic: null:29 Couldn't resolve reference to EClassifier 'Vertex'.]
>>> 674  [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher  - Problems running workflow org.eclipse.january.model.xtext.GenerateSTL: Problem parsing 'file:/home/k7e/Documents/ICE/dev/eavp/org.eclipse.january.geometry.model/../org.eclipse.january.geometry.model/src/xtext/STL.xtext':
>>> 
>>> 
>>> Is this because the package I want is a subpackge, and Is it possible to use objects from EMF subpackges? Or should I resturcture the EMF model to not have any subpackges? 
>>> 
>>> Thanks, I appreciate any help on this!
>>> 
>>> Kasper Gammeltoft
>>> Oak Ridge National Laboratory
>>> Computer Science Research Group
>>> _______________________________________________
>>> xtext-dev mailing list
>>> xtext-dev@xxxxxxxxxxx
>>> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
>>> https://dev.eclipse.org/mailman/listinfo/xtext-dev
>> 
>> _______________________________________________
>> xtext-dev mailing list
>> xtext-dev@xxxxxxxxxxx
>> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/xtext-dev
>> 
> 
> -- 
> Christian Dietrich (Diplom-Informatiker (BA))
> Softwareentwickler / -Architekt
> 
> Tel.: +49 (0) 711 / 34 21 91-0
> Fax.: +49 (0) 711 / 34 21 91-29
> Mobil: +49 (0) 151 / 173969 17
> Mail: christian.dietrich@xxxxxxxxx
> XING: https://www.xing.com/profile/Christian_Dietrich8
> Web: http://www.itemis.de
> Skype: christiandietrich1982
> ICQ: 125801794
> 
> itemis AG
> Niederlassung Süd
> Industriestraße 6
> 70565 Stuttgart
> 
> Rechtlicher Hinweis:
> Registergericht: Amtsgericht Dortmund HRB 20621 | Sitz der Gesellschaft:
> Lünen
> Vorstand: Jens Wagener (Vorsitzender) | Wolfgang Neuhaus
> Aufsichtsrat: Prof. Dr. Burkhard Igel (Vors.) | Michael Neuhaus |
> Jennifer Fiorentino
> _______________________________________________
> xtext-dev mailing list
> xtext-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/xtext-dev



Back to the top