I'm trying to put a constraint over a reference concept in my project.
I will explain the context :
- There is a concept A which contain a child ID.
- And a concept B containing a ref to A through ID, the cardinality of the ref is 1..n.
Concept B can reference seraval A.
What I want to do with my constraint is to make sure that a reference between an element of type B and A is unique.
What I've done for now is to start implementing a constraint for the concept IDref
and concept A implements ScopeProvider to override getScope() method.
In the method getScope(), I know I just have to check which ref already exists in the AST and remove it from the scope, but I dont know how to do this ...
Can you tell me if it's the right way to do this ?
And if I'm right which kind of mechanism I have to implement in getScope() to reduce end-user's possibility for the uniqueness reference (thanks to auto-completion).