o..n cardinality for references in a Concept

We are using latest MPS 2018.3.2 and i don't see we can define references with (0..n) Cardinality . Is there any plan to do this in near future. 

I am aware that for any concept A we can create a new concept called Alist and reference that in some other concept B. Now For Concept B to reference AList it has to be declared somewhere, Assume the declaration is in Concept C. when a concept C wants to declare concept A as its child with cardinality as 1 "child:A(1)" it is not possible as A should be declared via AList and if we declare "child:AList(1)" there is a possiblity of having more than one A as child.

Please let me know how to solve this issue 
Regards, Anudeep

Comment actions Permalink

I'm not sure if I understand your second paragraph.

But the way to have a "collection of references" in MPS is to use what is commonly called a "smart reference": Documentation: https://confluence.jetbrains.com/display/MPSD20183/Structure (search for "smart reference").

Let's say you want to build a "Pizza" concept that has "0..n" references to different ingredients that are defined elsewhere. To do that, you have create a smart reference "IngredientRef" which has a reference with "0..1" or "1" cardinality to your Ingredient concept.

In you Pizza concept, you then can create a "child" of type "IngredientRef" with the cardinality "0..n". Smart References have some build in behaviors that you can best read up on in the documentation I provided the link to above.


Comment actions Permalink

The short answer is that for "..n" number of references, you'll need to create a new concept that references one node, and is a "..n" child of the concept you wanted the multiple reference from.

concept AReference

theNode : A[1]

concept AGrouping
items: AReference[1..n]



Please sign in to leave a comment.