Variables and Types

Two important concepts in Design Studio are those of variables and types. When creating a variable, it must be chosen which type it should have. There are two kinds of types: complex types and simple types. A complex type defines a set of attributes. This expresses that each variable of a complex type denotes several (named) values. Note that we generally refer to each attribute, e.g. 'title', of a variable of complex type, e.g. 'Book', as a separate variable and denote its value using the fully qualified attribute name, i.e. 'Book.title'. Complex types can be created from within Design Studio to fit any need one might have. A simple type does not define any attributes, but only represents the type of a single value. Thus, a variable of a simple type contains a single value, for example a text string, and is referred to only by its variable name, e.g. 'Username'. Simple types are built-in and cannot be edited, nor can they be created.

Every variable can be associated with a default initial value that it retains unless the robot explicitly reassigns it, which it often will as values are extracted and manipulated during the execution. Most robots output the values of variables, e.g. by returning them to the caller or inserting them in a database. Robots might also take input values which are then assigned to specific variables that have been marked as receiving their values from input. These are simply called input variables.

An important difference between variables of complex and simple types is that variables of simple types cannot be used as input variables, and their values cannot be outputted. However, they are useful, for instance, for extracting temporary data or as global counters. Generally, variables of simple types should be viewed as temporary variables, internal to the robot.

Values from variables of complex types can be outputted in various ways. For example, a robot extracting news from some web site might output the values of news variables; each news variable would then have a complex type with attributes such as 'headline', 'bodyText', 'date', 'author', etc., and each outputted news value then comprises a (possibly) unique (sub-)value for each of the named attributes.

For robots containing input variables, it must be specified as part of the input to the robot to which input variable a given input value has to be assigned. For example, a shopping robot that orders books at might depend on input values containing user and book information. These might be assigned to two input variables in the robot called "user" and "bookInfo" of type "User" and "BookInfo". The below figure shows how a robot accepts input values and generates output values.

The figure shows robot input-output. Input values are assigned to input variables, and the values of some variables are outputted. Only variables of complex types can be assigned from input or have their values outputted.