简体   繁体   English

合金分析仪4.2中未显示合金特征

[英]Alloy signatures not shown in Alloy Analyzer 4.2

I have to use Alloy in a Requirements Analysis and Specification Document for a university project. 我必须在大学项目的需求分析和规范文档中使用Alloy。 I started with the easy stuff, only signatures and no facts. 我从简单的东西开始,只有签名,没有事实。 These are the signatures I use: 这些是我使用的签名:

abstract sig Date{
    year: one Int,
    month: one Int,
    day: one Int
}

abstract sig Time{
    h: one Int,
    m: one Int,
    s: one Int
}

abstract sig Double{
    leftPart: one Int,
    rightPart: one Int
}

abstract sig Bool{
    value: one String
}

sig DateBirth extends Date{}
sig DateRide extends Date{}
sig DateExpiry extends Date{}


abstract sig User {
email: one String,
name: one String,
surname: one String,
gender: one Bool,
address: one String,
password: one String,
dateOfBirth: one DateBirth,
IDRide: set Ride
}

sig TaxiDriver extends User{
taxiLicense: one String,
personalLicense: one String,
IBAN: one String,
positionInQueue: lone Int,
IDTaxi: set Taxi
}


sig Client extends User{
}


sig Zone {
numberOfZone: one Int,
vertexNorthWest: one Double,
vertexNorthEast: one Double,
vertexSouthWest: one Double,
vertexSouthEast: one Double,
currentQueue: set TaxiDriver

}


sig Taxi {
IDTaxi: one String,
plate: one String,
availablePlaces: one Int,
}


sig Ride {
IDRide: one String,
origin: one String,
destination: one String,
dateOfRide: one DateRide,
timeOfDeparture: one Time,
timeOfArrival: one Time,
price: one Double,
numberOfPeople: one Int,
accepted: one Bool,
userEmail: set User
}


sig Credit_Card {
number: Double,
owner: String,
expiryDate: DateExpiry,
ownerEmail: one Client
}

Then, I added the predicate "show" to veify whether the it is consistent or not: 然后,我添加谓词“ show”以验证其是否一致:

pred Show{}
run Show for 10

After running "Execute" on Alloy Analyzer 4.2 this is the message I get: 在Alloy Analyzer 4.2上运行“执行”后,这是我得到的消息:

Executing "Run Show for 10"
   Solver=sat4j Bitwidth=4 MaxSeq=7 SkolemDepth=1 Symmetry=20
   21067 vars. 3840 primary vars. 37164 clauses. 376ms.
   Instance. found. Predicate is consistent. 375ms.

No problems, right? 没问题吧? But then, when I click on "Show" there are no instances of the signature "User" (and its child signatures) shown on the display, while all the others are there. 但是,当我单击“显示”时,在显示屏上没有显示签名“用户”(及其子签名)的实例,而其他所有实例都在那里。 I tried to click on "Next" a gazillion times to try to see if maybe I could find a model in which they were shown, but there weren't any. 我试图多次单击“下一步”,以尝试查看是否可以找到显示它们的模型,但没有任何模型。 Any idea/suggestion? 有任何想法/建议吗? Thanks! 谢谢!

It's probably because of the use of String . 这可能是因为使用了String As far as I know, String is a reserved word in Alloy, but it is not really implemented at this point. 据我所知, String是Alloy中的保留字,但目前尚未真正实现。 Try to remove the String fields or replace them with something else. 尝试删除“ String字段或将其替换为其他内容。

On a more general note, Alloy is not so much about modelling real data (ints, bools and strings), but more about modelling structure , ie relationships between entities. 从更笼统的角度来看,Alloy并不仅仅是在建模真实数据(整数,布尔值和字符串),而是在建模结构 (即实体之间的关系)。 For the analysis of structure, you usually don't need concrete data types. 对于结构分析,通常不需要具体的数据类型。

The purpose of building an Alloy model is to capture the essence of a design or system and explore subtle properties. 建立Alloy模型的目的是捕获设计或系统的本质并探索微妙的属性。 You don't want to include all the details you'd find in a database schema. 您不想包括在数据库模式中找到的所有详细信息。 Your model has lots of implementation details too, such as the ids (which aren't needed since they're implicit in the object identities), and the use of strings instead of conceptual types -- destination, eg, should have a type such as "Location". 您的模型也有很多实现细节,例如id(由于ID在对象标识中是隐式的,因此不需要),以及使用字符串代替概念类型(例如,目的地)应具有以下类型:作为“位置”。

So I'd recommend that you start again, and think first about what kinds of questions you'd like this model to answer. 因此,我建议您重新开始,然后首先考虑您希望该模型回答什么样的问题。

Thanks to everyone, removing strings solved the problem. 感谢大家, 删除字符串解决了这个问题。

However, my "distorted" vision about Alloy's purpose was due to the fact that we were asked to use it but we weren't given a real explanation on how to use it, in most examples all details were written. 但是,我对Alloy用途的“扭曲”看法是由于有人要求我们使用它,但是我们没有得到关于如何使用它的真正解释,在大多数示例中,所有细节均已写好。 I guess I'll have to try and study it a bit more! 我想我将不得不尝试进一步研究!

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

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