referent constraint
Hello,
I would like to put a constraint on the fact that a person has a reference to 'responsible parent' only if his age is lower than the age of majority in the country. Knowing that 'person', 'country' and 'parent' are concepts.
I've been able to manage this with the editor, by displaying the 'parent' cell only if the age is higher than the age of majority, but I'd like to add a constraint.
I'd probably have to add a reference constraint to the 'person' concept
Please sign in to leave a comment.
Yes, you have to define scope for the reference that returns an empty scope, when the age condition is not met.
Alternatively, you can define a checking rule in the typesystem aspect.
I have an "Error: Expected expression" error. I may have written the constraint wrong
link {parent}
referent set handler <none>
scope (referenceNode, contextNode, containmentLink, position, linkTarget)->Scope {
if (referenceNode.age < referenceNode.country.minorAge) { return EmptyScope; }
}
I guess that you are missing the “new” expression as in “return new EmptyScope()”.