Refactoring UML models for evolution is usually carried out in an ad hoc way. These transformations can become an issue, since it is hard to ensure that the semantics of models is preserved. We provide a set of semantics-preserving transformations for UML class diagrams annotaded with OCL. Using the proposed transformations, software designers can safely define larger transformations and detect subtle problems when refactoring models. Semantics-preserving transformations can also be useful from design pattern introduction to MDA. We prove that our transformations are sound using a semantic model that is based on Alloy, which is a formal modeling language. Due to Alloy’s ammenability to automatic analysis, our approach may additionally bring such analysis to class diagrams.