Below is part of my work so far. I’m getting cycles and both ways connections in between my Lines and single connections from Messages to Lines for some reason. I don’t see why there are never more than one message to line connections. My facts are probably (most likely) a little wrong. Thanks for the help.
some sig Line{
nextLine: some Line,
}
sig Message{
formedOfLines: Line,
}
fact MessageHasMoreThan1LineHasNextLine{
all m:Message|#m.formedOfLines>1 implies #m.formedOfLines.nextLine>0
}
fact NoNextLineIsSelf
{
all l1,l2:Line | l1=l2 implies l1.nextLine!=l2
}
fact LineBelongsToSomeMessage
{
all l:Line | l in Message.formedOfLines
}
Your model allows each
Lineto have multiplenextLines, which might not be your intention. That’s why yourNoNextLineIsSelffact doesn’t actually prevent loops, becausel.nextLine != lcan be true ifl.nextLinecontains more than oneLineand one of them isl. You can rewrite that fact toto forbid all loops.
To forbid “two-way connections” between lines, you can write something like
(I’m not sure which one of your facts was supposed to do that)
If you want a
Messageto have more than 1 line, you should change the multiplicity of theformedOfLinestoset, i.e.,