Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xtext] Ecore Metamodel Question
[Xtext] Ecore Metamodel Question [message #62540] Wed, 22 July 2009 13:02 Go to next message
Eclipse UserFriend
Originally posted by: oba.informatik.uni-kiel.de

Hi all,

both of the following grammars yield to the same Ecore Metamodel:
======================================
GRAMMAR 1
======================================
Model :
(elements+=DataType)+
;
DataType:
'datatype' name=ID ';'?
;
======================================
GRAMMAR 2
======================================
Model :
(elements+=DataType)*
;
DataType:
'datatype' name=ID ';'?
;
======================================

But I would expect that in the first one, the lower bound of the
reference "elements" would be set to 1. This is not the case, can some
one tell me, what I am overseeing/misunderstanding?

Thanks a lot!

mN
Re: [Xtext] Ecore Metamodel Question [message #62565 is a reply to message #62540] Wed, 22 July 2009 13:11 Go to previous messageGo to next message
Michael Burkhardt is currently offline Michael BurkhardtFriend
Messages: 64
Registered: July 2009
Member
Hello mN,

what's wrong?
You expect in grammar 1 at least one Datatype?

Why you dont use a definition like (see below):

Model:
head = DataType (tails += DataType)*;
DataType:
'datatype' name = ID ';';

Ciao, Micha



--- Original-Nachricht ---
Absender: myName
Datum: 22.07.2009 15:02
> Hi all,
>
> both of the following grammars yield to the same Ecore Metamodel:
> ======================================
> GRAMMAR 1
> ======================================
> Model :
> (elements+=DataType)+
> ;
> DataType:
> 'datatype' name=ID ';'?
> ;
> ======================================
> GRAMMAR 2
> ======================================
> Model :
> (elements+=DataType)*
> ;
> DataType:
> 'datatype' name=ID ';'?
> ;
> ======================================
>
> But I would expect that in the first one, the lower bound of the
> reference "elements" would be set to 1. This is not the case, can some
> one tell me, what I am overseeing/misunderstanding?
>
> Thanks a lot!
>
> mN
Re: [Xtext] Ecore Metamodel Question [message #62660 is a reply to message #62565] Wed, 22 July 2009 13:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: oba.informatik.uni-kiel.de

Michael Burkhardt wrote:
> Hello mN,
hi, thanks for your reply, Micha

> what's wrong?
> You expect in grammar 1 at least one Datatype?
>
> Why you dont use a definition like (see below):
>
> Model:
> head = DataType (tails += DataType)*;

Well, this is what the first rule ( Model: (elements+=DataType)+; )
does, isn't it? Except naming the first element separately.

I do not need this rule at least not in this form but I want to
understand why the generator does not set the lower bound of the
reference "elements" in the generated Ecore model to 1 when my rule says
that it should contain at least one "datatype".

Thanks

mN
Re: [Xtext] Ecore Metamodel Question [message #62683 is a reply to message #62540] Wed, 22 July 2009 13:22 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi mN,

its intentional. We didn't want to introduce to many constraints in the
metamodel. However, there is an open issue and you may want to comment
it: https://bugs.eclipse.org/bugs/show_bug.cgi?id=266830

If you want strict constraints in your metamodel, you can use a post
processing step. Have a look at the docs to learn about it.

Regards,
Sebastian

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

Am 22.07.2009 15:02 Uhr, schrieb myName:
> Hi all,
>
> both of the following grammars yield to the same Ecore Metamodel:
> ======================================
> GRAMMAR 1
> ======================================
> Model :
> (elements+=DataType)+
> ;
> DataType:
> 'datatype' name=ID ';'?
> ;
> ======================================
> GRAMMAR 2
> ======================================
> Model :
> (elements+=DataType)*
> ;
> DataType:
> 'datatype' name=ID ';'?
> ;
> ======================================
>
> But I would expect that in the first one, the lower bound of the
> reference "elements" would be set to 1. This is not the case, can some
> one tell me, what I am overseeing/misunderstanding?
>
> Thanks a lot!
>
> mN
Re: [Xtext] Ecore Metamodel Question [message #62707 is a reply to message #62683] Wed, 22 July 2009 13:27 Go to previous message
Eclipse UserFriend
Originally posted by: oba.informatik.uni-kiel.de

Sebastian Zarnekow wrote:
> Hi mN,
>
> its intentional. We didn't want to introduce to many constraints in the
> metamodel. However, there is an open issue and you may want to comment
> it: https://bugs.eclipse.org/bugs/show_bug.cgi?id=266830
>
> If you want strict constraints in your metamodel, you can use a post
> processing step. Have a look at the docs to learn about it.
>
> Regards,
> Sebastian
>
oh, I see. Thanks Sebastian.
Previous Topic:[Xtext] MWE problem: Allowing backtracing in AntlrDelegating fragment yields to error
Next Topic:Xtext formatter
Goto Forum:
  


Current Time: Fri Nov 08 22:38:38 GMT 2024

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

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

Back to the top