Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Serialization error: contains non-transient values but has no corresponding assignment in rule(Default values for features?)
Serialization error: contains non-transient values but has no corresponding assignment in rule [message #1737874] Wed, 13 July 2016 16:34 Go to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 406
Registered: March 2011
Senior Member
Hello. I have an Xtext grammar for an existing EMF model and I'm attempting to serialize models, but I get errors such as the following:

org.eclipse.e4.core.di.InjectionException: org.eclipse.xtext.validation.IConcreteSyntaxValidator$InvalidConcreteSyntaxException: These errors need to be fixed before the model can be serialized.
RTModel'PingPong'.entities[0]->Capsule'Top'.parts[0]->CapsulePart'pinger': The feature MultiplicityElement(CapsulePart).unique contains non-transient values but has no corresponding assignment in rule CapsulePart.


Is this sort of error a problem with the model I'm trying to serialize or with the grammar itself?

The rule for this model element is this:

CapsulePart returns CapsulePart:
    (kind=CapsuleKind)?
    'part'
    name=EString
    ':' type=[Capsule|QualifiedName]
    ('[' upperBound=Bound ']')?
    RedefinitionFragment
    ';'
;


where "CapsulePart" is a (meta)class in the EMF (meta)model, which has:
* a 'type' reference of type 'Capsule'
* a 'kind' attribute of type 'CapsuleKind'
* supertypes MultiplicityElement and 'RedifinableElement'

and inherits from 'MultiplicityElement':
* a 'unique' attribute of type EBoolean
* an 'ordered' attribute of type EBoolean
* a 'lowerBound' attribute of type EString
* an 'upperBound' attribute of type EString

and inherits from RedefinableElement
* a 'name' attribute of type EString
* a 'redefines' reference of type RedefinableElement

Is the error caused by the fact that the grammar rule doesn't have assignments for attributes like 'unique', 'ordered', etc.?

If so, is there a way to assign default values to features? or alternatively a way to tell the serializer to ignore unassigned features?

Thanks

Re: Serialization error: contains non-transient values but has no corresponding assignment in rule [message #1737885 is a reply to message #1737874] Wed, 13 July 2016 18:47 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14075
Registered: July 2009
Senior Member
The Problem is.

Your Model has an attribute with a value but no place in the grammar where
to serialize it. You can customize itransientvalueservice to tell xtext
that this Is ok


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Serialization error: contains non-transient values but has no corresponding assignment in rule [message #1737887 is a reply to message #1737885] Wed, 13 July 2016 18:57 Go to previous messageGo to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 406
Registered: March 2011
Senior Member
Thanks.

So if my own transient value service's "isTransient" method returns true, the feature will not be serialized?
Re: Serialization error: contains non-transient values but has no corresponding assignment in rule [message #1737888 is a reply to message #1737887] Wed, 13 July 2016 18:57 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14075
Registered: July 2009
Senior Member
Yes

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Glitch in xtext generated code editor while typing "enter"
Next Topic:Xtext auto content assist not working for underscore
Goto Forum:
  


Current Time: Sun Oct 17 20:13:56 GMT 2021

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

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

Back to the top