How to Pass Sig from Alloy to Java and execute alloy model from Java

Viewed 173

I have built an alloy model where I have put all my system logic. I want to do a large scale analysis. For doing that, my logic is to use Java to read the data file, then pass those data to Alloy to check whether those met the constraint I defined in the Alloy or not. To do that, my logic is to create sig object using those data and pass those to Alloy.

As my system model is complex, I am trying to summarize my problem using the following code-

sig A{
val: Int
}

sig B{
chunk: Int
}


fact {

    A.val > 10 && A.val < 15
}

Now, I want to pass the following sig object and run command from Java.

sig C{

name: String
}

run {} for 4

How can I pass that code? I am following this link https://github.com/ikuraj/alloy/blob/master/src/edu/mit/csail/sdg/alloy4whole/ExampleUsingTheAPI.java . But not able to figure it out.

1 Answers

There is currently a branch pkriens/api in progress that makes this quite easy. Look at the testcases in the classic test project.

We're working on integrating this in the master branch soon (before the end of 2019).

Related