Previous Topic: ASN.1 Type Assignments

Next Topic: Referencing Logical Data Structures from NCL

Defining the Logical Structure of Data

Mapping Services uses ASN.1 as the source language for describing the logical structure of data. Any number of ASN.1 type assignments can be combined to form a map. Such a map is capable of describing a single data unit, or any number of differing data units. However the component that is associated with the map itself (and not structures defined within the map) must be defined as a single user type.

This is best explained by way of an example. Consider a Customer Order file that contains two types of record. One record type is called CustomerDetail and it contains customer specific information, such as name, address, contact, and so on. For each record of this type there are zero or more records of a type called OrderDetail, each of which contains specific order details related to the customer. The CustomerDetail and OrderDetail records are quite different so you could choose to use a separate map for each, but equally you can specify them in a single map as follows.

The map for the file is defined as being of type CustomerOrder. This is a user defined ASN.1 type, so a type assignment for CustomerOrder must form part of the source definition for the map. It need not be the first type assignment in the source definition but it is usually convenient in understanding the map definition if it is.

Since, in the above example, there are two types of possible record on the file, the CustomerOrder type assignment is best described by the ASN.1 type CHOICE. Its ASN.1 language definition might look like:

CustomerOrder ::= CHOICE {
        customer  CustomerDetail
        order     OrderDetail }

This means that the type CustomerOrder is a choice of either a component named customer which is of type CustomerDetail, or a component named order which is of type OrderDetail. Hence, although we have a map which consists of a single type, it immediately diverges into the two possible different record types that the file can contain. Subsequent type assignments specify the nature of CustomerDetail and OrderDetail. These are likely to be structures themselves, for example:

CustomerDetail ::= SEQUENCE {
        name      GraphicString
        address   Address
        openOrdersINTEGER }
Address ::= SEQUENCE {
        number    INTEGER
        street    GraphicString
        suburb    GraphicString }

and hence can contain either simple data items, such as openOrders and name, that are defined as the ASN.1 basic types INTEGER and GraphicString, or constructed data items such as address, which is of a user defined type Address. Eventually, through further type assignments, such as the one for the type Address shown, all structures are defined down to their elementary components.