From time to time I see people asking questions like “how can I make MPS remove all references to my thing after I remove the thing”, or “how can I make MPS remove my thing after I remove all references to it”. This feels to me as if the person wanted to use MPS as sort of a relational database. After all, in relational databases this question has an easy answer: use foreign key constraints with cascading deletes.

Some modeling tools work like this, too. They manage a relational database of “things” and relationships between them (often called a repository), and when you remove a thing, all relationships that refer to it are removed as well.

However, MPS is closer in spirit to an IDE (or perhaps to a NoSQL database). Your Java IDE does not remove a class after you stopped using it in your code, nor does it remove all references to a class if you delete it.

A Java IDE provides refactorings and can search for usages of a given class and highlight unused program elements. MPS can do both, too. But referential integrity is not something that MPS can provide out of the box.