SWE Common Data Model OGC 08-094r1
This encoding method is used when compactness is not an issue and a high level of readability and error detection is required. Furthermore, a data stream encoded in this
way can be easily transformed and formatted using XSLT like languages.
The main drawback of this method is the verbosity and high degree of redundancy of the information contained in the stream due to the repetitive XML tags. This problem can be
minimized by compressing the XML data using well known techniques such as GZIP or BZIP, but such an approach may not be viable in the case of streaming e.g. real time
data.
Copyright © 2011 Open Geospatial Consortium
61
OGC 08-094r1 SWE Common Data Model
7.7 Requirements Class: Advanced Encodings Package Requirements Class
http:www.opengis.netspecSWE2.0requml-advanced-encodings
Target Type Software Implementation or Encoding of the Conceptual Models
Dependency
http:www.opengis.netspecSWE2.0requml-simple-encodings
This package defines an additional encoding method for packaging sensor data as raw or base 64 binary blocks. When this package is implemented, the binary encoding method is
usable, as any other encoding method, within the “DataArray” and “DataStream” classes.
Requirement
http:www.opengis.netspecSWE2.0requml-advanced-encodingsdependency-simple-encodings
Req 55. An encoding or software passing the “Advanced Encodings UML Package”
conformance test class shall first pass the “Simple Encodings UML Package”
conformance test class.
Requirement
http:www.opengis.netspecSWE2.0requml-advanced-encodingspackage-fully-implemented
Req 56. The encoding or software shall correctly implement all UML classes defined
in the “Advanced Encodings” package.
7.7.1 BinaryEncoding Class
The “BinaryEncoding” class defines a method that allows encoding complex structured data using primitive data types encoded directly at the byte level, in the same way that
they are usually represented in memory.
The binary encoding method can lead to very compact streams that can be optimized for efficient parsing and fast random access. However this comes with the lack of human
readability of the data and sometimes lack of compatibility with other software i.e. software that is not SWE Common enabled.
More information is needed to fully define a binary encoding, so the model is more complex than the other encodings. It is shown below:
62
Copyright © 2011 Open Geospatial Consortium
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