SWE Common Data Model OGC 08-094r1
9.2 Requirements Class: Text Encoding Rules Requirements Class
http:www.opengis.netspecSWE2.0reqtext-encoding-rules
Target Type Encoded Values Instance
Dependency
http:www.opengis.netspecSWE2.0requml-simple-encodings
Dependency
http:www.opengis.netspecSWE2.0reqgeneral-encoding-rules
The “TextEncoding” method encodes field values especially numbers by their text representation. Special characters provide a way to separate successive values and
successive blocks. The ABNF syntax defined in IETF RFC 5234 is used to formalize the encoding rules, and thus all ABNF snippets provided in this section are normative.
Requirement
http:www.opengis.netspecSWE2.0reqtext-encodings-rulesabnf-syntax-valid
Req 90. The encoded values block shall be formatted as defined by the ABNF
grammar defined in this clause.
9.2.1 Separators
Token separators are used between single values and the block separator is used at the end of each block. The block corresponds to one element of the “DataArray” or
“DataStream” carrying the “values” element in which the values are encoded. There are no special separators to delimitate nested records, arrays and choices.
Separators shall be chosen so that nothing in the dataset contains the exact same character sequence as the one chosen for token or block separator.
Requirement
http:www.opengis.netspecSWE2.0reqtext-encoding-rulesseparators-valid
Req 91. Block and token separators used in the “TextEncoding” method shall be
chosen as a sequence of characters that never occur in the data values themselves.
When the attribute “collapseWhiteSpaces” is set to true its default value, all white space characters surrounding the token and block separators shall be ignored. The BNF
grammar for separators is given below:
white-space = d9 d10 d13 d32 ; TAB, LF, CR or SPACE token-separator-chars = Value of the tokenSeparator attribute
Copyright © 2011 Open Geospatial Consortium
119
OGC 08-094r1 SWE Common Data Model
block-separator-chars = Value of the blockSeparator attribute token-separator = [white-space] token-separator-chars [white-space]
block-separator = [white-space] block-separator-chars [white-space]
White spaces around separators are in fact only allowed when the “collapseWhiteSpaces” attribute is set to ‘true’ which is the default.
9.2.2 Rules for Scalar Components
The value for a scalar component is encoded as its text representation, following XML schema datatypes conventions.
scalar-value = xs:bool xs:string xs:double xs:int xs:date xs:dateTime
Nil values are included in the stream just like normal scalar values. Since their data type has to match the field data type, there is no special treatment necessary for a decoder or
encoder. It is the responsibility of the application to match the data value against the list of registered nil values for a given field in order to detect if it is associated to a nil reason
or if it is an actual measurement value.
9.2.3 Rules for Range Components
Range components are encoded as a sequence of two tokens each one representing a scalar value separated by a token separator:
min-value = scalar-value max-value = scalar-value
range-values = min-value token-separator max-value
9.2.4 Rules for DataRecord and Vector
Values of fields of a “DataRecord” are recursively encoded following rules associated to the type of component used for the field’s description i.e. scalar, record, array, etc. and
separated by token separators as expressed by the following grammar:
field-count = Number of fields in the record minus one. Greater or equal to 0 any-field-value = scalar-value range-values record-values choice-values array-values
mandatory-field-value = any-field-value optional-field-value = “Y” token-separator any-field-value “N”
field-value = mandatory-field-value optional-field-value record-values = field-value field-counttoken-separator field-value
120
Copyright © 2011 Open Geospatial Consortium