Model Identifiers

KnowledgeKube allows you to create special keywords known as Model Identifiers, which can be used to store independent units of data. This data could be a text string, a date, a numeric value, or something else entirely. There are different Types of model identifier, each fulfilling a unique purpose:

  • Variables store a single value that can be updated at any point during a model's session. You should use this type of identifier to store derived values such as the age of a person.
  • Constants are assigned a single value by a model administrator. When the application loads, this value is made available to the session, but it cannot be altered by the application itself. As such, it is useful for storing static values, such as a scientific constant or a company name.

An identifier can be referenced within a KnowledgeKube model using its unique Name. Referencing the identifier in this way lets you use it in expressions, for example by changing the value of a variable.

Before you can make such a reference, you must first Initialise the identifier. Doing this will allocate some session memory to store the identifier's value. The method of initialisation will depend on the type of identifier you want to use:

Method Available Types Description Further Reading
Design-time Any This is done using the Model Identifiers interface in the KnowledgeKube back office tool. Identifiers created in this way will be initialised as soon as your model loads. If you do not give the identifier a specific Initial Value, it will begin with a value of zero. Creating a Model Identifier
Run-time Variables only This is done by an expression while your application is running, typically using an Assignment Statement. Assigning a Value to a Variable

When you write an expression to initialise a variable during run-time, be sure to use a keyword that is not already in-use. Otherwise, the expression will attempt to change the existing keyword's value, instead of initialising a new one.

You should try to initialise a variable as close to where it's needed as possible during Run-time. The only reason to initialise a variable in Design-time is if you know you'll need it as soon as the application loads.

Identifiers of all types will be Disposed of, freeing up the memory used by them, at the end of the active session. Alternatively, in the case of variables you can deliberately dispose of them during run-time. The time between initialising an identifier and disposing of it is known as its Life-cycle.

Because variables are the only type of identifier you can modify and dispose of during run-time, they are the only identifiers whose life-cycle you need to plan.

Proper management of your variables' life-cycle is an important part of KnowledgeKube development. Be sure you understand these principles before you start to use variables in your applications.

To learn how to manage your model's Identifiers, refer to the following topic:

Description Further Reading
Use a special interface to add and make changes to design-time identifiers. Managing Model Identifiers