Check node constraint programmatically

Good afternoon.

I have a node N1 that is a part of the collection inside another node N2. Also, my N1 node has a constraint of type "Can be a child". I would like to check this constraint programmatically from the behavior method and don't define any other methods because I already have a well-defined language aspect for this purpose (constraints aspect).

The problem is that we have "getContainmentLink" (https://www.jetbrains.com/help/mps/open-api-accessing-models-from-code.html#meta-modellevel) that represents a parent-child relationship. I can invoke the "isValid" method on this containment link but it will return true even if the constraint will be violated.

So my aim is to understand from some behavior method that my node N1 is invalid because of constraint violation. But I don't understand how to check it.

Thanks in advance.

0

Please sign in to leave a comment.