"asset" CTO Statement Syntax

Q

What is the syntax of the "asset" CTO Statement

✍: FYIcenter.com

A

The "asset" statement declares a generic data type to represent primary data entities that can be referenced with their unique IDs. Here is the syntax of an "asset" statement:

[abstract] asset type_name [identified by id_name] | [extends super_type] {
  o|--> property_type property_name [optional] [default value] [validator]
  ...
  o|--> property_type[] property_name [optional]
  ...
} 

Syntax elements used in an "asset" CTO Statement:

  • "abstract" - An optional flag to indicate that this data type cannot be used to create data objects. An abstract "asset" data type can be used as a basis to declare other extended "asset" data types.
  • "type_name" - A required field to specify the name for this data type.
  • "identified by id_name" - A required field to specify the property name that will be used as the unique identifier for this data type. "identified by id_name" is required for a non-abstract "asset" data type and there is no identifier declared in its super-types. The identifier property must be a "String" data type.
  • "extends super_type" - An optional field to specify the super "asset" type, if this data type is an extension data type.
  • "o" - A required flag to specify a value property for this data type.
  • "-->" - A required flag to specify a reference property for this data type.
  • "property_type" - A required field to specify the data type of this property.
  • "[]" An optional flag to indicate that this property is an array.
  • "property_name" - A required field to specify the name of this property.
  • "optional" - An optional flag to indicate that this property is not required.
  • "default value" - An optional field to specify a default value for this property.
  • "validator" An optional field to specify a specify a validation rule like "range=[...]" or "[regex=/.../]".

 

⇒ "transaction" CTO Statement Syntax

⇐ "participant" CTO Statement Syntax

⇑ Business Network CTO Modeling Language

⇑⇑ Hyperledger Composer Tutorials

2021-08-01, 413👍, 0💬