I need to generate random .xml instances from an .als in my program. I managed to do that by running alloy in background (invisible JFrame) and calling the doOpen, doExecuteLatest and doShowLatest functions. But having to wait alloy to start every time I run my code is a pain. I think it would be more efficient if I simply used the alloy code section that does this procedure (I imagine that would be kodkod). Does anyone know how to do that? I found alloy's code to be pretty confusing...
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
You can use the Alloy API. Generating an instance and writing it as an XML file can be easily done following those steps:
Read the alloy model from its source file.
Get the command to execute. for example :
Execute the model using the command obtained in step 2
Write the solution generated in step 3
Examples can be found in the edu.mit.csail.sdg.alloy4whole package of the Alloy jar file