How can I restrict the scoping of extended concepts? Follow
Hello,
i've created a subconcept of the base languages' interface. Now I want to restrict the possible classifiertypes allowed as parameters, but I can only create constraints for my own references and have no access to the inherited ones.
Can anybody help me?
i've created a subconcept of the base languages' interface. Now I want to restrict the possible classifiertypes allowed as parameters, but I can only create constraints for my own references and have no access to the inherited ones.
Can anybody help me?
Please sign in to leave a comment.
But here are some things you can try:
Just add a non-type-system rule. This will create a error/warning, when something wrong is entered.
To restrict the scoping (the suggestions) is a bit harder.
I just tried the following:
I created a concept Interface2 that extends Interface.
I created a concept MethodDecl2 that extends MethodDeclaration.
I added a child to Interface2 with Type MethodDecl2 and specializes(overrides) "method".
The I added a child to MethodDecl2 with StringType as returnType that specializes "returnType".
So I could reduce the suggested and valid return-types in that Interface to just the StringType.
(Without using constraints or non-type-system rules.)
The second procedure is close to my requirements. But is it posible to check certain conditions instead of only restrict the type? I try to implement a custom visibility scope comparable to the one used in the Classifier Concept. But implementing a default scope for my extendet interface doesn't work.
second thing:
I've noticed a strage behavior when specializing the inherited "method". For the case of choosing InstanceMethodDeclaration as the type I expect no change in the behavior. But in this case I can't iterate over the InstanceMethodDeclarations any longer. Seems like the cardinality of method changed to one. It also can't be used in the editor aspect any longer.
Any suggestions?
You just need to find the concept that has the reference you want to change the scope for. Then make a subclass from that and reduce the scope. Then use that subclass in the matter shown above.
What do you mean by iterate? Did you give it a new name or the same name? Did you change the cardinality?
I gave it the same name "method". The cardinality is not editable when you specializing a role.
When I inherit from Interface I can use collection methods like "select", "select many", etc. When I specialize "method", these functions aren't visible.
I get the following exception:
Any ideas?
Can you provide detailed information, what your metamodel looks like. What do you want to do, and what concepts have you created? Which concept extends what etc.
Very strange behavior...
ClassifierType is a really complex thing, especially because of Java-Generics.
Does it make sense?
To restrict the scope, I've added a reference constraint for the classifier role and return only the nodes matching my condition