Data Structures and Types

Data structure in ProcessMIX is a named definition of a set of value-holding properties, also known as attributes or fields.

It provides a systematic way to model and process structured information, from simple to very complex, automating operations such as creation, deletion, searching and reasoning over data.

The name of a data structure definition record must be unique within a project's folder where it is defined. Individual properties listed in it also have names that must be unique within that structure.

The data values that such properties represent can be of one of simple data types:

  • String

  • Numeric (Integer for storing whole numbers, Float for real, i.e. fractional numbers, or Byte for short signed integers)

  • Boolean (true/false)

  • Date (date/time)

They can also be of more complex types:

  • Array (a collection of values)

  • Map (a colleciton of key-value lookup pairs)

  • Another user-defined or built-in data structure.

When used together, this mechanism allows describing tree-like data constructs of any level of complexity.

For example, the following data structure describes some information about a person:

Person extends UserObject
    name: String
    birthDate: Date
    weight: Integer
    address: Address
    children: Array<Person>

Here, "Person" is the name of the data structure, "UserObject" is a base structure that it extends or inherits from, and the rest are properties of various types to hold individual bits of information about that person. The Array<Person> is an example of a parameterized data structure.

Data structures themselves do not hold the actual data - they only describe what it will look like when a program is executed at runtime. Variable is another concept in ProcessMIX, addressing that part. Variables reserve space for and give unique names to specific instances of data structures (or just simple fields) that are filled with real data when the program is run.

For example, a "Person" data structure describes what type of information can be collected about any person, but an "applicant: a Person" variable in a flow can be used to reserve space and refer to a specific person who's details will be evaluated in a specific loan application request. And another variable with a different name but same "Person" type can be used to hold information about another person.

The Data Structure Builder section explains how to use the project IDE to define your own structures.

Data Structure Inheritance

Inheritance is a mechanism that allows some data structure (called derived structure) to extend another, more general structure (called a base structure, or superstructure), so that it can inherit shared properties from the base and define some more properties of its own - thus making it more specific.

Inheritance establishes a relationship where multiple derived structures can be defined as more specialized versions of the same base structure. This helps to reduce the amount of development work, allowing base properties and business logic to be described only once but still apply to many specific scenarios that have some information in common between them.

Here is an example of inheritance:

1. Person is a structure with properties: FirstName, LastName, Email
2. Employee is a Person with a property: Salary

A variable of type Employee will now have 4 properties: FirstName, LastName, Email, and Salary.

Data Structure Parameterization

Parametrization is another concept that is used to define a data structure and its properties once, but make it capable of handling different types information in different places in a program where it is applied.

For example, an Array in ProcessMIX can be used to store collections with multiple data records of the same type, allowing to process them using operations such as count (array size), iteration (go through each element and apply some logic to it), add, delete or move an element.

But the actual types of data records will be different in every place where an array-typed property is declared, and it is not know upfront what they will be until business logic is defined. So the Array data structure type must take a parameter, through which a user can specify the type of a data elements that this array will hold. The presence of such parameters is why these structures are called "parameterized"

Example of parametrization:

Person extends pdk.core.UserObject
    children: Array<Person>
    hobbies: Array<String>

As can be seen, the same "Array" type is used in two different properties, but it is parameterized with two different types of elements that they will hold - so the program will be able to count both the number of children and the number of hobbies of that person using the same logic, yet be able to apply very different logic when reasoning about individual elements of these two arrays.

Standard (Built-In) Data Structures

Users of ProcessMIX are expected to define their own data structures whenever necessary. However, many such structures come predefined as a part of the plaftorm itself in the standard PDK ("ProcessMIX Development Kit") library.

Some of them are used as base types from which all others are derived:

pdk.core.Any is a superstructure for all structures

pdk.core.UserObject is a superstructure for all not-system (created by users) structures

pdk.ex.Exception is a superstructure for all checked exceptions

Others represent standard data types (such as simple types, arrays and maps), and many more describe sets of information/parameters utilized by the platform to perform various useful operations when called for by user-defined flows. They are grouped in packages:

  • pdk.core - contains core structures such as String, Integer, Date, Array and others

  • pdk.asset.dictionary - contains structures to operate with Dictionaries

  • pdk.asset.scorecard - contains structures to operate with Structures

  • pdk.blockchain - contains structures to support blockchains integrations

  • pdk.ex - contains structures representing exceptions.

  • pdk.io - contains structures for system input and output through data streams and the file system

  • pdk.jwt - contains structures to handle JSON Web Token (JWT)

  • pdk.net - contains structures for implementing networking services

  • pdk.net.http - contains structures that provide support for HTTP calls

  • pdk.net.soap - contains structures that provide support for SOAP calls

  • pdk.s3 - contains structures to operate with S3 service

  • pdk.sql - contains structures to operate with SQL queries

  • pdk.db.postgre - contains PostgreSQL specific structures

Last updated