Errata exists for this version of the document.

This annex defines a way to provide encoding information for custom DataTypes. In previous releases of the specification this approach was defined in OPC 10000-3. In OPC 10000-3 a simplified approach is now defined having a DataTypeDefinition Attribute on the DataType Node. The approach using DataTypeDictionaries is provided for backwards compatibility and in case some specific requirements cannot be fulfilled with the simplified approach. It is recommended to only use the approach using the DataTypeDefinition Attribute.

OPC 10000-3 defines the data type model. A DataType points to one or several DataTypeEncoding Objects. The approach of DataTypeDictionaries extends this model (see Figure D.1). The DataTypeEncoding Object points to exactly one Variable of type DataTypeDescriptionType. The DataTypeDescription Variable belongs to a DataTypeDictionary Variable.

image028.png

Figure D.1 – DataType Model

The DataTypeDictionary describes a set of DataTypes in sufficient detail to allow Clients to parse/interpret Variable Values that they receive and to construct Values that they send. The DataTypeDictionary is represented as a Variable of type DataTypeDictionaryType in the AddressSpace, the description about the DataTypes is contained in its Value Attribute. All containing DataTypes exposed in the AddressSpace are represented as Variables of type DataTypeDescriptionType. The Value of one of these Variables identifies the description of a DataType in the Value Attribute of the DataTypeDictionary.

The DataType of a DataTypeDictionary Variable is always a ByteString. The format and conventions for defining DataTypes in this ByteString are defined by DataTypeSystems. DataTypeSystems are identified by NodeIds. They are represented in the AddressSpace as Objects of the ObjectType DataTypeSystemType. Each Variable representing a DataTypeDictionary references a DataTypeSystem Object to identify their DataTypeSystem.

A client shall recognise the DataTypeSystem to parse any of the type description information. OPC UA Clients that do not recognise a DataTypeSystem will not be able to interpret its type descriptions, and consequently, the values described by them. In these cases, Clients interpret these values as opaque ByteStrings.

OPC Binary and W3C XML Schema are examples of DataTypeSystems. The OPC Binary DataTypeSystem is defined in Annex E. OPC Binary uses XML to describe binary data values. W3C XML Schema is specified in REF XMLSchema1 \h XML Schema Part 1 and REF XMLSchema2 \h XML Schema Part 2.

A DataTypeDictionary is an entity that contains a set of type descriptions, such as an XML schema. DataTypeDictionaries are defined as Variables of the VariableType DataTypeDictionaryType.

A DataTypeSystem specifies the format and conventions for defining DataTypes in DataTypeDictionaries. DataTypeSystems are defined as Objects of the ObjectType DataTypeSystemType.

The ReferenceType used to relate Objects of the ObjectType DataTypeSystemType to Variables of the VariableType DataTypeDictionaryType is the HasComponent ReferenceType. Thus, the Variable is always the TargetNode of a HasComponent Reference; this is a requirement for Variables. However, for DataTypeDictionaries the Server shall always provide the inverse Reference, since it is necessary to know the DataTypeSystem when processing the DataTypeDictionary.

Changes may be a result of a change to a type description, but it is more likely that dictionary changes are a result of the addition or deletion of type descriptions. This includes changes made while the Server is offline so that the new version is available when the Server restarts. Clients may subscribe to the DataTypeVersion Property to determine if the DataTypeDictionary has changed since it was last read.

The Server may, but is not required to, make the DataTypeDictionary contents available to Clients through the Value Attribute. Clients should assume that DataTypeDictionary contents are relatively large and that they will encounter performance problems if they automatically read the DataTypeDictionary contents each time they encounter an instance of a specific DataType. The client should use the DataTypeVersion Property to determine whether the locally cached copy is still valid. If the client detects a change to the DataTypeVersion, then it shall re-read the DataTypeDictionary. This implies that the DataTypeVersion shall be updated by a Server even after restart since Clients may persistently store the locally cached copy.

The Value Attribute of the DataTypeDictionary containing the type descriptions is a ByteString whose formatting is defined by the DataTypeSystem. For the “XML Schema” DataTypeSystem, the ByteString contains a valid XML Schema document. For the “OPC Binary” DataTypeSystem, the ByteString contains a string that is a valid XML document. The Server shall ensure that any change to the contents of the ByteString is matched with a corresponding change to the DataTypeVersion Property. In other words, the client may safely use a cached copy of the DataTypeDictionary, as long as the DataTypeVersion remains the same.

DataTypeDictionaries are complex Variables which expose their DataTypeDescriptions as Variables using HasComponent References. A DataTypeDescription provides the information necessary to find the formal description of a DataType within the DataTypeDictionary. The Value of a DataTypeDescription depends on the DataTypeSystem of the DataTypeDictionary. When using “OPC Binary” dictionaries the Value shall be the name of the TypeDescription. When using “XML Schema” dictionaries the Value shall be an Xpath expression (see XPATH) which points to an XML element in the schema document.

Like DataTypeDictionaries each DataTypeDescription provides the Property DataTypeVersion indicating whether the type description of the DataType has changed. Changes to the DataTypeVersion may impact the operation of Subscriptions. If the DataTypeVersion changes for a Variable that is being monitored for a Subscription and that uses this DataTypeDescription, then the next data change Notification sent for the Variable will contain a status that indicates the change in the DataTypeDescription.

DataTypeEncoding Objects of the DataTypes reference their DataTypeDescriptions of the DataTypeDictionaries using HasDescription References. Servers shall provide the inverse References that relate the DataTypeDescriptions back to the DataTypeEncoding Objects. If a DataType Node is exposed in the AddressSpace, it shall provide its DataTypeEncodings and if a DataTypeDictionary is exposed then it should expose all of its DataTypeDescriptions. Both of these References shall be bi-directional.

Figure D.2 provides an example how DataTypes are modelled in the AddressSpace.

image029.png

Figure D.2 – Example of DataType Modelling

In some scenarios an OPC UA Server may have resource limitations which make it impractical to expose large DataTypeDictionaries. In these scenarios the Server may be able to provide access to descriptions for individual DataTypes even if the entire dictionary cannot be read. For this reason, this standard defines a Property for the DataTypeDescription called DictionaryFragment. This Property is a ByteString that contains a subset of the DataTypeDictionary which describes the format of the DataType associated with the DataTypeDescription. Thus, the Server splits the large DataTypeDictionary into several small parts and Clients can access without affecting the overall system performance.

However, Servers should provide the whole DataTypeDictionary at once if this is possible. It is typically more efficient to read the whole DataTypeDictionary at once instead of reading individual parts.

In 8.2.9 the standard Object is introduced as entry point for DataTypes that the Server wishes to expose in the AddressSpace. When using DataTypeSystems and DataTypeDictionaries those Nodes can be referenced by this Object as well. The standard Object uses Organizes References to reference Objects of the DataTypeSystemType representing DataTypeSystems. Referenced by those Objects are DataTypeDictionaries that refer to their DataTypeDescriptions. However, it is not required to provide the DataTypeSystem Objects, and the DataTypeDictionary need not to be provided.

Because DataTypes are not related to DataTypeDescriptions using hierarchical References, DataType Nodes should be made available using Organizes References pointing either directly from the “DataTypes” Object to the DataType Nodes or using additional Folder Objects for grouping purposes. The intent is that all DataTypes of the Server exposed in the AddressSpace are accessible following hierarchical References starting from the “DataTypes” Object. However, this is not required.

Figure D.3 illustrates this hierarchy using the “OPC Binary” and “XML Schema” standard DataTypeSystems as examples. Other DataTypeSystems may be defined under this Object.

image030.png

Figure D.3 – DataTypes Organization

Each DataTypeSystem Object is related to its DataTypeDictionary Nodes using HasComponent References. Each DataTypeDictionary Node is related to its DataTypeDescription Nodes using HasComponent References. These References indicate that the DataTypeDescriptions are defined in the dictionary.

In the example, the “DataTypes” Object references the DataType “Int32” using an Organizes Reference. The DataType uses the non-hierarchical HasEncoding Reference to point to its default encoding, which references a DataTypeDescription using the non-hierarchical HasDescription Reference.

In case DataTypeSystems are used, the standard Objects “OPC Binary” and “XML Schema” defined in D.5.5 and D.5.6 are connected via a Organizes Reference from the “DataTypes” Object.

The HasDescription ReferenceType is a concrete ReferenceType and can be used directly. It is a subtype of NonHierarchicalReferences.

The semantic of this ReferenceType is to reference the DataTypeDescription of a DataTypeEncoding.

The SourceNode of References of this type shall be an Object of the ObjectType DataTypeEncodingType or one of its subtypes.

The TargetNode of this ReferenceType shall be a Variable of the VariableType DataTypeDescriptionType or one of its subtypes.

Its representation in the AddressSpace is specified in Table D.1.

Table D.1 – HasDescription ReferenceType

Attributes

Value

BrowseName

HasDescription

InverseName

DescriptionOf

Symmetric

False

IsAbstract

False

References

NodeClass

BrowseName

Comment

The DataTypeDictionaryType VariableType is used as the type for the DataTypeDictionaries. It is formally defined in Table D.2.

Table D.2 – DataTypeDictionaryType Definition

Attribute

Value

BrowseName

DataTypeDictionaryType

IsAbstract

False

ValueRank

−1 (−1 = Scalar)

DataType

ByteString

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the BaseDataVariableType defined in 7.4.

HasProperty

Variable

DataTypeVersion

String

PropertyType

Optional

HasProperty

Variable

NamespaceUri

String

PropertyType

Optional

HasProperty

Variable

Deprecated

Boolean

Property Type

Optional

The Property DataTypeVersion is explained in D.3.

The NamespaceUri is the URI for the namespace described by the Value Attribute of the DataTypeDictionary. This is not always the same as the NamespaceUri of the DataType NodeId.

The Deprecated Property is used to indicate that all of the DataType definitions represented by the DataTypeDictionaryType are available through a DataTypeDefinition Attribute. Servers that provide DataType definitions as a DataTypeDefinition Attribute and through a DataTypeDictionaryType shall expose this Property.

The DataTypeDescriptionType VariableType is used as the type for the DataTypeDescriptions. It is formally defined in Table D.3.

Table D.3 – DataTypeDescriptionType Definition

Attribute

Value

BrowseName

DataTypeDescriptionType

IsAbstract

False

ValueRank

-1 (-1 = Scalar)

DataType

String

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the BaseDataVariableType defined in 7.4.

HasProperty

Variable

DataTypeVersion

String

PropertyType

Optional

HasProperty

Variable

DictionaryFragment

ByteString

PropertyType

Optional

The Properties DataTypeVersion and DictionaryFragment are explained in D.3.

The DataTypeSystems ObjectType is used as type for the DataTypeSystems. There are no References specified for this ObjectType. It is formally defined in Table D.4.

Table D.4 – DataTypeSystemType Definition

Attribute

Value

BrowseName

DataTypeSystemType

IsAbstract

False

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the BaseObjectType defined in 6.2.

OPC Binary is a standard DataTypeSystem defined by OPC. It is represented in the AddressSpace by an Object Node. The OPC Binary DataTypeSystem is defined in OPC 10000-3. OPC Binary uses XML to describe complex binary data values. The “OPC BinaryObject is formally defined in Table D.5.

Table D.5 – OPC Binary Definition

Attribute

Value

BrowseName

OPC Binary

References

NodeClass

BrowseName

Comment

HasTypeDefinition

ObjectType

DataTypeSystemType

Defined in D.5.4

XML Schema is a standard DataTypeSystem defined by the W3C. It is represented in the AddressSpace by an Object Node. XML Schema documents are XML documents whose xmlns attribute in the first line is:

schema xmlns =http://www.w3.org/1999/XMLSchema

The “XML SchemaObject is formally defined in Table D.6.

Table D.6 – XML Schema Definition

Attribute

Value

BrowseName

XML Schema

References

NodeClass

BrowseName

Comment

HasTypeDefinition

ObjectType

DataTypeSystemType

Defined in D.5.4