The SDAI specification defines four schemas for its own use. These are the session schema, the population schema, the parameter data schema and the dictionary schema. This chapter contains the complete EXPRESS for the SDAI schemas with annotations. In general, the instances in the SDAI schemas are manipulated by various SDAI functions (e.g. sdaiOpenRepository(), sdaiAccessModel()), however they are available for direct access for those cases where the application needs to examine the internals of the SDAI. Instances of entities in the SDAI schemas may not be created or modified explicitly using SDAI functions, however instances may be created, deleted or modified implicitly by other SDAI operations.

Session Schema

The session schema describes the state of the SDAI. The entities in the session schema represent global data structures in the session. There are also data structures which are associated with specific models. These data definitions can be found in the population schema.

    SCHEMA session_schema;

    REFERENCE FROM parameter_data_schema
      ( entity_instance,
      aggregate_instance );

    USE FROM population_schema;

    (* Access type is identifies the type of access to models, and transactions *)
    TYPE access_type = ENUMERATION OF
      (read_only,
      read_write);
    END_TYPE;

The error_base type is used for event logging. (Event logging is not supported in this implementation, so the error_base type is not used.)

    TYPE error_base = SELECT
      (entity_instance,
      aggregate_instance);
    END_TYPE;

A time stamp is a string in ISO 8601 format which identifies a date and time. It has the format:

    year-month-day T hour:min:second[+-]timezone

Where hour is in 24 hour format, and the timezone is the number of hours difference from Uniersal Time (GMT). For example, 2:46 PM on September 10, 1997 in the Eastern Time zone of the United States would be written as:

    1997-9-10T14:46:32+06

In EXPRESS, a time stamp is defined by the time_stamp type.

    TYPE time_stamp = STRING(256);
    END_TYPE;

The sdai_session entity provides access to all objects in the session. There is exactly one instance of sdai_session within an SDAI session. This instance is known as the session object, and is created and returned by the sdaiOpenSession() function.

    ENTITY sdai_session;
      sdai_implementation : implementation; 
      recording_active    : BOOLEAN;  (* always false in this implementation*)
      errors              : LIST [0:?] OF error_event; (* always unset *)
      known_servers       : SET [1:?] OF sdai_repository; 
      active_servers      : SET [1:?] OF sdai_repository;
      active_models       : SET [1:?] OF sdai_model;
      data_dictionary     : OPTIONAL schema_instance; 
    INVERSE
      active_transaction : SET [0:1] OF sdai_transaction FOR owning_session;
    END_ENTITY;

The implementation entity describes the conformance classes supported by an SDAI implementation.

    ENTITY implementation;
      name                     : STRING;
      level                    : STRING;
      sdai_version             : STRING;
      binding_version          : STRING;
      implementation_class     : INTEGER;
      transaction_level        : INTEGER;
      expression_level         : INTEGER;
      recording_level          : INTEGER;
      scope_level              : INTEGER;
      domain_equivalence_level : INTEGER;
    END_ENTITY;

A repository is a collection of models. A repository always appears in session.known_servers, and appears in session.active_servers when it is open. The actual models can be found in the contents attribute.

    ENTITY sdai_repository;
      name        : STRING;
      contents    : sdai_repository_contents;
      description : STRING;
    INVERSE
      session : sdai_session FOR known_servers;
    UNIQUE
      UR1: name, session;
    END_ENTITY;

    ENTITY sdai_repository_contents;
      models  : SET[0:?] OF sdai_model;
      schemas : SET[0:?] OF schema_instance;
    INVERSE
      repository : sdai_repository FOR contents;
    END_ENTITY;

Transactions are not provided in this implementation, so there will be no instances of sdai_transaction in the session. Instead of transaction, the SDAI library provides the Save and Undo functionality, which makes more sense for filesystem based repositories.

    ENTITY sdai_transaction;
      mode           : access_type;
      owning_session : sdai_session;
    END_ENTITY;

Events are used for logging, which is not supported in this implementation, so there will be no instances of event, or error_event in the session.

    ENTITY event
      ABSTRACT SUPERTYPE OF (error_event);
      function_id : STRING;
      time        : time_stamp;
    END_ENTITY;

    ENTITY error_event
      SUBTYPE OF (event);
      error       : INTEGER;
      description : OPTIONAL STRING;
      base        : OPTIONAL error_base;
    END_ENTITY;

    END_SCHEMA; -- session_schema

Population Schema

The SDAI population schema defines entities that describe the organization of a model. The instances in the population schema are any data that is associated with a model except for the actual instances that the model contains. These definitions describe schema instance, model, scope, and entity extent entities.

    SCHEMA population_schema;

    REFERENCE FROM parameter_data_schema
      ( entity_instance,
        application_instance );

    REFERENCE FROM session_schema
      ( sdai_session,
        sdai_repository,
        access_type,
        time_stamp );

    USE FROM dictionary_schema;

A schema instance is a collection of related models.

    ENTITY schema_instance;
      name              : STRING;
      associated_models : SET [0:?] OF sdai_model;
      native_schema     : schema_definition;
      repository        : sdai_repository;
      change_date       : OPTIONAL time_stamp;
      validation_date   : time_stamp;
      validation_result : LOGICAL;
      validation_level  : INTEGER;
    UNIQUE
      UR1: name, repository;
    WHERE
      WR1: SELF IN SELF.repository.contents.schemas;
    END_ENTITY;

The sdai_model entity defines a model. A model is an application defined collection of instances of entities in a single schema.

    ENTITY sdai_model;
      name              : STRING;
      contents          : sdai_model_contents;
      underlying_schema : schema_definition;
      repository        : sdai_repository;
      change_date       : OPTIONAL time_stamp;
      mode              : OPTIONAL access_type;
    INVERSE
      associated_with : SET [0:?] OF schema_instance FOR associated_models;
    UNIQUE
      UR1: repository, name;
    WHERE
      WR1: SELF IN SELF.repository.contents.models;
    END_ENTITY;

The sdai_model_contents entity provides listings of the entity instances in a model grouped by type.

    ENTITY sdai_model_contents;
      instances         : SET[0:?] OF entity_instance;  
      folders           : SET[0:?] OF entity_extent;
      populated_folders : SET[0:?] OF entity_extent;
    END_ENTITY;

An entity extent contains all the instances of a single type or its subtypes in a specific model. Entity extents can be found in the folders and populated_folders attribute of sdai_model_contents. The sdaiGetEntityExtent() function returns the set of instances in an entity extent (that is, the instances attribute), and in general is a more convenient way to access this data.

    ENTITY entity_extent;
      definition : entity_definition;
      instances  : SET[0:?] OF entity_instance;
    INVERSE 
      owned_by : sdai_model_contents FOR folders;
    END_ENTITY;

Scopes are not supported in this implementation.

    ENTITY scope;
      owner       : application_instance;
      owned       : SET [1:?] OF application_instance;
      export_list : SET [0:?] OF application_instance;
    UNIQUE
      UR1: owner;
    WHERE
      WR2: NOT (owner IN owned);
    END_ENTITY;

    END_SCHEMA; -- population_schema

Parameter Data Schema

The parameter data schema defines entities that are never instantiated, but rather are EXPRESS place holders for the C data types used in an SDAI implementation. Unlike the session, population, and dictionary schemas; attributes of instances defined in the parameter data schema cannot be queried by an SDAI application.

    SCHEMA parameter_data_schema;

    REFERENCE FROM population_schema
      ( schema_instance,
        sdai_model,
        sdai_model_contents );

    REFERENCE FROM session_schema
      ( sdai_repository );

    TYPE primitive = SELECT
      (aggregate_instance,
      assignable_primitive);
    END_TYPE;

    TYPE assignable_primitive = SELECT
      (entity_instance,
      string_value,
      binary_value, 
      integer_value,
      number_value,
      enumeration_value,
      select_value,
      real_value,
      boolean_value,
      logical_value);
    END_TYPE;

    TYPE aggregate_primitive = SELECT
      (aggregate_instance,
      select_aggregate_instance);
    END_TYPE;

    TYPE string_value = STRING;
    END_TYPE;

    TYPE binary_value = BINARY;
    END_TYPE;

    TYPE integer_value = INTEGER;
    END_TYPE;

    TYPE real_value = REAL;
    END_TYPE;

    TYPE number_value = SELECT
      (real_value,
      integer_value);
    END_TYPE;

    TYPE boolean_value = BOOLEAN;
    END_TYPE;

    TYPE logical_value = LOGICAL;
    END_TYPE;

    TYPE bound_instance_value = INTEGER;
    END_TYPE;

    TYPE query_source = SELECT
      (aggregate_instance,
       sdai_model,
       sdai_repository,
       schema_instance) ;
    END_TYPE;

The following description for an iterator is for the EXPRESS models' benefit only and does not represent the SDAI implementation's internal representation of an iterator. In this implementation, an iterator is not an entity instance.

    ENTITY iterator;
      subject        : aggregate_instance;
      current_member : OPTIONAL primitive;
    END_ENTITY;

The entity_instance entity represents an instance of an EXPRESS defined entity. This is equivalent to the SDAI C type SdaiInstance.

    ENTITY entity_instance
      ABSTRACT SUPERTYPE OF (ONEOF(sdai_instance, application_instance));
    END_ENTITY;

The application_instance entity represents the entity instances defined by application specific information models (that is, the application protocols). Except for entities defined in the four SDAI schemas, every instance manipulated by an application is an instance of this entity. Application instances are represented by the C type SdaiAppInstance in the SDAI C binding.

    ENTITY application_instance
      SUBTYPE OF (entity_instance);
    END_ENTITY;

The entity sdai_instance represents those entities defined in the four SDAI schemas.

    ENTITY sdai_instance
      ABSTRACT SUPERTYPE OF (ONEOF(dictionary_instance,
    session_instance))
      SUBTYPE OF (entity_instance);
    END_ENTITY;

The dictionary_instance entity represents an instance of an entity in the SDAI dictionary schema.

    ENTITY dictionary_instance
      SUBTYPE OF (sdai_instance);
    END_ENTITY;

The session_instance entity represents in instance of an entity in the SDAI session schema.

    ENTITY session_instance
      SUBTYPE OF (sdai_instance);
    END_ENTITY;

    ENTITY attribute_value;
    END_ENTITY;

    ENTITY select_value
      SUPERTYPE OF (ONEOF(select_aggregate_instance));
    END_ENTITY;

    ENTITY select_aggregate_instance
      SUBTYPE OF (select_value);
    END_ENTITY;

    ENTITY enumeration_value;
    END_ENTITY;

    ENTITY aggregate_instance
      ABSTRACT SUPERTYPE OF (ONEOF(unordered_collection,
    ordered_collection));
    END_ENTITY;

    ENTITY unordered_collection
      ABSTRACT SUPERTYPE OF (ONEOF(set_instance, bag_instance))
      SUBTYPE OF (aggregate_instance);
    END_ENTITY;

    ENTITY set_instance
      SUBTYPE OF (unordered_collection);
    END_ENTITY;

    ENTITY bag_instance
      SUBTYPE OF (unordered_collection);
    END_ENTITY;

    ENTITY ordered_collection
      ABSTRACT SUPERTYPE OF (ONEOF(list_instance, array_instance))
      SUBTYPE OF (aggregate_instance);
    END_ENTITY;

    ENTITY list_instance
      ABSTRACT SUPERTYPE OF (ONEOF(non_persistent_list_instance,
      schema_defined_list_instance))
      SUBTYPE OF (ordered_collection);
    END_ENTITY;

    ENTITY schema_defined_list_instance
      SUBTYPE OF (list_instance);
    END_ENTITY;

    ENTITY non_persistent_list_instance
      SUBTYPE OF (list_instance);
      contents : LIST[0:?] OF primitive;
    END_ENTITY;

    ENTITY array_instance
      SUPERTYPE OF (ONEOF(application_indexed_array_instance))
      SUBTYPE OF (ordered_collection);
    END_ENTITY;

    ENTITY application_indexed_array_instance
      SUBTYPE OF (array_instance);
    END_ENTITY;

    END_SCHEMA; -- parameter_data_schema

Dictionary Schema

The dictionary schema provides a description of an EXPRESS information model for an SDAI application's benefit. An application may query the dictionary to determine the structure of an information model.

    SCHEMA dictionary_schema;

    TYPE base_type = SELECT
      (simple_type,
      aggregation_type,
      named_type);
    END_TYPE;

    TYPE constructed_type = SELECT
      (enumeration_type,
      select_type);
    END_TYPE;

An underlying_type entity is used to represent the underlying type of a defined type.

    TYPE underlying_type = SELECT
      (simple_type,
      aggregation_type,
      defined_type,
      constructed_type);
    END_TYPE;

The type_or_rule type is used by the entities implicit_item_id and where_rule.

    TYPE type_or_rule =  SELECT
      (named_type,
      global_rule);
    END_TYPE;

The explicit_or_derived type is used to define which attribute is being redeclared by a derived attribute (see derived_attribute).

    TYPE explicit_or_derived = SELECT
      (explicit_attribute,
      derived_attribute);
    END_TYPE;

The type express_id represents a string which is used as an EXPRESS identifier. Instances of express_id are used to specify the names of entities, types, rules and attributes.

    TYPE express_id = STRING;
    END_TYPE;

An info_object_id is used to provide a full description of an EXPRESS information model. This description is defined in the ISO document describing the AP.

    TYPE info_object_id = STRING;
    END_TYPE;

A schema_definition entity instance contains all the information about a single schema. Every entity, type and rule in a schema refers to the corresponding schema_definition. An instance of this type is returned by the function sdaiGetSchema().

    ENTITY schema_definition;
      name           : express_id;
      identification : OPTIONAL info_object_id;
    INVERSE 
      entities         : SET [0:?] OF entity_definition FOR parent_schema;
      types            : SET [0:?] OF defined_type FOR parent_schema;
      global_rules     : SET [0:?] OF global_rule FOR parent_schema;
      external_schemas : SET [0:?] OF external_schema FOR native_schema;
    UNIQUE
      UR1 : identification;
    END_ENTITY;

These next few entities can be used to determine which entities have been interfaced from other schemas (with USE and REFERENCE).

    ENTITY interface_specification;
      current_schema_id : express_id;
      explicit_items    : SET [1:?] OF explicit_item_id;
      implicit_items    : SET [0:?] OF implicit_item_id;
    END_ENTITY;

    ENTITY interfaced_item
      ABSTRACT SUPERTYPE OF (ONEOF (explicit_item_id,
    implicit_item_id));
      foreign_schema_id : express_id;
    END_ENTITY;

    ENTITY explicit_item_id
      ABSTRACT SUPERTYPE OF (ONEOF (used_item, referenced_item))
      SUBTYPE OF ( interfaced_item );
      local_definition : named_type;
      original_id      : OPTIONAL express_id;
    END_ENTITY;

    ENTITY used_item
      SUBTYPE OF ( explicit_item_id );
    END_ENTITY;

    ENTITY referenced_item
      SUBTYPE OF ( explicit_item_id );
    END_ENTITY;

    ENTITY implicit_item_id
      SUBTYPE OF ( interfaced_item );
      local_definition : type_or_rule;
    END_ENTITY;

    ENTITY external_schema;
      name          : express_id;
      native_schema : schema_definition;
    INVERSE
      for_types : SET [1:?] OF domain_equivalent_type FOR owner;
    END_ENTITY;

The domain_equivalent_type entity is used to capture domain equivalence information. In this implementation, the entity will never be instantiated.

    ENTITY domain_equivalent_type;
      external_type_id : express_id;
      native_type      : named_type;
      owner            : external_schema;
    END_ENTITY;

The named_type entity represents the named types in EXPRESS. This entity is the super type, of SELECTs, defined types, and entity definition.

    ENTITY named_type
      ABSTRACT SUPERTYPE OF (ONEOF(entity_definition, defined_type));
      name          : express_id;
      where_rules   : LIST [0:?] OF where_rule;
      parent_schema : schema_definition;
    END_ENTITY;

A defined_type entity instance represents the EXPRESS TYPE statement.

    ENTITY defined_type
      SUBTYPE OF (named_type);
      domain : underlying_type;
    END_ENTITY;

An entity_definition describes the structure on an entity. Note, however, that the list is attributes is declared as an INVERSE. This means that there is no way to determine the order that the attributes were defined in the original EXPRESS schema or a Part 21 file. If you need this information, you can use _sdaiGetAllAttrDefinitions().

    ENTITY entity_definition
      SUBTYPE OF (named_type);
      supertypes   : LIST [0:?] OF UNIQUE entity_definition;
      complex      : BOOLEAN;
      instantiable : BOOLEAN;
      independent  : BOOLEAN;
    INVERSE
      attributes       : SET [0:?] OF attribute FOR parent_entity;
      uniqueness_rules : SET [0:?] OF uniqueness_rule FOR
    parent_entity;
      global_rules     : SET [0:?] OF global_rule FOR entities;
    END_ENTITY;

The attribute entity describes a single attribute of an instance. An instance of the attribute type corresponds to the C type SdaiAttr.

    ENTITY attribute
      ABSTRACT SUPERTYPE OF (ONEOF(derived_attribute,
    explicit_attribute,
       inverse_attribute));
      name          : express_id;
      parent_entity : entity_definition;
    END_ENTITY;

There are three subtypes of attribute. Each defines a specific type of attribute - derived, explicit, or inverse.

    ENTITY derived_attribute
      SUBTYPE OF (attribute);
      domain      : base_type;
      redeclaring : OPTIONAL explicit_or_derived;
    END_ENTITY;

    ENTITY explicit_attribute
      SUBTYPE OF (attribute);
      domain        : base_type;
      redeclaring   : OPTIONAL explicit_attribute;
      optional_flag : BOOLEAN;
    END_ENTITY;

    ENTITY inverse_attribute
      SUBTYPE OF (attribute);
      domain          : entity_definition;
      redeclaring     : OPTIONAL inverse_attribute;
      inverted_attr   : explicit_attribute;
      min_cardinality : OPTIONAL bound;
      max_cardinality : OPTIONAL bound;
      duplicates      : BOOLEAN;
    END_ENTITY;

A uniqueness_rule entity represents an EXPRESS uniqueness rule.

    ENTITY uniqueness_rule;
      label         : OPTIONAL express_id;
      attributes    : LIST [1:?] OF attribute;
      parent_entity : entity_definition;
    END_ENTITY;

A where_rule entity represents an EXPRESS where rule. The actual definition of the rule is not included here, but is stored internally by the implementation.

    ENTITY where_rule;
      label       : OPTIONAL express_id;
      parent_item : type_or_rule;
    END_ENTITY;

A global_rule entity represents an EXPRESS global rule. The actual definition of the rule is not included here, but is stored internally by the implementation.

    ENTITY global_rule;
      name          : express_id;
      entities      : LIST [1:?] OF entity_definition;
      where_rules   : LIST [1:?] OF where_rule; 
      parent_schema : schema_definition;
    END_ENTITY;

The simple_type entity an its subtypes define the EXPRESS simple types.

    ENTITY simple_type
      ABSTRACT SUPERTYPE OF (ONEOF(integer_type, real_type,
    string_type,
       binary_type, logical_type, boolean_type, number_type));
    END_ENTITY;

    ENTITY number_type
      SUBTYPE OF (simple_type);
    END_ENTITY;

    ENTITY integer_type
      SUBTYPE OF (simple_type);
    END_ENTITY;

    ENTITY real_type
      SUBTYPE OF (simple_type);
      precision : OPTIONAL bound;
    END_ENTITY;

    ENTITY string_type
      SUBTYPE OF (simple_type);
      width       : OPTIONAL bound;
      fixed_width : BOOLEAN;
    END_ENTITY;

    ENTITY binary_type
      SUBTYPE OF (simple_type);
      width       : OPTIONAL bound;
      fixed_width : BOOLEAN;
    END_ENTITY;

    ENTITY logical_type
      SUBTYPE OF (simple_type);
    END_ENTITY;

    ENTITY boolean_type
      SUBTYPE OF (simple_type);
    END_ENTITY;

The enumeration_type entity represents an express enumeration.

    ENTITY enumeration_type;
      elements : LIST [1:?] OF UNIQUE express_id;
    END_ENTITY;

The select_type entity represents an EXPRESS defined SELECT.

    ENTITY select_type;
      selections : SET [1:?] OF named_type;
    END_ENTITY;

The aggregation_type entity and its subtypes define the various kinds of aggregates that can be represented in EXPRESS.

    ENTITY aggregation_type
      ABSTRACT SUPERTYPE OF (ONEOF(variable_size_aggregation_type,
    array_type));
      element_type : base_type;
    END_ENTITY;

    ENTITY variable_size_aggregation_type
      ABSTRACT SUPERTYPE OF (ONEOF(set_type, bag_type, list_type))
      SUBTYPE OF (aggregation_type);
      lower_bound : bound;
      upper_bound : OPTIONAL bound;
    END_ENTITY;

    ENTITY set_type
      SUBTYPE OF (variable_size_aggregation_type);
    END_ENTITY;

    ENTITY bag_type
      SUBTYPE OF (variable_size_aggregation_type);
    END_ENTITY;

    ENTITY list_type
      SUBTYPE OF (variable_size_aggregation_type);
      unique_flag : BOOLEAN;
    END_ENTITY;

    ENTITY array_type
      SUBTYPE OF (aggregation_type);
      lower_index   : bound;
      upper_index   : bound;
      unique_flag   : BOOLEAN;
      optional_flag : BOOLEAN;
    END_ENTITY;

The bound entity and its subtypes are used to represent the lengths of strings and binaries, and the size of aggregates. If the bound is of constant size it is implemented as an instance of integer_bound; if the bound is dependent on some EXPRESS defined expression, it is instantiated as a population_dependent_bound.

    ENTITY bound
      ABSTRACT SUPERTYPE OF (ONEOF(integer_bound,
    population_dependent_bound));
    END_ENTITY;

    ENTITY population_dependent_bound
      SUBTYPE OF (bound);
    END_ENTITY;

    ENTITY integer_bound
      SUBTYPE OF (bound);
      bound_value : INTEGER;
    END_ENTITY;

    END_SCHEMA;