TOC 
wsn openapiJ. Suhonen, Ed.
 M. Rentto
 Department of Computer Systems,
 Tampere University of Technology
 September 14, 2012


Sensor Archive Data Format (SADF)

Abstract

The description of the interface used to fetch measurement data from WSN Data Archive regardless of the WSN technology.



Table of Contents

1.  Document information
2.  Introduction
3.  Content
    3.1.  Data structures
    3.2.  XML Schemas
    3.3.  XML Examples
        3.3.1.  Fetch all temperature measurements from node 3 between start and end time
        3.3.2.  Fetch all measurements from node 2 after given start time
        3.3.3.  Fetch all measurements from network #1
    3.4.  CSV
4.  Informative References
§  Authors' Addresses




 TOC 

1.  Document information

Document version: 1.3

XML namespace: urn:wsn-openapi:sadf



 TOC 

2.  Introduction

The Sensor Archive Data Format (SADF) described in this document is targeted for fetching measurement data from a Wireless Sensor Network (WSN) data archive OpenAPI Introduction (DACI Research Group, Department of Computer Systems, Tampere University of Technology, “OpenAPI Introduction,” 2010.) [OPEN API INTRO].

SADF uses request/response model to fetch measurements from the data archive. Both the request and the response contain an optional a message identifier for matching a response to its request. Message identifier is intended solely for the benefit of the client entity making the query, and its uniqueness is not needed nor enforced by the service entity.



 TOC 

3.  Content



 TOC 

3.1.  Data structures

Two structures for archive messages sent between WSN Data Archive and a client are defined here. The first there are verbose XML representations of archive query and response messages and after that more compact structures in CSV, defined here in ABNF.



 TOC 

3.2.  XML Schemas

The goal of XML representation is to be structural and easy to parse as much as possible. Therefore data types of attributes are set corresponding to semantic types of addressing of network components. Data types of id attributes of elements network, node, and sensor are string but using integer value is strongly recommended.

Data types of attribute id and content of element component are xs:string to allow any type of data to be transmitted as measurement component depending measurement type and component name. This allows that theoretically any type of data can be transmitted as content of measurement component e.g. piece of another XML document or some other format can be placed in measurement components content using CDATA section, how ever it is not recommended.



XML schema of the SADF query message:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
 elementFormDefault="qualified"
 attributeFormDefault="unqualified"
 targetNamespace="urn:wsn-openapi:sadf"
 xmlns="urn:wsn-openapi:sadf"
 >
	<!-- Types -->


	<xs:complexType name="SensorType">
		<xs:sequence>
		</xs:sequence>
		<xs:attribute name="id" type="xs:string" use="required" />
	</xs:complexType>

	<xs:complexType name="NodeType">
		<xs:sequence>
			<xs:element name="Sensor" type="SensorType" minOccurs="0" maxOccurs="unbounded" />
		</xs:sequence>
		<xs:attribute name="id" type="xs:string" use="required" />
	</xs:complexType>

	<xs:complexType name="MeasurementType">
		<xs:sequence>
			<xs:element name="Node" type="NodeType" minOccurs="0" maxOccurs="unbounded" />
		</xs:sequence>
		<xs:attribute name="quantity" type="xs:string" use="required" />
	</xs:complexType>

	<xs:complexType name="NetworkType">
		<xs:sequence>
			<xs:element name="Timeframe" type="TimeframeType" minOccurs="0" maxOccurs="1" />
			<xs:element name="Measurement" type="MeasurementType" minOccurs="0" maxOccurs="unbounded" />
			<xs:element name="Node" type="NodeType" minOccurs="0" maxOccurs="unbounded" />
		</xs:sequence>
		<xs:attribute name="id" type="xs:string" use="required" />
	</xs:complexType>

	<xs:complexType name="TimeframeType">
		<xs:attribute name="startTime" type="xs:dateTime" use="optional" >
			<xs:annotation>
				<xs:documentation>
					The start point is inclusive.
				</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="endTime" type="xs:dateTime" use="optional" >
			<xs:annotation>
				<xs:documentation>
					The end point is inclusive.
				</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>

	<xs:simpleType name="ResponseFormatType">
		<xs:restriction base="xs:string">
			<xs:enumeration value="XML"/>
			<xs:enumeration value="CSV"/>
		</xs:restriction>
	</xs:simpleType>

	<xs:complexType name="SADFQueryType">
		<xs:sequence>
			<xs:element name="Network" type="NetworkType" minOccurs="1" maxOccurs="unbounded" />
		</xs:sequence>
		<xs:attribute name="version" type="xs:double" use="required" />
		<xs:attribute name="responseFormat" type="ResponseFormatType" use="required" />
		<xs:attribute name="latestMeasurements" type="xs:boolean" use="optional" default="false" />
		<xs:attribute name="eventsOnly" type="xs:boolean" use="optional" default="false" />
		<xs:attribute name="messageId" type="xs:string" use="optional" />

		<xs:attribute name="measurementsInMessage" type="xs:integer" use="optional" default="0" >
			<xs:annotation>
				<xs:documentation>Measurements per response message for query. Default 0 means all
				measurements in one message. This value is maximum requested by the client.
				The gateway may have smaller limit. Smaller limit overrides.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="inlineThreshold" type="xs:integer" use="optional" default="0" >
			<xs:annotation><xs:documentation>If the size of the measurement component is less than
			or equal inlineThreshold the component is returned as inline. If inlineThreshold is 0
			or is not given results are always inline. Otherwise results are returned as URIs.
			</xs:documentation></xs:annotation>
		</xs:attribute>

	</xs:complexType>


	 <!-- Elements -->
	<xs:element name="Query" type="SADFQueryType" />

</xs:schema>

 Figure 1 



XML schema of the SADF response message:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
 elementFormDefault="qualified"
 attributeFormDefault="unqualified"
 targetNamespace="urn:wsn-openapi:sadf"
 xmlns="urn:wsn-openapi:sadf"
  >
	<!-- Types -->

	<xs:complexType name="ComponentType">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="id" type="xs:string" use="required" />
        		<xs:attribute name="unit" type="xs:string" use="optional" >
				<xs:annotation><xs:documentation>If not set the unit attribute of the parent
				is considered as unit of this component.</xs:documentation></xs:annotation>
        		</xs:attribute>
        		<xs:attribute name="ref" type="xs:anyURI" use="optional">
				<xs:annotation><xs:documentation>If set the ref points to the actual data.
				If omitted the component data is inline as the element value.
				</xs:documentation></xs:annotation>
        		</xs:attribute>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>

	<xs:complexType name="EventComponentType">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="id" type="xs:string" use="required" />
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>

	<xs:complexType name="EventType">
		<xs:sequence>
			<xs:element name="Component" type="EventComponentType"
				minOccurs="0" maxOccurs="unbounded" />
		</xs:sequence>
		<xs:attribute name="type" type="xs:string" use="optional" default="alert" />
		<xs:attribute name="time" type="xs:dateTime" use="optional" />
		<xs:attribute name="timeOffset" type="xs:integer" use="optional" />
		<xs:attribute name="id" type="xs:string" use="required" />

	</xs:complexType>

	<xs:complexType name="ToleranceComponentType">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="id" type="xs:string" use="required" />
				<xs:attribute name="unit" type="xs:string" use="optional" >
				<xs:annotation><xs:documentation>If not set the unit attribute of the parent tolerance
				is considered as unit of this component.</xs:documentation></xs:annotation>
				</xs:attribute>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>

	<xs:complexType name="ToleranceType">
		<xs:sequence>
			<xs:element name="Component" type="ToleranceComponentType"
				minOccurs="0" maxOccurs="unbounded" />
		</xs:sequence>
		<xs:attribute name="for" type="xs:string" use="required" />
		<xs:attribute name="type" type="xs:string" use="required" />
		<xs:attribute name="unit" type="xs:string" use="optional" />

	</xs:complexType>


	<xs:complexType name="MeasurementType">
		<xs:sequence>
			<xs:choice minOccurs="1" maxOccurs="unbounded">
				<xs:element name="Component" type="ComponentType" />
				<xs:element name="Event" type="EventType" />
			</xs:choice>
			<xs:element name="Tolerance" type="ToleranceType" minOccurs="0"
				maxOccurs="unbounded" />
		</xs:sequence>
		<xs:attribute name="outOfBounds" type="xs:boolean" use="optional" default="false" />
		<xs:attribute name="time" type="xs:dateTime" use="required" />
		<xs:attribute name="timeOffset" type="xs:integer" use="optional" />
		<xs:attribute name="quantity" type="xs:string" use="optional" />
        <xs:attribute name="unit" type="xs:string" use="optional" >
			<xs:annotation><xs:documentation>Common for all components unless a component has
			set the unit attribute itself.</xs:documentation></xs:annotation>
		</xs:attribute>
	</xs:complexType>

	<xs:complexType name="SensorType">
		<xs:choice minOccurs="0" maxOccurs="unbounded">
			<xs:element name="Measurement" type="MeasurementType"  />
			<xs:element name="Event" type="EventType"  />
		</xs:choice>
		<xs:attribute name="id" type="xs:string" use="required" />
	</xs:complexType>

	<xs:complexType name="NodeType">
		<xs:choice minOccurs="0" maxOccurs="unbounded">
			<xs:element name="Sensor" type="SensorType"  />
			<xs:element name="Event" type="EventType"  />
		</xs:choice>
		<xs:attribute name="id" type="xs:string" use="required" />
	</xs:complexType>

	<xs:complexType name="MeasurementsType">
		<xs:sequence>
			<xs:element name="Node" type="NodeType" minOccurs="0" maxOccurs="unbounded" />
		</xs:sequence>
		<xs:attribute name="quantity" type="xs:string" use="required" />
		<xs:attribute name="unit" type="xs:string" use="optional" >
			<xs:annotation><xs:documentation>Common for all components unless a component has
			set the unit attribute itself.</xs:documentation></xs:annotation>
		</xs:attribute>
	</xs:complexType>


	<xs:complexType name="NetworkType">
		<xs:choice minOccurs="0" maxOccurs="unbounded">
			<xs:element name="Measurements" type="MeasurementsType"  />
			<xs:element name="Node" type="NodeType" />
			<xs:element name="Event" type="EventType" />
		</xs:choice>
		<xs:attribute name="id" type="xs:string" use="required" />
	</xs:complexType>

	<xs:simpleType name="ResponseCodeType">
		<xs:restriction base="xs:integer">
			<xs:enumeration value="200"/>
			<xs:enumeration value="400"/>
			<xs:enumeration value="403"/>
		</xs:restriction>
	</xs:simpleType>

	<xs:complexType name="SADFResponseType">
		<xs:sequence>
			<xs:element name="Network"
			 type="NetworkType"
			 minOccurs="0"
			 maxOccurs="unbounded" />
		</xs:sequence>
		<xs:attribute name="version" type="xs:double" use="required" />
		<xs:attribute name="responseCode" type="ResponseCodeType" use="required" />
		<xs:attribute name="messageId" type="xs:string" use="optional" />

		<xs:attribute name="messageNumber" type="xs:integer" use="optional" default="1" >
		<xs:annotation><xs:documentation>Number of response for specific query.
		</xs:documentation></xs:annotation>
		</xs:attribute>
		<xs:attribute name="totalMessages" type="xs:integer" use="optional" default="1" >
		<xs:annotation><xs:documentation>Total number of responses for specific query.
		</xs:documentation></xs:annotation>
		</xs:attribute>

	</xs:complexType>

	<!-- Elements -->
	<xs:element name="Response" type="SADFResponseType" />

</xs:schema>

 Figure 2 

Attribute latestMeasurements in element SADFQuery means that if there havent been any measurements for sensor in given timeframe the latest measurement before timeframe is given and attribute outOfBounds of that measurement is set to true. If the sensor measures several quantities the latest measurement(s) of them are returned. This is applied in similar way for nodes if sensors are not given for the query i.e. the latest measurement(s) of each requested node are returned. This is applied in similar way for networks if nodes are not given for the query i.e. the latest measurement(s) of each requested network are returned. Attribute eventsOnly in element SADFQuery means that only measurements that have caused event are included in the response (with the event and measurement information).

Element TimeFrame can be omitted therefore the query will search for data with any timestamp. Timeframes are individual for each requested network. End and start points of a timeframe are inclusive. Query can be made with a set of selected nodes and sensors with any measurement type with element Node directly under element Network. Measurement types can also be defined by element Measurement. Element Measurement can also contain a selected set of nodes and sensors.

All, the Measurements, the Measurement and the Component elements have an unit attribute. The unit attribute of the Measurement element is common for all the measurement components. It is valid for all the components unless a component element itself has an unit attribute in which case the Component elements unit attribute overrides the corresponding of the measurement element. In similar way the unit attribute of the Measurements element is common for all the Measurement elements. It can be overridden in Measurement element which again can be overridden in Component element.

Both the Measurements and the Measurement elements have a quantity attribute. The quantity attribute of the Measurements element is common for all the child measurement elements. It is valid for all the measurement elements unless a Measurement element itself has a quantity attribute in which case the Measurement elements quantity attribute overrides the corresponding of the Measurements element.



CodeMeaningDescription
200 OK Command message was processed
400 Bad request The request had bad syntax or was inherently impossible to be satisfied
403 Forbidden The request is for something forbidden

 Table 1: Return values 



 TOC 

3.3.  XML Examples



 TOC 

3.3.1.  Fetch all temperature measurements from node 3 between start and end time



SADF query message in XML:

<Query version="1.1" responseFormat="XML" latestMeasurements="true" messageId="1" xmlns="urn:wsn-openapi:sadf">
        <Network id="1">
                <Timeframe startTime="2009-07-03T11:24:46+00:00" endTime="2009-07-03T11:28:46+00:00" />
                <Measurement quantity="Temperature">
                        <Node id="2">
                                        <Sensor id="3" ></Sensor>
                        </Node>
                </Measurement>
        </Network>
</Query>

 Figure 3 



Response SADF message in XML:

<Response version="1.1" responseCode="200" messageId="1" xmlns="urn:wsn-openapi:sadf">
        <Network id="1">
                <Measurements quantity="Location" unit="WGS84">
                        <Node id="2">
                                        <Sensor id="1" >
                                                <Measurement outOfBounds="true" time="2009-03-03T11:24:46+00:00">
                                                        <Component id="latitude">52.686</Component>
                                                        <Component id="longitude">2.193</Component>
                                                        <Component id="altitude">100</Component>
                                                </Measurement>
                                        </Sensor>
                        </Node>
                        <Node id="3">
                                        <Sensor id="1" >
                                                <Measurement outOfBounds="true" time="2009-03-03T11:24:46+00:00">
                                                        <Component id="latitude">52.786</Component>
                                                        <Component id="longitude">2.293</Component>
                                                        <Component id="altitude">100</Component>
                                                </Measurement>
                                        </Sensor>
                        </Node>
                </Measurements>
                <Measurements quantity="Temperature" unit="C">
                        <Node id="2">
                                        <Sensor id="3" >
                                                <Measurement time="2009-07-03T11:24:46+00:00">
                                                        <Component id="value">23.0</Component>
                                                </Measurement>
                                                <Measurement time="2009-07-03T11:26:46+00:00">
                                                        <Component id="value">23.1</Component>
                                                </Measurement>
                                                <Measurement time="2009-07-03T11:28:46+00:00">
                                                        <Component id="value">23.0</Component>
                                                </Measurement>
                                        </Sensor>
                        </Node>
                        <Node id="3">
                                        <Sensor id="3" >
                                                <Measurement time="2009-07-03T11:24:46+00:00">
                                                        <Component id="value">20.0</Component>
                                                </Measurement>
                                                <Measurement time="2009-07-03T11:26:46+00:00">
                                                        <Component id="value">20.1</Component>
                                                </Measurement>
                                                <Measurement time="2009-07-03T11:28:46+00:00">
                                                        <Component id="value">20.0</Component>
                                                </Measurement>
                                        </Sensor>
                        </Node>
                </Measurements>
                <Measurements quantity="Acceleration" unit="mg">
                        <Node id="2">
                                        <Sensor id="1" >
                                                <Measurement time="2009-07-03T11:24:46+00:00">
                                                        <Component id="x">245</Component>
                                                        <Component id="y">124</Component>
                                                        <Component id="z">800</Component>
                                                        <Component id="total">846</Component>
                                                </Measurement>
                                        </Sensor>
                        </Node>
                </Measurements>
        </Network>
</Response>

 Figure 4 



 TOC 

3.3.2.  Fetch all measurements from node 2 after given start time



SADF query message in XML:

<Query version="1.1" responseFormat="XML" messageId="5" xmlns="urn:wsn-openapi:sadf">
        <Network id="1">
                <Timeframe startTime="2009-07-03T11:24:00+00:00" />
                <Node id="2">
                </Node>
        </Network>
</Query>

 Figure 5 



SADF response message in XML:

<Response version="1.1" responseCode="200" messageId="5" xmlns="urn:wsn-openapi:sadf">
        <Network id="1">
                <Measurements quantity="Location" unit="WGS84">
                        <Node id="2">
                                        <Sensor id="1" >
                                                <Measurement outOfBounds="true" time="2009-03-03T11:24:46+00:00">
                                                        <Component id="latitude">52.686</Component>
                                                        <Component id="longitude">2.193</Component>
                                                        <Component id="altitude">100</Component>
                                                </Measurement>
                                        </Sensor>
                        </Node>
                </Measurements>
                <Measurements quantity="Temperature" unit="C">
                        <Node id="2">
                                        <Sensor id="1" >
                                                <Measurement time="2009-07-03T11:24:46+00:00">
                                                        <Component id="value">21.0</Component>
                                                </Measurement>
                                                <Measurement time="2009-07-03T11:26:46+00:00">
                                                        <Component id="value">21.1</Component>
                                                </Measurement>
                                        </Sensor>
                                        <Sensor id="3" >
                                                <Measurement time="2009-07-03T11:24:46+00:00">
                                                        <Component id="value">23.0</Component>
                                                </Measurement>
                                                <Measurement time="2009-07-03T11:26:46+00:00">
                                                        <Component id="value">23.1</Component>
                                                </Measurement>
                                                <Measurement time="2009-07-03T11:28:46+00:00">
                                                        <Component id="value">23.0</Component>
                                                </Measurement>
                                        </Sensor>
                        </Node>
                </Measurements>
                <Measurements quantity="Illuminance" unit="lux">
                        <Node id="2">
                                        <Sensor id="1" >
                                                <Measurement time="2009-07-03T11:24:46+00:00">
                                                        <Component id="value">21.0</Component>
                                                </Measurement>
                                                <Measurement time="2009-07-03T11:26:46+00:00">
                                                        <Component id="value">21.1</Component>
                                                </Measurement>
                                        </Sensor>
                        </Node>
                </Measurements>
	                <Measurements quantity="Humidity" unit="%">
                        <Node id="2">
                                        <Sensor id="1" >
                                                <Measurement time="2009-07-03T11:24:46+00:00">
                                                        <Component id="value">21.0</Component>
                                                </Measurement>
                                                <Measurement time="2009-07-03T11:26:46+00:00">
                                                        <Component id="value">21.1</Component>
                                                </Measurement>
                                        </Sensor>
                        </Node>
                </Measurements>
		                <Measurements quantity="Acceleration" unit="mg">
                        <Node id="2">
                                        <Sensor id="1" >
                                                <Measurement time="2009-07-25T14:24:46+00:00">
                                                        <Component id="x">142.0</Component>
                                                        <Component id="y">46.0</Component>
                                                        <Component id="z">895.0</Component>
                                                        <Component id="roll" unit="degree">8.0</Component>
                                                        <Component id="pitch" unit="degree">2.0</Component>
                                                        <Component id="total">907.36156</Component>
                                                </Measurement>
                                                <Measurement time="2009-07-25T14:26:46+00:00">
                                                        <Component id="x">142.0</Component>
                                                        <Component id="y">46.0</Component>
                                                        <Component id="z">895.0</Component>
                                                        <Component id="roll" unit="degree">8.0</Component>
                                                        <Component id="pitch" unit="degree">2.0</Component>
                                                        <Component id="total">907.36156</Component>
                                                </Measurement>
                                                <Measurement time="2009-07-25T14:28:46+00:00">
                                                        <Component id="x">142.0</Component>
                                                        <Component id="y">46.0</Component>
                                                        <Component id="z">895.0</Component>
                                                        <Component id="roll" unit="degree">8.0</Component>
                                                        <Component id="pitch" unit="degree">2.0</Component>
                                                        <Component id="total">907.36156</Component>
                                                </Measurement>
                                                <Measurement time="2009-07-25T14:30:46+00:00">
                                                        <Component id="x">142.0</Component>
                                                        <Component id="y">46.0</Component>
                                                        <Component id="z">895.0</Component>
                                                        <Component id="roll" unit="degree">8.0</Component>
                                                        <Component id="pitch" unit="degree">2.0</Component>
                                                        <Component id="total">907.36156</Component>
                                                </Measurement>
                                        </Sensor>
                        </Node>
                </Measurements>
        </Network>
</Response>

 Figure 6 



 TOC 

3.3.3.  Fetch all measurements from network #1



SADF query message in XML:

<Query version="1.1" responseFormat="XML" messageId="2" eventsOnly="true" xmlns="urn:wsn-openapi:sadf">
        <Network id="1">
        </Network>
</Query>

 Figure 7 



SADF response message in XML:

<Response version="1.1" responseCode="200" messageId="2" xmlns="urn:wsn-openapi:sadf">
        <Network id="1">
                <Measurements quantity="Temperature" unit="C">
                        <Node id="2">
                                        <Sensor id="1" >
                                                <Measurement time="2009-03-03T14:25:41+00:00">
                                                        <Component id="value">25.3</Component>
                                                        <Event>
                                                                <EventComponent id="message" >Temperature alert</EventComponent>
                                                                <EventComponent id="trigger" >value > 25</EventComponent>
                                                        </Event>
                                                </Measurement>
                                                <Measurement time="2009-04-03T17:39:41+00:00">
                                                        <Component id="value">25.6</Component>
                                                        <Event>
                                                                <EventComponent id="message" >Temperature alert</EventComponent>
                                                                <EventComponent id="trigger" >value > 25</EventComponent>
                                                        </Event>
                                                </Measurement>
                                        </Sensor>
                        </Node>
                        <Node id="4">
                                        <Sensor id="1" >
                                                <Measurement time="2009-09-25T08:43:05+00:00">
                                                        <Component id="value">-14.8</Component>
                                                        <Event>
                                                                <EventComponent id="message" >Temperature alert</EventComponent>
                                                                <EventComponent id="trigger" >value > -15</EventComponent>
                                                        </Event>
                                                </Measurement>
                                        </Sensor>
                        </Node>
                </Measurements>
                <Measurements quantity="Humidity">
                        <Node id="5">
                                        <Sensor id="1" >
                                                <Measurement time="2009-11-13T04:25:41+00:00" unit="%">
                                                        <Component id="value">90.3</Component>
                                                        <Event>
                                                                <EventComponent id="message" >Humidity alert</EventComponent>
                                                                <EventComponent id="trigger" >value > 90</EventComponent>
                                                        </Event>
                                                </Measurement>
                                        </Sensor>
                        </Node>
                </Measurements>
        </Network>
</Response>

 Figure 8 



 TOC 

3.4.  CSV

The goal of the CSV representation is to be as compact as possible though containing all the same information as the XML representation. The CSV format contains no information about measurement type of the sensor or the names of the components because that information can be resolved using the meta-data available through MEDF (DACI Research Group, Department of Computer Systems, Tampere University of Technology, “Node Datasheet,” 2010.) [MEDF].



An example query message:

SADF:QUERY;1.1;CSV;1;0;0;0;0;2
"1";2009-07-25T14:24:46+00:00;2009-07-25T15:24:46+00:00;;"5">"1","3":"6">"1","2":"7">"2":"8"
"1";2009-07-25T14:24:46+00:00;2009-07-25T17:24:46+00:00;"Temperature"|"1">"1","2":"3">"1","2"."Illuminance":"4">"2":"7"

 Figure 9 



An example response message:

SADF:RESPONSE;1.1;200;1;1;1;1
"1";;"1";;"1";;"Temperature";0;2009-07-25T14:24:48+00:00;;;23.0;;

 Figure 10 



The Augmented Backus-Naur Form (ABNF) RFC 5234 (Crocker, D. and P. Overell, “Augmented BNF for Syntax Specifications: ABNF,” January 2008.) [RFC5234] definition:


SADF-MESSAGE = SADF-QUERY / SADF-RESPONSE

SADF-QUERY = "SADF:QUERY" ";" VERSION ";" RESPONSE-FORMAT ";" MESSAGE-ID ";" INCLUDE-LATEST ";" EVENTS-ONLY ";" [MEASUREMENTS-IN-MESSAGE] ";" [INLINE-THRESHOLD] ";" LINES END-OF-LINE *(LF QUERY-LINE) LF
SADF-RESPONSE = "SADF:RESPONSE" ";" VERSION ";" RESPONSE-CODE ";" MESSAGE-ID ";" [MESSAGE-NUMBER] ";" [TOTAL-MESSAGES] ";" LINES END-OF-LINE *(LF RESPONSE-LINE) LF

VERSION = Double
RESPONSE-FORMAT = "XML" / "CSV"
INCLUDE-LATEST = Boolean
EVENTS-ONLY = Boolean
LINES = Integer
MESSAGE-ID = String
RESPONSE-CODE = "200" / "400" / "403"
MESSAGE-NUMBER = PositiveInteger
TOTAL-MESSAGES = PositiveInteger

QUERY-LINE = NETWORK-ID ";" TIMEFRAME ";" [MEASUREMENT-QUERY] ";" [SENSOR-QUERY] END-OF-LINE
RESPONSE-LINE = NETWORK-ID ";" EVENTS ";" [NODE-ID] ";" EVENTS ";" [SENSOR-ID] ";" EVENTS ";" [QUANTITY] ";" [OUT-OF-BOUNDS] ";" [DATE-FORMAT] ";" EVENTS ";" [VALUES] ";" [TOLERANCES] ";" [REFS] END-OF-LINE

MEASUREMENT-QUERY = MEASUREMENTS *("." MEASUREMENTS)
SENSOR-QUERY = SENSORS *(":" SENSORS)
MEASUREMENTS = QUANTITY "|" SENSOR-QUERY
SENSORS =  NODE-ID ">" SENSOR-ID *("," SENSOR-ID)

REFS = URI *("," URI)
VALUES = COMPONENT *("," COMPONENT)
TIMEFRAME = [STARTTIME] ";" [ENDTIME]
STARTTIME = DATE-FORMAT
ENDTIME = DATE-FORMAT
QUANTITY = String
OUT-OF-BOUNDS = Boolean

MEASUREMENTS-IN-MESSAGE = PositiveInteger
INLINE-THRESHOLD = PositiveInteger

EVENTS = [EVENT *("," EVENT)]
EVENT = EVENT-ID "|" DATE-FORMAT "|" KEY-VALUE-PAIR *("|" KEY-VALUE-PAIR)
KEY-VALUE-PAIR = String "=" String
TOLERANCES = TOLERANCE *("," TOLERANCE)
TOLERANCE = TOLERANCE-FOR "|" TOLERANCE-TYPE "|" KEY-VALUE-PAIR *("|" KEY-VALUE-PAIR)
COMPONENT = Integer / Double / Boolean / String / URI

DATE-FORMAT = RELATIVE-TIME / ABSOLUTE-TIME
RELATIVE-TIME = ("+" / "-") 1*DIGIT ["." 1*DIGIT]
ABSOLUTE-TIME = DATE "T" TIME TIME-ZONE
DATE = ["-"] 4DIGIT "-" %x30-31 DIGIT "-" %x30-33 DIGIT
TIME = %x30-32 DIGIT ":" %x30-35 DIGIT ":" %x30-35 DIGIT ["." *DIGIT]
TIME-ZONE = ( ("+" / "-") 2DIGIT ":" 2DIGIT ) / "Z"

SENSOR-ID  = String
NODE-ID  = String
NETWORK-ID  = String
PositiveInteger = 1*DIGIT
Integer = ("+" / "-" / "") 1*DIGIT
Boolean = BIT
Double = ("+" / "-" / "") 1*DIGIT ["." 1*DIGIT]
String = DQUOTE *VCHAR DQUOTE
END-OF-LINE = *(";")

URI = *VCHAR

Time zone (Z) is represented in 4-digit format as defined in RFC 822 (Crocker, D., “Standard for the format of ARPA Internet text messages,” August 1982.) [RFC0822]

 Figure 11 



 TOC 

4. Informative References

[RFC0822] Crocker, D., “Standard for the format of ARPA Internet text messages,” STD 11, RFC 822, August 1982 (TXT).
[RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, A., Peterson, J., Sparks, R., Handley, M., and E. Schooler, “SIP: Session Initiation Protocol,” RFC 3261, June 2002 (TXT).
[RFC3428] Campbell, B., Rosenberg, J., Schulzrinne, H., Huitema, C., and D. Gurle, “Session Initiation Protocol (SIP) Extension for Instant Messaging,” RFC 3428, December 2002 (TXT).
[RFC5234] Crocker, D. and P. Overell, “Augmented BNF for Syntax Specifications: ABNF,” STD 68, RFC 5234, January 2008 (TXT).
[RFC2817] Khare, R. and S. Lawrence, “Upgrading to TLS Within HTTP/1.1,” RFC 2817, May 2000 (TXT).
[RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, “Hypertext Transfer Protocol -- HTTP/1.1,” RFC 2616, June 1999 (TXT, PS, PDF, HTML, XML).
[GEO] GEOPRIV -- Geographic, Location/Privacy Working Group, A. Mayrhofer, C. Spanring, “A Uniform Resource Identifier for Geographic Locations ('geo' URI) draft-mayrhofer-geopriv-geo-uri-01,” 2009.
[OPEN API INTRO] DACI Research Group, Department of Computer Systems, Tampere University of Technology, “OpenAPI Introduction,” 2010.
[SIDF] DACI Research Group, Department of Computer Systems, Tampere University of Technology, “Sensor Information Data Format (SIDF),” 2010.
[MEDF] DACI Research Group, Department of Computer Systems, Tampere University of Technology, “Node Datasheet,” 2010.


 TOC 

Authors' Addresses

  Jukka Suhonen (editor)
  Department of Computer Systems, Tampere University of Technology
  Korkeakoulunkatu 1
  Tampere, 33101
  FI
Phone: 
Email:  tutwsn@cs.tut.fi
  
  Markus Rentto
  Department of Computer Systems, Tampere University of Technology
  Korkeakoulunkatu 1
  Tampere, 33101
  FI
Phone: 
Email:  tutwsn@cs.tut.fi