Update a property of a referenced concept

Anybody knows how to update the value of a property of a referenced concept?

Sure, myReference.theDeclaration.itsProperty = "value"
Thanks! I am a newer to MPS, so I still need more explanations on your answer: 1. Does myReference denote the referenced concept defined in another concept? If so, what does theDeclaration refer to? 2. where can I use it? TextGen, Action, or other aspects? Thanks again.
myReference was meant to be a "reference" concept, such as VariableReference, for example, in BaseLanguage
theDeclaration would then be the actual reference that points to the declaration of some sort, e.g. VariableReference.variableDeclaration that points to VariableDeclaration instance

the code is usable in all aspects, it simply navigates the model (AST)

I might well have misunderstood your original question. In that case please provide more details of what you need.


Thanks for your reply! In order to help you understand my issue, I paste some code here. I defined two concepts: Dim and Select as follows:

concept Dim extends Statement         
            implements INamedConcept   

  instance can be root: false
  alias: dim
  short description: <no short description>

  state : string

concept Select extends Statement
implements <none>     
  instance can be root: false
  alias: select
  short description: <no short description>

  which : string

  dim : Dim[1]


I created a TextGen for Select concept; and then, in the TextGen, I was trying to update the value of "state" property of the referenced "dim" with the latest value of "which" property. My code looks like this

text gen component for concept Select {
  (context, buffer, node)->void {
    node.dim.state = node.which;

My question is when I was trying to generate java code in sandbox, the code in the TextGen always causes errors. So, in order to achieve the update feature, how should I do? Thanks
The thing is that the model is read-only in the text-gen phase to allow for various optimalizations and multi-threaded text generation. You are not allowed to change the properties here. Text-gen is meant to provide straight model-to-text conversion.

Instead, you should leverage the generator, which is intended for transforming the models before the final text generation.
Understand now. Really thanks.

Please sign in to leave a comment.