CTO Language Statements

Q

What are Business Network Model CTO Language Statements?

✍: FYIcenter.com

A

Business Network Model CTO language supports 8 types of statements.

namespace - The "namespace" statement declares a namespace as the prefix for all data types defined in this CTO file.

The "namespace" statement has the same syntax as the "namespace" statement in "C#" or "package" Java language. For example:

namespace com.fyicenter.hyperledger

import - The "import" statement imports data types defined in other CTO source code files.

The "import" statement has similar syntax as the "import" statement in Java language. For example:

import com.fyicenter.common

participant - The "participant" statement declares a participant data type to represent someone who can interact with the business network under access control rules.

The "participant" statement has similar syntax as the "struct" statement in the C language. For example:

participant Customer identified by customerId {
  o String customerId
  o String firstName
  o String lastName
  --> Address address
}

asset - The "asset" statement declares a generic data type to represent primary data entities that can be referenced with their unique IDs.

The "asset" statement has similar syntax as the "struct" statement in the C language. For example:

asset Car identified by vin {
  o String vin
  o String maker
  o String model
  o Double value
  o Currency currency
  --> Customer owner
}

transaction - The "transaction" statement declares the input message structure of a transaction type, which can be submitted to the business network for processing.

The "transaction" statement has similar syntax as the "struct" statement in the C language. For example:

transaction Trasfer {
  --> Car car
  --> Customer newOwner
}

event - The "event" statement declares the output message structure of an event type, which can be emitted from the business network for external systems to consume.

The "event" statement has similar syntax as the "struct" statement in the C language. For example:

event CarOwnerChanged {
  --> Car car
  --> Customer newOwner
  --> Customer oldOwner
}

concept - The "concept" statement declares a generic data type to represent secondary data entities to support primary data entities.

The "concept" statement has similar syntax as the "struct" statement in the C language. For example:

concept Address {
  o String street
  o String city
  o String state
}

enum - The "enum" statement declares an enumeration data type to represent data values with predefined options.

The "enum" statement has similar syntax as the "enum" statement in the C language. For example:

enum Currency {
  o USD
  o CAN
  o EUR
}

 

⇒ "participant" CTO Statement Syntax

⇐ What Is CTO Modeling Language

⇑ Business Network CTO Modeling Language

⇑⇑ Hyperledger Composer Tutorials

2021-08-04, 919🔥, 1💬