BinaryEncoding Class Requirements Class: Advanced Encodings Package Requirements Class
SWE Common Data Model OGC 08-094r1
AbstractEncoding «Type»
BinaryEncoding
«Enumeration»
ByteEncoding
«Enumeration»
ByteOrder
«Type»
Component
«property» + ref:
CharacterString + dataType:
ScopedName + byteLength: Integer [0..1]
+ bitLength: Integer [0..1] + significantBits: Integer [0..1]
+ encryption: ScopedName [0..1] «Type»
Block
«property» + ref:
CharacterString + byteLength: Integer [0..1]
+ paddingBytes-before: Integer [0..1] + paddingBytes-after: Integer [0..1]
+ encryption: ScopedName [0..1] + compression: ScopedName [0..1]
«Union»
ComponentOrBlock
«property» + byComponent:
Component + byBlock:
Block «property»
+ byteLength: Integer [0..1] + byteEncoding:
ByteEncoding + byteOrder:
ByteOrder + member: ComponentOrBlock [1..]
«property» «property»
+ raw: CharacterString
+ base64: CharacterString
+ bigEndian: CharacterString
+ littleEndian: CharacterString
Figure 7.35 – BinaryEncoding Class
The main class “BinaryEncoding” specifies overall characteristics of the encoded byte stream such as the byte order big endian or little endian and the byte encoding raw or
base64. The two corresponding attributes, respectively “byteOrder” and “byteEncoding” are mandatory. Base64 encoding is usually chosen to insert binary content within an
XML document.
The “byteLength” attribute is optional and can be used to specify the overall length of the encoded data as a total number of bytes. This should be indicated whenever possible if
the data size is known in advance as it can be useful for efficient memory allocation.
The “BinaryEncoding” class also has several “member” attributes that contain detailed information about parts of the data stream. This attribute can take a choice of instance of
two classes: “Component” or “Block”.
The “Component” class is used to specify binary encoding details of a given scalar component in the stream. The following information can be provided for each scalar
field:
- The “ref” attribute allows identifying the data component in the dataset structure
for which we’re specifying the encoding parameters. Soft-typed property names are used to uniquely identify a given component in the tree.
- The “dataType” attribute allows selecting a data type among commonly accepted
ones such as ‘byte’, ‘short’, ‘int’, ‘long’, ‘double’, ‘float’, ‘string’, etc… -
The “byteLength” or “bitLength” attributes are mutually exclusive and used to further specify the length of the data type in the case where it is not a standard
Copyright © 2011 Open Geospatial Consortium
63
OGC 08-094r1 SWE Common Data Model
length i.e. to encode integer numbers on more than 8 bytes or less than 8 bits for instance.
- The “significantBits” can be used to signal that only some of the bits of the data
type are actually used to carry the value i.e. a value may be encoded as a byte but only use 4 bits to encode a value between 0 and 15. This is mostly informational.
- The “encryption” attribute can be used to select the method with which the value is
encrypted before being written to the stream. The “Block” class is used to specify binary encoding details of a given aggregate
component representing a block of values in the data stream. This is used either to specify padding before andor after a block of data or to enable compression or encryption of all
or part of a dataset.
- The “ref” attribute allows identifying the data component in the dataset structure
for which we’re specifying the encoding parameters. Soft-typed property names are used to uniquely identify a given component in the tree.
- The optional “byteLength” attribute allows indicating the overall length of the
encoded block to facilitate memory allocation. -
The “paddingBytes-before” and “paddingBytes-after” are used to specify the number of empty bytes i.e. usually 0 bytes that are inserted in the stream
respectively before and after data for the referenced component. This is sometimes used to align data on N-bytes block for faster access.
- The “encryption” attribute identifies the encryption method that is used to encrypt
the block of data before it is inserted in the stream. -
The “compression” attribute identifies the compression method that is used to compress the block of data before it is inserted in the stream.
This standard does not define any concrete encryption and compression methods, so that software implementations of this requirement class are not required to support any value
in the “encryption” and “compression” attributes of the “Component” and “Block” classes. Extensions of this standard that define binary encryption and compression
methods shall describe how the encrypted or compressed data is inserted in the SWE Common data stream.
64
Copyright © 2011 Open Geospatial Consortium
SWE Common Data Model OGC 08-094r1
8 XML Implementation normative
This standard defines a normative XML grammar and a set of patterns that define an XML implementation of the conceptual models presented in section 7. The
standardization target type for all requirements classes in this clause is an XML instance that seeks compliance with this XML encoding model.
XML schemas defined in this section are a direct implementation of the UML conceptual models described in clause 7. They have been automatically generated from these models
by strictly following well-defined encoding rules described in Annex C. All attributes and compositionaggregation associations contained in the UML models are encoded either as
XML elements or XML attributes but the names are fully consistent. One XML schema file is produced for each UML package.
Schematron patterns implement most additional requirements stated in clause 7. One Schematron file is produced for each UML package.
All example instances given in this section are informative and are used solely for illustrating features of the normative model. Many of these examples reference semantic
information by using URLs that are resolvable to definitions maintained in one of several online ontologies:
- The OGC online registry at
http:www.opengis.netdef .
- The SWEET ontology maintained by NASA JPL at
http:sweet.jpl.nasa.gov2.0 .
- The MMI ontology registry and repository at
http:mmisw.orgorr .
All XML examples are marked by a light gray background and formatted with a fixed- width font.
Copyright © 2011 Open Geospatial Consortium
65
OGC 08-094r1 SWE Common Data Model