Referencing property of a concept as an Expression

My concept:

concept Attribute extends Expression implements INamedConcept

string name;
int average;

Attribute dependsOn;

I have an instance of it, named "Age".

Another concept I have is "Strategy". The purpose of it is to define how I calculate some rating based on attributes.

concept Strategy extends Expression implements INamedConcept

Expression rating;

In my instance of a Strategy I'd like to be able to define rating like this:

rating = Age.average - Age + dependsOn.average

Referencing Age itself is no problem. But referencing properties of a concept itself is another matter, and I don't see how to do that.

Any suggestions?
Comment actions Permalink
When you want to put something to the right of the dot in baseLanguage, it should implement IOperation.

Create a concept AverageFieldRef implementing IOperation. Add can be child constraint (its parent should be AttributeRef or have AttributeType). Add inference rule, saying

typeof(AverageFieldRef) :==: <int>;

As a sample see AsSequenceOperation concept.
Comment actions Permalink
Evgeny, you are awesome. =)
It took some time for me to understand the idea but in the end, it worked perfectly.
Thanks a lot!

Please sign in to leave a comment.