简体   繁体   English

如何将 Sig 从 Alloy 传递到 Java 并从 Java 执行合金模型

[英]How to Pass Sig from Alloy to Java and execute alloy model from Java

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.为此,我的逻辑是使用 Java 读取数据文件,然后将这些数据传递给 Alloy 以检查它们是否满足我在 Alloy 中定义的约束。 To do that, my logic is to create sig object using those data and pass those to Alloy.为此,我的逻辑是使用这些数据创建 sig 对象并将它们传递给 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 对象并从 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 .我正在关注此链接https://github.com/ikuraj/alloy/blob/master/src/edu/mit/csail/sdg/alloy4whole/ExampleUsingTheAPI.java But not able to figure it out.却想不通。

There is currently a branch pkriens/api in progress that makes this quite easy.目前有一个分支pkriens/api正在进行中,这使得这很容易。 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).我们正在努力将其集成到主分支中(在 2019 年底之前)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM