Rules for DataRecord and Vector
SWE Common Data Model OGC 08-094r1
When a field is marked as optional in the definition, the token ‘Y’ or ‘N’ shall be inserted in the data block. When the field value is omitted, the token ‘N’ is inserted alone. When it
is included, the token ‘Y’ is inserted followed by the actual field value.
Requirement
http:www.opengis.netspecSWE2.0reqtext-encoding-rulesoptional-field-marker-present
Req 92. The ‘Y’ or ‘N’ token shall be inserted in a text encoded data block for all
fields that have the “optional” attribute set to ‘true’.
Coordinate values of “Vector” components are encoded with a similar syntax, but a coordinate value can only be scalar and cannot be omitted:
coord-count = Number of coordinates in the vector minus one. Greater or equal to 0 vector-values = scalar-value coord-counttoken-separator scalar-value
The following example shows how elements of an array defined as a “DataRecord” are encoded with the text method:
swe:DataArray definition
= http:sweet.jpl.nasa.gov2.0mathFunction.owlFunction
swe:description Measurement error vs. temperature
swe:description swe:elementCount
swe:Count swe:value
5 swe:value
swe:Count swe:elementCount
swe:elementType name
= point
swe:DataRecord swe:label
Error vs. Temperature swe:label
swe:field name
= temp
swe:Quantity definition
= http:sweet.jpl.nasa.gov2.0physThermo.owlTemperature
swe:label Temperature
swe:label swe:uom
code =
Cel swe:Quantity
swe:field swe:field
name =
error swe:Quantity
definition =
http:sweet.jpl.nasa.gov2.0sciUncertainty.owlError swe:label
Relative Error swe:label
swe:uom code
= swe:Quantity
swe:field swe:DataRecord
swe:elementType swe:encoding
swe:TextEncoding blockSeparator
= tokenSeparator
= ,
swe:encoding swe:values
0,5 10,2 50,2 80,5 100,15 swe:values
swe:DataArray
In this example, each element consists of a record of two values. The array element structure also corresponds to one block so that tuples are separated by block separators
here the ‘,’ character. Since the array is of size 5, there are 5 tuples listed sequentially in the data block, each one composed of the two values of the data record separated by the
token separator. The pattern is “temp,error temp,error …” since values have to be listed in the same order as the fields.
Copyright © 2011 Open Geospatial Consortium
121
OGC 08-094r1 SWE Common Data Model
The following example shows the resulting encoded block when some of the fields are optional:
swe:DataStream swe:label
Aircraft Navigation swe:label
swe:elementType name
= navData
swe:DataRecord swe:field
name =
time swe:Time
definition =
http:www.opengis.netdefpropertyOGC0SamplingTime referenceFrame
= http:www.opengis.netdeftrsOGC0GPS
swe:uom xlink:href
= http:www.opengis.netdefuomISO-86010Gregorian
swe:Time swe:field
swe:field name
= speed
swe:Quantity definition
= http:sweet.jpl.nasa.gov2.0humanTransportAir.owlGroundSpeed
swe:uom code
= ms
swe:Quantity swe:field
swe:field name
= location
swe:Vector optional
= true
referenceFrame =
http:www.opengis.netdefcrsEPSG04979 swe:coordinate
name =
lat swe:Quantity
definition =
http:sweet.jpl.nasa.gov2.0spaceCoordinates.owlLatitude axisID
= Lat
swe:uom code
= deg
swe:Quantity swe:coordinate
swe:coordinate name
= lon
swe:Quantity definition
= http:sweet.jpl.nasa.gov2.0spaceCoordinates.owlLongitude
axisID =
Long swe:uom
code =
deg swe:Quantity
swe:coordinate swe:coordinate
name =
alt swe:Quantity
definition =
http:sweet.jpl.nasa.gov2.0spaceExtent.owlAltitude axisID
= h
swe:uom code
= m
swe:Quantity swe:coordinate
swe:Vector swe:field
swe:DataRecord swe:elementType
swe:encoding swe:TextEncoding
blockSeparator =
10; tokenSeparator
= ,
swe:encoding swe:values
2007-10-23T15:46:12Z,15.3,Y,45.3,-90.5,311 2007-10-23T15:46:22Z,25.3,N
2007-10-23T15:46:32Z,20.6,Y,45.3,-90.6,312 2007-10-23T15:46:52Z,18.9,Y,45.4,-90.6,315
2007-10-23T15:47:02Z,22.3,N
swe:values swe:DataStream
In this example, the whole location “Vector” is marked as optional and thus the coordinate values are only included when the optional flag is set to ‘Y’ in the stream.
Field values in each block have to be listed in the same order as the field properties in the record definition thus following the “time,speed,Y,lat,lon,alt” or “time,speed,N” pattern
depending on whether or not the location is omitted.
122
Copyright © 2011 Open Geospatial Consortium
SWE Common Data Model OGC 08-094r1