Can Be Child - Constraint: Child of each Concept only once
I want to create some kind of optional attributes:
My parent-concept has 0..n children of type Attributes.
Attributes has several sub-concepts.
Now I want to create a constraint so that each sub-concept is only allowed once.
e.g.
The problem:
When i create a constraint "can be child"
and test if the parent concept has already one child of that concept, then it would work as expected.
BUT: The constraint is also called to check the model and then it's not ok, cause now the parent has a one concept and that doesnt fullfill the constraint.
What I would need to do is to know if can be child is called to get the suggestions or if it is called to check the model.
Any ideas on that?
A solution would be if I could access the child's instance when it is available (on the check of the model). Otherwise it could be null.
My parent-concept has 0..n children of type Attributes.
Attributes has several sub-concepts.
Now I want to create a constraint so that each sub-concept is only allowed once.
e.g.
textbox {
length 15
height 10
color blue
}
The problem:
When i create a constraint "can be child"
and test if the parent concept has already one child of that concept, then it would work as expected.
BUT: The constraint is also called to check the model and then it's not ok, cause now the parent has a one concept and that doesnt fullfill the constraint.
What I would need to do is to know if can be child is called to get the suggestions or if it is called to check the model.
Any ideas on that?
A solution would be if I could access the child's instance when it is available (on the check of the model). Otherwise it could be null.
Please sign in to leave a comment.
Do you have any idea on a work-around?
IMHO this feature is really necessary!
There are many use-cases where you want to do this.
e.g. in the editor (see screenshot)
And as I already said, i do not see any workarounds for now..