Skip to main content

Sequence

The following classes can be useful when creating sequence diagrams:

  • siren
  • sequence
  • notePosition
  • sequenceConfig

Simple

siren.sequence [
sequence.messageArrow( "Alice", "John", "Hello John, how are you?")
sequence.messageDottedArrow( "John", "Alice", "Great!")
sequence.messageOpenArrow( "Alice", "John", "See you later!")
]
|> siren.write

Create / destroy

let alice, bob, carl, donald = "Alice", "Bob", "Carl", "D"
siren.sequence [
sequence.messageArrow(alice, bob, "Hello Bob, how are you?")
sequence.messageArrow(bob, alice, "Fine, thank you. And you?")
sequence.createParticipant carl
sequence.messageArrow(alice, carl, "Hi Carl!")
sequence.createActor(donald, "Donald")
sequence.messageArrow(carl, donald, "Hi!")
sequence.destroy carl
sequence.messageCross(alice, carl, "We are too many")
sequence.destroy bob
sequence.messageArrow(bob, alice, "I agree")
]
|> siren.write

Nested activation

let alice, john = "Alice", "John"
siren.sequence [
sequence.messageArrow(alice, john, "Hello John, how are you?", true)
sequence.messageArrow(alice, john, "John, can you hear me?", true)
sequence.messageDottedArrow(john, alice, "Hi Alice, I can hear you!", false)
sequence.messageDottedArrow(john, alice, "I feel great!", false)
]
|> siren.write

Note

let alice, john = "Alice", "John"
siren.sequence [
sequence.message(alice, john, "Hello John, how are you?")
sequence.noteSpanning(alice, john, "A typical interaction<br/>But now in two lines", notePosition.over)
]
|> siren.write

Alt else opt

siren.sequence [
sequence.messageArrow("Alice", "Bob", "Hello Bob, how are you?")
sequence.alt ("is sick", [
sequence.messageArrow("Bob", "Alice", "Not so good :(")
],
[
// One else condition
"is well", [
sequence.messageArrow("Bob", "Alice", "Feeling fresh like a daisy")
]
])
sequence.opt ("Extra response", [
sequence.messageArrow("Bob", "Alice", "Thanks for asking")
])
]
|> siren.write

Parallel

siren.sequence [
sequence.par ("Alice to Bob", [
sequence.messageArrow("Alice", "Bob", "Hello guys!")
], [
"Alice to John", [
sequence.messageArrow("Alice", "John", "Hello guys!")
]
"Alice to Fred", [
sequence.messageArrow("Alice", "Fred", "Hello guys!")
]
])
sequence.messageDottedArrow("Bob", "Alice", "Hi Alice!")
sequence.messageDottedArrow("John", "Alice", "Hi Alice!")
sequence.messageDottedArrow("Fred", "Alice", "Hi Alice!")
]
|> siren.write

Autonumber loop

let alice, john, bob = "Alice", "John", "Bob"
siren.sequence [
sequence.autoNumber
sequence.messageArrow(alice, john, "Hello John, how are you?")
sequence.loop("HealthCheck", [
sequence.messageArrow(john, john, "Fight against hypochondria")
])
sequence.note(john, "Rational thoughts!", notePosition.rightOf)
sequence.messageDottedArrow(john, alice, "Great!")
sequence.messageArrow(john, bob, "How about you?")
sequence.messageDottedArrow(bob, john, "Jolly good!")
]
|> siren.write
siren.sequence [
sequence.participant "Alice"
sequence.participant "John"
sequence.link("Alice", "Dashboard", "https://dashboard.contoso.com/alice")
sequence.link("Alice", "Wiki", "https://wiki.contoso.com/alice")
sequence.link("John", "Dashboard", "https://dashboard.contoso.com/john")
sequence.link("John", "Wiki", "https://wiki.contoso.com/john")
sequence.messageArrow( "Alice", "John", "Hello John, how are you?")
]
|> siren.write