Airline Model - DAML Code

Hi Team,

My name is Erum and I am still in learning phase of DAML. I have started an Airline Model example from DAML Repository

My questions are:

  1. Is there any complete description of DAML code for Airline model as I want to understand the complete process to map it into UML Class diagram. I have gone through the readme file but it contains very little information to understand the complete model. I am trying to find an approach to communicate DAML code into business user so they can understand easily.

  2. In the following What is the seatClasses: TextMapClass attributes describes? and same for allocation: Text,Map Text. If you can explain me what are these attributes used for here?

template Flight
seatClasses : TextMap Class
allocation : TextMap Text
flightNumber : Text
airline : Party
invitedPassengers : [Party]
passengers : [Party]
signatory airline, passengers
observer invitedPassengers

Thank you


1 Like

Hi @Zerum and welcome to the Daml developer forum!

As far as I know there’s no more documentation around the Airline model than what’s in the GitHub repo. If you’re new to Daml I would recommend starting with @SteveSeow’s Daml 101 video series that will make reading the model easier.

Regarding your 2nd question: TextMap creates an associative array.

If you search for the seatClass argument of the template in the file you’ll find the following definition

    seatClasses = TM.fromList
      [ ("1A", First)
      , ("1B", First)
      , ("2A", Business)
      , ("2B", Business)
      , ("3A", Coach)
      , ("3B", Coach) ]

This assigns seat numbers to a ticket class.

The allocation attribute assigns a seat to an issued ticket

        create this with
          allocation = insert seat ticketRef allocation
1 Like

Thank you for your reply. Very helpful for me. I am trying to find an approach to communicate DAML code into business user so they can understand easily. I am trying to map to code in UML Class Diagram. If I face problem later, I will come back to this forum again

Thank you so much

1 Like

Hi @Zerum,

I don’t personally think there is a good substitute for actually reading the code, and Daml has been designed to be relatively business-friendly in both syntax and semantics.

That being said, if we’re talking graphical representations, I should point out we do have a tool to generate diagrams from Daml code, which you may find useful.

1 Like

Can you explain this
ticket.airline === flight.airline

Why there are 3 = signs used here?

When asking a new question, please always start a new thread.
To answer your question, this is an infix notation for the assetEq function, which checks if the values of two expressions are equal and fails with a message if they are not. Here’s the link to the documentation.

1 Like