14.4.3. Removing and deleting contexts

It follows that we cannot explicitly delete a context: we have no way of specifying the right to do so. However, we can provide a user role with a perspective on a context role that includes the DeleteWithContext or RemoveWithContext verb (remove does away with a single, specific role instance; Delete removes them all (within a context).

The PDR does not cascade delete resources (otherwise than removing the roles of a context with the context). This is because the true test whether a context can be removed is if there is still a user with a perspective on some part of the context. This is a resource intensive test.

14.4.3.1. RemoveWithContext

With remove, we can pick and remove a single (context) role instance. Because we identify the role instances we want to remove, we don’t have to identify their contexts:

remove context <role expression>

Notice the context keyword that follows remove. Also note that this not only removes the context, but also the context role that is filled with the contexts’ external role.

The following would only remove the context role that is filled with (the external role of) the context:

remove role <role expression>

Furthermore, the former expression requires a perspective with RemoveWithContext; the latter just requires Remove.

14.4.3.2. Delete

Deleting removes all instances of a role type.

delete role <role type>

This will remove all instances of the given role type from the current context.

delete role <role type> from <context expression>

This will remove all instances of the given role type from the context(s) retrieved by <context expression> (a path query). It is an error if the type of the role instances is not defined in the type of the contexts!

As with removing a single context, we can delete all contexts that fill a particular context role:

delete context <role type> from <context expression>

Again, all instances of the <role type> (which must be of kind context role) are removed as well.

14.4.3.3. Removing a context is computed per bubble

Consider this: the core system serving a particular end user has removed a context from the bubble of that user. Should it communicate all Delta’s generated by this process to peers with a perspective on that context role?

No! It must, however, communicate a Delta that says that the context has been removed. Each peer’s core works out what to remove from that Delta. This means, for example, that a user without a perspective on a particular role in the removed context, will make a user with that perspective remove that role as well.

14.4.3.4. Removing unbound contexts

The operational semantics of deleting is different for Database Query Roles. We stipulate that an external role instance and its context are removed permanently from the end users bubble (he part of the Perspectives Data Universe that is accessible to him). whenever it is being removed from a Database Query Role (and when the removing user has the verb RemoveWithContext or DeleteWithContext for that calculated role).

The consequence of this is that when this occurs, no DBQ Role based on the same type will show the instance any more.