OGC 08-094r1 SWE Common Data Model
swe:encoding swe:values
TEMP,2009-05-23T19:36:15Z,25.5 TEMP,2009-05-23T19:37:15Z,25.6
WIND,2009-05-23T19:37:17Z,56.3,226.3 TEMP,2009-05-23T19:38:15Z,25.5
swe:values swe:DataStream
This data stream interleaves different types of messages separated by the block separator character. The element type is a “DataChoice” which means that each block is composed
of the item name ‘TEMP’ or ‘WIND’ highlighted in yellow, followed by values of the item. This example also demonstrates that items of a choice can be of different types and
length.
9.2.6 Rules for DataArray and Matrix
Values of each “DataArray” or “Matrix” element are recursively encoded following rules associated to the type of component used for the element type i.e. scalar, record, array,
etc.. Groups of values or single value in the case of a scalar element type corresponding to each element are sequentially appended to the data block and separated
by token or block separators, depending on the context: When the “DataArray” is the root of the component tree that is being encoded, its elements are separated by block
separators, otherwise its elements are separated by token separators.
A “DataArray” or “Matrix” can have a fixed or variable size, which leads to two slightly different syntaxes for encoding values:
array-separator = token-separator block-separator ; block-separator is only used when the array is the root of the component tree whose values are being encoded.
array-values = fixed-size-array-values variable-size-array-values
Fixed size arrays have a size of at least one, and are encoded as defined below:
fixed-element-count = Number of elements in a fixed size array minus one. Greater or equal to 0 since fixed size is always at least one
element-values = scalar-value range-values record-values choice-values array-values fixed-size-array-values = element-values fixed-element-countarray-separator element-values
The following example illustrates how values of a fixed size 3x3 stress matrix can be text encoded:
swe:Matrix definition
= http:sweet.jpl.nasa.gov2.0physPressure.owlStress
swe:elementCount swe:Count
swe:value 3
swe:value swe:Count
swe:elementCount swe:elementType
name =
row swe:Matrix
definition =
http:sweet.jpl.nasa.gov2.0info.owlRow swe:elementCount
swe:Count
124
Copyright © 2011 Open Geospatial Consortium
SWE Common Data Model OGC 08-094r1
swe:value 3
swe:value swe:Count
swe:elementCount swe:elementType
name =
coef swe:Quantity
definition =
http:sweet.jpl.nasa.gov2.0mathVector.owlCoordinate swe:uom
code =
MPa swe:Quantity
swe:elementType swe:Matrix
swe:elementType swe:encoding
swe:TextEncoding blockSeparator
= tokenSeparator
= ,
swe:encoding swe:values
0.36,0.48,-0.8 -0.8,0.6,0.0 0.48,0.64,0.6 swe:values
swe:Matrix
Note that elements of the outer array i.e. a matrix is a special kind of array are separated by block separators i.e. each block surrounded by spaces corresponds to one row of the
matrix while the inner array elements are separated by token separators.
When a “DataArray” “Matrix” is defined as variable size, its size can be 0 and the array size is included as a token in the data block, before the actual array elements values are
listed:
variable-element-count = Number of elements in a variable size array. Greater or equal to 0 since variable size can be 0 for an empty array
variable-size-array-values = variable-element-count variable-element-countarray-separator element- values
The following example shows how SWE Common can be used to encode a series of irregular length profiles by using a variable size array:
swe:DataStream swe:elementType
name =
profileData swe:DataRecord
swe:field name
= time
swe:Time definition
= http:www.opengis.netdefpropertyOGC0SamplingTime
swe:label Sampling Time
swe:label swe:uom
xlink:href =
http:www.opengis.netdefuomISO-86010Gregorian swe:Time
swe:field swe:field
name =
profilePoints swe:DataArray
definition =
http:sweet.jpl.nasa.gov2.0info.owlProfile swe:elementCount
swe:Count swe:elementCount
swe:elementType name
= point
swe:DataRecord swe:field
name =
depth swe:Quantity
definition =
http:mmisw.orgontcfparameterdepth swe:label
Sampling Point Vertical Location swe:label
swe:uom code
= m
swe:Quantity swe:field
swe:field name
= salinity
swe:Quantity definition
= http:mmisw.orgontcfparametersea_water_salinity
swe:label Salinity
swe:label swe:uom
code =
[ppth] swe:Quantity
swe:field swe:DataRecord
swe:elementType swe:DataArray
Copyright © 2011 Open Geospatial Consortium
125