14.4.2. Unbound contexts
Consider the role Chats:
context Chats = callExternal cdb:RoleInstances( "model:SimpleChat$Chat$External" ) returns: Chat$External
Its roles are computed by executing a query on the database, requesting role instances of a particular type, in this case the external role of the Chat context. Can we create a new instance for such a role?
Yes we can, but we cannot create role instances to fill them with. There simply is no Enumerated role to fill. Nevertheless, we can retrieve the instances of the role. The matter how a role is represented (enumerated within a context, or by a query on a database) is an implementation detail rather than a conceptual issue. So Chats is a bona fide context role.
If we make the core system execute create context on such a role, it will just create a context instance (including its external role)
create context Chat in Chats
Of interest is the question: how does the core system recognise this situation? How does it decide that the created context cannot be bound? The crucial property of a Calculated context role that identifies it as one in which contexts cannot be bound, is that its computation consists of a call to a database query.
There is no consequence for the modeler. He can use the same expressions for bound and unbound embedded contexts. It is the core system that differentiates. This is as it should be, as it is more an implementation detail than a conceptual issue.