Copyright © 2007 OGC – All rights reserved
17
informative XML implementation - examples
1 Introduction
The details of the XML implementation may be explored using instance examples. Using the GML implementation rules results in an explicit mapping from the model, using
names from the model as element and attribute names. Inspection of sample data is an effective way to assess the effectiveness of the model in capturing the required
information. In this clause we present a graduated series of examples to illustrate the model and encoding.
Observations may have many result types. It may also be convenient to provide the result value out-of-band. The details of how the result is encoded is not important to the model,
though practical interoperability in data transfer is best served by agreement on the form.
In some examples below alternative encodings with different advantages are shown for “complex” results. These include:
1. a compact record contained within a single XML element, composed of a list
of records each corresponding to a set of parameter values whose structure is then repeated. The syntax is taken from SensorML [SensorML]. Item and
record separators are explicit, and may be changed. This microformat requires a specific writer and reader to augment standard XML processing
2. a record or discrete coverage in which the items are encoded in separate XML
elements. This is verbose, but has the advantage of using the basic XML structuring components that are accessible in all XML processing
environments. This makes applications for both writing and reading easier to implement.
In all cases, the record structure is indicated separately.
2 Coding standards
2.1 Dependencies
The instance examples in this clause depend on the following externally governed schemas:
Schema Version XML namespace
Location of imported schema document
GML
3.1.1 http:www.opengis.netgml
http:schemas.opengis.netgml3.1.1basegml.xsd
Swe
1.0.1 http:www.opengis.net.swe1.0
.1 http:schemas.opengis.netsweCommon1.0.1swe.xsd
18
Copyright © 2008 OGC – All rights reserved
SensorML
1.0.1 http:www.opengis.netsensorML1.0
.1 http:schemas.opengis.netsensorML1.0.1sensorML.xsd
Discrete Coverages
0.2.1 http:www.opengis.netcv0.2
.1 http:bp.schemas.opengis.net06-188r1cv0.2.1cv.xsd
Observations Schema
1.0.0 http:www.opengis.netom1.0
http:schemas.opengis.netom1.0.0om.xsd
Observations Schema
Extensions
1.0.0 http:www.opengis.netomx1.0
http:schemas.opengis.netomx1.0.0om_extended.xsd
3 Simple Observations with scalar results
3.1 Measurements
The document shown in Listing 8 describes a simple observation to determine the mass of a specific banana.
The value of the procedure “scales”, the observedProperty “mass”, and the featureOfInterest a fruit are all given as references to external objects, using xlink:href
attributes following the standard GML pattern. These references are all given as URIs: the first two use the proposed OGC URN scheme [OGC 06-023r1], and the third is a
notional URL.
The type of the result is indicated in the instance using the standard xsi:type attribute [W3C XML Schema]. In this example it is gml:MeasureType, so the required uom
attribute is also present. The value of the uom is also given as a URN according to the OGC scheme.
NOTE: In GML 3.2ISO DIS 19136 the type of the uom attribute is extended to allow unit symbols from the UCUM scheme, allowing the more familiar short symbols like “kg” to appear instead of a URI.
Listing 8. observation1.xml
?xml version=1.0 encoding=UTF-8? om:Observation
gml:id= obsTest1
xmlns:om= http:www.opengis.netom1.0
xmlns:xsi= http:www.w3.org2001XMLSchema-instance
xmlns:xlink= http:www.w3.org1999xlink
xmlns:gml= http:www.opengis.netgml
xsi:schemaLocation= http:www.opengis.netom1.0
http:schemas.opengis.netom1.0.0om.xsd gml:description
Observation test instance: fruit mass gml:description
gml:name Observation test 1
gml:name om:samplingTime
gml:TimeInstant gml:id=
ot1t gml:timePosition
2005-01-11T16:22:25.00 gml:timePosition
gml:TimeInstant om:samplingTime
om:procedure xlink:href=
http:www.flakey.orgregisterprocessscales34.xml -- a notional URL identifying a procedure ... --
om:observedProperty xlink:href=
urn:x-ogc:def:phenomenon:OGC:mass
Copyright © 2007 OGC – All rights reserved
19
-- a notional WFS call identifying the object regarding which the observation was made -- om:parameter
swe:Quantity definition=
http:sweet.jpl.nasa.govontologyproperty.owlTemperature swe:uom
xlink:href= urn:ogc:def:uom:UCUM:Cel
swe:value 22.3
swe:value swe:Quantity
-- example of optional soft-typed parameter -- om:parameter
om:result xsi:type=
gml:MeasureType uom=
urn:x-ogc:def:uom:OGC:kg 0.28
om:result -- The XML Schema type of the result is indicated using the value of the xsi:type attribute --
om:Observation
3.2 Category observations