CD2Alloy is a tool that automatically translates UML Class Diagrams (CDs) into Alloy models, enabling formal analysis and model checking on software designs.
Create your UML Class Diagram using PlantUML, which supports exporting to XMI format.
Convert your .wsd class diagram into an XMI file using the following command:
plantuml -txmi:star <cd_name>.wsdUse the following command to clone the repository:
git clone https://github.com/osmandagli/cd2alloy.git
cd cd2alloyCopy the .xmi file you created and place it in the data/ directory:
cp <PlantUML_workspace>/<cd_name>.xmi data/cd.xmiExecute the translation by running the main Python script:
python src/main.pyAfter running the script, the translated Alloy model will be written to:
output.alsYou can open this file using Alloy Analyzer.
-
The tool assumes the XMI file is generated using PlantUML with StarUML compatibility, via:
plantuml -txmi:star <cd_name>.wsd
-
The Plantuml version used in this project is
1.2025.2
This repository includes example .xmi input and .als output files to demonstrate the workflow.
You can find them under the data/ and root directories, respectively.
Contributions are welcome! Feel free to open issues or submit pull requests.
If you encounter any issues or have suggestions for improvements, reach out via GitHub.
You can find the GitHub repository here:
https://github.com/osmandagli/cd2alloy