Guide for Experimenters

1 Experiment Management

1.2 Define an experiment through Domain Specification Language (DSL)

Currently EEE or the Experiment Execution Engine does not support all the attributes available within DSL. Within FISMO, we only support name, description, discoverable, scheduling, reportIfEmpty, filetype, experiment output, dynamic attributes, widget and query attribute. Currently, we do no support service, trigger, and rules. Poll Now option in the Experiment Management Console is a type of on- demand trigger that we provide to the experimenters.

Experimenters should consider replacing “#*#” with experiment requirements. For simplicity we provide a template of FISMO that is supported by the EEE. 

<fed:FISMO name="#NAME#">

 <fed:description>#DESCRIPTION#</fed:description>

 <fed:discoverable>#DISCOVERABLE#</fed:discoverable>

 <fed:experimentControl>

  <fed:scheduling>

   <fed:startTime>#STARTTIME#</fed:startTime>

   <fed:Periodicity>#PERIODICITY#</fed:Periodicity>

   <fed:stopTime>#STOPTIME#</fed:stopTime>

  </fed:scheduling>

  <fed:reportIfEmpty>#REPORTIFEMPTY#</fed:reportIfEmpty>

 </fed:experimentControl>

 <fed:experimentOutput location="#URLLOCATION#">

  <fed:file>

   <fed:type>#FILETYPE#</fed:type>

  </fed:file>

  <fed:widget widgetID="eu.fiestaiot.analytics.toolkit">

   <fed:presentationAttr name="requestBody" value="#WVALUE#"/>

  </fed:widget>

 </fed:experimentOutput>

 <fed:queryControl>

  <prt:query-request>

   <query><![CDATA[

#[1/1] visualization type: 'Gauge' and sensors

#QUERY#

]]>

   </query>

  </prt:query-request>

  <fed:dynamicAttrs>

   <fed:predefinedDynamicAttr>

    <fed:dynamicQueryInterval>

     <fed:fromDateTime>#FROMDATETIME#</fed:fromDateTime>

     <fed:toDateTime>#TODATETIME#</fed:toDateTime>

     <fed:intervalNowToPast>#INTERVALNOWTOPAST#</fed:intervalNowToPast>

    </fed:dynamicQueryInterval>

    <fed:dynamicGeoLocation>

     <fed:latitude>#LATITUDE#</fed:latitude>

     <fed:longitude>#LONGITUDE#</fed:longitude>

    </fed:dynamicGeoLocation>

   </fed:predefinedDynamicAttr>

   <fed:dynamicAttr name="#DA_NAME1#" value="#DA_VALUE1#"/>

   <fed:dynamicAttr name="#DA_NAME2#" value="#DA_VALUE2#"/>

  </fed:dynamicAttrs>

 </fed:queryControl>

</fed:FISMO>



To further explain,

  • #NAME#: should be the name of the FISMO that experimenter want to have. For example:

<fed:FISMO name="2ndUseCase">

 

  • #DESCRIPTION#: should be the description of the FISMO to understand what is the FISMO is about. For example:

<fed:description>Over time all noise observations for a given location</fed:description>

 

  • #DISCOVERABLE#: should be either “true” or “false”. As explained before this attribute is used by the EEE to know whether the FISMO can be shown in the “Other Available FISMO IDs for subscriptions” tab in the Experiment Management Console. Using this other experimenters could reuse the query and scheduling information (subscribers should giving a new location that would send the results to them). For example:

<fed:discoverable>true</fed:discoverable>

 

  • #STARTTIME#: it is the time when the scheduling should start. In case, the #STARTTIME# in the past, the current time will be used and in case #STARTTIME# is in future, the given time will be used by the EEE to schedule the FISMO. The #STARTTIME# should be in DATETIME format.

<fed:startTime>2016-11-08T18:50:00.0Z</fed:startTime>

 

  • #PERIODICITY#: is the period after which the EEE should re-trigger the execution of the FISMO. It is in INTEGER format and denotes the Seconds. For example:

<fed:Periodicity>250</fed:Periodicity>

 

  • #STOPTIME#: it is the time when the EEE should stop executing the FISMO. In case, the #STARTTIME# in the past, and is less than #STARTTIME# an error is raised by the EEE. Thus it is advisable that the #STOPTIME# is in future and is greater than #STARTTIME# The #STOPTIME# should be in DATETIME format. For example:

<fed:stopTime>2017-11-08T18:49:59.0Z</fed:stopTime>

 

  • #REPORTIFEMPTY#: it is the Boolean value (“true” or “false”) that should be set in order for the experimenter to not to receive empty resultsets obtained after the execution of the query. A value false mean that if the resultset was null then do also report it. By default the value is true. For example:

<fed:reportIfEmpty>false</fed:reportIfEmpty>

 

  • #URLLOCATION#: it should be the location where the results of the query should be returned. This is usually a valid URL location. Please note that an experimenter cannot update this parameter once the FEDSpec is submitted. It is assumed that the experimenter has developed the functionality behind this link where EEE can upload the results in a “multipart” files format. In the current implementation of EEE, it is also assumed that this is a REST based API that implements HTTP POST with following REQUEST parameters:

connection : keep-alive
Content-Type: multipart/form-data; boundary=--timestamp

An example URLLOCATION is as below:

<fed:experimentOutput

location="http://ExperimentServer.org/store/"></fed:experimentOutput>

Currently, if the experimenter is using HTTPS, then they should use Letsencrypt certificate for this API/URL. All other certificates will fail. However, HTTP will pass through. This is because of the JVM not having all the certificates installed 

 

  • #FILETYPE#: this parameter defines the response content-type. As described above valid content-types that are received are "text/plain", "text/tab-separated-values", "text/csv", "application/sparql-results+json", "application/sparql-results+xml", "application/sparql-results+thrift", "application/json", "text/xml" and "application/xml". The Experimenter should choose either one of them. Please note that we do not set the extension of the file itself. For example:

<fed:file><fed:type>application/xml</fed:type></fed:file>

  • #WVALUE#: is a JSON string that is of form.

{
 "Method": ["Method 1"," Method 2"," Method 3"],
 "Parameters": ["Parameters 1", "Parameters 2", "Parameters 3"]
}

Setting this value will enable EEE to know if the FIESTA-IoT Analytics has to be executed or not. If the experimenters do not want this then they simply just not provide the widget tag. Further, if this is set then the query should be of specific format as well. Please refer to the query template below:

Prefix …
Select distinct ?sensingDevice ?dataValue ?dateTime
Where {
    …

}

Please note the SELECT statement. As per the guidelines set by FISTA-IoT Analytics tool, this SELECT statement should not be modified. The experimenters will receive a CSV file always if this is set. Setting the #FILETYPE# will have no effect. Also note that the permissible values of “Methods” and “Parameters” are:

 

 

An example “#WVALUE#” is as shown below:

{
 &quot;Method&quot;: [&quot;fft&quot;, &quot;linReg&quot;],
 &quot;Parameters&quot;: [&quot; &quot;, &quot;Predict&quot;]
}

Note that the values in Parameters should have one-one mapping to values in Methods. Further the “ is represented as &quot; to facilitate xml parsing.

  • #QUERY#: is the actual SPARQL query that should be executed by the EEE on the Meta-Cloud.  For best results we advice not to provide following query and be specific to the needs.

 select * where {?s ?p ?o.}

The above query would hinder the performance of the EEE. A number of valid queries that we have used so far in all our internal components and in-house experiments can be found in section 4.4. Note that the #QUERY# should be between “<![CDATA[#[1/1] visualization type: 'Gauge' and sensors” and “]]”.

The following parameters are to be used when dynamic attributes are needed in the query. 

  • #FROMDATETIME#:  This attribute represents the “from” date time a query has to be executed. Within the query please use “%%fromDateTime%%” so that it is replaced with the value provided correctly. This attribute is dynamic so this attribute should be presented as a default value in DATETIME format in the FEDSpec. In the FEDSpec, experimenters can define it as, for example:

<fed:fromDateTime>2006-05-04T18:13:51.0Z</fed:fromDateTime>

  • #TODATETIME#: This attribute represents the “to” date time a query has to be executed. Within the query please use “%%toDateTime%%” so that it is replaced with the value provided correctly. This attribute is dynamic so this attribute should be presented as a default value in DATETIME format in the FEDSpec. In the FEDSpec, experimenters can define it as, for example:

<fed:fromDateTime>2006-05-04T18:13:51.0Z</fed:fromDateTime>

  • #INTERVALNOWTOPAST#: This attribute represents milliseconds from now to past. This is used in case experimenters do not want to specify #FROMDATETIME# and #TODATETIME#. This attribute is not needed to be represent in the query, however in the query, experimenters should still have “%%fromDateTime%%” and “%%toDateTime%%” so that EEE can process the #INTERVALNOWTOPAST# and replace “%%fromDateTime%%” and “%%toDateTime%%” accordingly. EEE resolves “%%fromDateTime%%” as “current time - #INTERVALNOWTOPAST#”. In the FEDSpec, experimenters can define it as, for example:

<fed:intervalNowToPast>300000</fed:intervalNowToPast>

  • #LATITUDE#: This attribute represents the “latitude” in a query that has to be executed. Within the query please use “%%geoLatitude%%” so that it is replaced with the value provided correctly. This attribute is dynamic so this attribute should be presented as a default value in float format in the FEDSpec. In the FEDSpec, experimenters can define it as, for example:

<fed:latitude>46.52119378179781</fed:latitude>

  • #LONGITUDE#: This attribute represents the “longitude” in a query that has to be executed. Within the query please use “%%geoLongitude%%” so that it is replaced with the value provided correctly. This attribute is dynamic so this attribute should be presented as a default value in float format in the FEDSpec. In the FEDSpec, experimenters can define it as, for example:

<fed:longitude>46.52119378179781</fed:longitude>

  • #DA_NAME_NUMBER# and #DA_VALUE_NUMBER# these attributes go hand in hand. They form a key value pair. It is advised that experimenters use the #DA_NAME_NUMBER# in the query as “%%DA_NAME_NUMBER%%”. Please note change of “#” to “%%”. In the FEDSpec, experimenters can define it as, for example:

<fed:dynamicAttr name="qk" value="http://purl.org/iot/vocab/m3-lite#AirTemperature"/>

<fed:dynamicAttr name="unit" value="http://purl.org/iot/vocab/m3-lite#Degree"/>

Note that in the example #DA_NAME1# is “qk” and DA_VALUE1=http://purl.org/iot/vocab/m3-lite#AirTemperature

A sample query that utilizes some of the dynamic attributes is mentioned above is provided as below for reference:

Prefix ssn: <http://purl.oclc.org/NET/ssnx/ssn#>
Prefix iotlite: <http://purl.oclc.org/NET/UNIS/fiware/iot-lite#>
Prefix dul: <http://www.loa.istc.cnr.it/ontologies/DUL.owl#>
Prefix geo: http://www.w3.org/2003/01/geo/wgs84_pos#
Prefix time: http://www.w3.org/2006/time#
Prefix m3-lite: http://purl.org/iot/vocab/m3-lite#
Prefix xsd: http://www.w3.org/2001/XMLSchema#
Prefix rdf:  http://www.w3.org/1999/02/22-rdf-syntax-ns#
select ?sensorID (max(?ti) as ?time) ?value ?latitude ?longitude
where {
    ?o a ssn:Observation.
    ?o ssn:observedBy ?sensorID.  
    ?o ssn:observedProperty ?qkr.
    ?qkr rdf:type ?qk.
    Values ?qk {m3-lite:Sound m3-lite:SoundPressureLevelAmbient}
    ?o ssn:observationSamplingTime ?t.
    ?o geo:location ?point.
    ?point geo:lat ?latitude.
    ?point geo:long ?longitude.
    ?t time:inXSDDateTime ?ti.
    ?o ssn:observationResult ?or.
    ?or  ssn:hasValue ?v.
    ?v dul:hasDataValue ?value.
    FILTER ((xsd:double(?latitude) >= "-90"^^xsd:double) &&   (xsd:double(?latitude) <= "90"^^xsd:double)
&& (xsd:double(?longitude) >= "-180"^^xsd:double) 
&& (xsd:double(?longitude) <= "180"^^xsd:double)) 
    FILTER(?value>="50"^^xsd:double)FILTER(?ti > "%%fromDateTime%%"^^xsd:dateTime && ?ti < "%%toDateTime%%"^^xsd:dateTime)
} group by ?sensorID ?time ?value ?latitude ?longi
tude

On top of the FISMO there is a FEMO object. Currently EEE supports the following FEMO template.

<fed:FEMO name="#FEMONAME#">
    <fed:description>#FEMODESCRIPTION#</fed:description>
    <fed:domainOfInterest>#DOMAINOFINTERESTLIST#</fed:domainOfInterest>
    <fed:FISMO name="#NAME#">
    …
    </fed:FISMO>
</fed:
FEMO>

Here:

  • #FEMONAME#: should be the name of the FEMO that experimenter want to have. For example:

<fed:FEMO name="MySecondExperiment">

 

  • #FEMODESCRIPTION#: should be the description of the FEMO to understand what is the FEMO is about. For example:

<fed:description>LargeScale crowdsensing experiment </fed:description>

 

  • #DOMAINOFINTERESTLIST#:  this is the list of the domain of interests that experiment supports. For multiple domain of interests values should be blank space separated. For example.

<fed:domainOfInterest>http://purl.org/iot/vocab/m3-lite#Transportation http://purl.org/iot/vocab/m3-lite#Pollution http://purl.org/iot/vocab/m3-lite#City http://purl.org/iot/vocab/m3-lite#Health</fed:domainOfInterest>

 

Further on the top of the FEMO object, there exists a FEDSpec object.

<fed:FEDSpec xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"            xmlns:fed="http://www.fiesta-iot.eu/fedspec"             xmlns:prt="http://www.w3.org/2007/SPARQL/protocol-types#"               xmlns:vbr="http://www.w3.org/2007/SPARQL/results#"               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"            xsi:schemaLocation="FILELOCATION" userID="#USERID#">
<fed:FEMO name="#FEMONAME#">
    …
</fed:FEMO>
</fed:FEDSpec>

One important thing to note here is the #USERID#. Please use your #USERID#. Do not use any other #USERID# in case you use it, you will not be able to view or perform any operations on the services you need.

For complete valid sample please consult the following table:

Experiment Instance (FEDSpec Example)

<?xml version="1.0" encoding="UTF-8"?>

<fed:FEDSpec xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"

 xmlns:fed="http://www.fiesta-iot.eu/fedspec"

 xmlns:prt="http://www.w3.org/2007/SPARQL/protocol-types#"

 xmlns:vbr="http://www.w3.org/2007/SPARQL/results#"

 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

 xsi:schemaLocation="http://www.fiesta-iot.eu/fedspec file:/C:/Ext_SSD/AIT/FIESTA/FIESTA-SVN/WP4/Task%204.1/Objects/XSD/FEDSpec.xsd" userID="YOURUSERID">

    <fed:FEMO name="MySecondExperiment">

        <fed:description>LargeScale crowdsensing experiment</fed:description>

        <fed:domainOfInterest>http://purl.org/iot/vocab/m3-lite#Transportation http://purl.org/iot/vocab/m3-lite#Pollution http://purl.org/iot/vocab/m3-lite#City http://purl.org/iot/vocab/m3-lite#Health</fed:domainOfInterest>

        <fed:FISMO name="2ndUseCase">

            <fed:description>Over time all noise observations for a given location</fed:description>

            <fed:discoverable>true</fed:discoverable>

            <fed:experimentControl>

                <fed:scheduling>

                    <fed:startTime>2016-11-08T18:50:00.0Z</fed:startTime>

                    <fed:Periodicity>250</fed:Periodicity>

                    <fed:stopTime>2017-11-08T18:49:59.0Z</fed:stopTime>

                </fed:scheduling>

            </fed:experimentControl>

            <fed:experimentOutput location="http://ExperimentServer.org/store/"></fed:experimentOutput>

            <fed:queryControl>

                <prt:query-request>

                    <query><![CDATA[

                        # [1 / 1] visualization type: 'Gauge' and sensors

                        Prefix ssn: <http://purl.oclc.org/NET/ssnx/ssn#>

                        Prefix iotlite: <http://purl.oclc.org/NET/UNIS/fiware/iot-lite#>

                        Prefix dul: <http://www.loa.istc.cnr.it/ontologies/DUL.owl#>

                        Prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>

                        Prefix time: <http://www.w3.org/2006/time#>

                        Prefix m3-lite: <http://purl.org/iot/vocab/m3-lite#>

                        Prefix xsd: <http://www.w3.org/2001/XMLSchema#>

                        select ?s ?tim ?val

                        where {

                            ?o a ssn:Observation.

                            ?o ssn:observedBy ?s.  

                            ?o ssn:observedProperty ?qkr.

                            ?qkr a ?qk.

                            Values ?qk {m3-lite:Sound m3-lite:SoundPressureLevelAmbient}

                            ?o ssn:observationSamplingTime ?t.

                            ?o geo:location ?point.

                            ?point geo:lat "4.346104E1"^^xsd:double.

                            ?point geo:long "-3.80649E0"^^xsd:double.

                            ?t time:inXSDDateTime ?ti.

                            ?o ssn:observationResult ?or.

                            ?or  ssn:hasValue ?v.

                            ?v dul:hasDataValue ?val. 

                        } group by (?s) ?tim ?val

                    ]]></query>

                </prt:query-request>

              </fed:queryControl>

        </fed:FISMO>

        <fed:FISMO name="3rdUseCase">

            <fed:description>Over time noise observations for a given bounding box (time period in scheduling)</fed:description>

            <fed:discoverable>true</fed:discoverable>

            <fed:experimentControl>

                <fed:scheduling>

                    <fed:startTime>2016-11-08T18:50:00.0Z</fed:startTime>

                    <fed:Periodicity>250</fed:Periodicity>

                    <fed:stopTime>2017-11-08T18:49:59.0Z</fed:stopTime>

                </fed:scheduling>

            </fed:experimentControl>

            <fed:experimentOutput location="http://ExperimentServer.org/store/"></fed:experimentOutput>

            <fed:queryControl>

                <prt:query-request>

                    <query><![CDATA[

                        # [1 / 1] visualization type: 'Gauge' and sensors

                        Prefix ssn: <http://purl.oclc.org/NET/ssnx/ssn#>

                        Prefix iotlite: <http://purl.oclc.org/NET/UNIS/fiware/iot-lite#>

                        Prefix dul: <http://www.loa.istc.cnr.it/ontologies/DUL.owl#>

                        Prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>

                        Prefix time: <http://www.w3.org/2006/time#>

                        Prefix m3-lite: <http://purl.org/iot/vocab/m3-lite#>

                        Prefix xsd: <http://www.w3.org/2001/XMLSchema#>

                        select ?s (max(?ti) as ?tim) ?val ?lat ?long

                        where {

                            ?o a ssn:Observation.

                            ?o ssn:observedBy ?s.  

                            ?o ssn:observedProperty ?qkr.

                            ?qkr a ?qk.

                            Values ?qk {m3-lite:Sound m3-lite:SoundPressureLevelAmbient}

                            ?o ssn:observationSamplingTime ?t.

                            ?o geo:location ?point.

                            ?point geo:lat ?lat.

                            ?point geo:long ?long.

                            ?t time:inXSDDateTime ?ti.

                            ?o ssn:observationResult ?or.

                            ?or  ssn:hasValue ?v.

                            ?v dul:hasDataValue ?val.

                            {

                                select  (max(?dt)as ?ti) ?s        

                                where {

                                    ?o a ssn:Observation.

                                    ?o ssn:observedBy ?s.  

                                    ?o ssn:observedProperty ?qkr.

                                    ?qkr a ?qk.

                                    Values ?qk {m3-lite:Sound m3-lite:SoundPressureLevelAmbient}

                                    ?o ssn:observationSamplingTime ?t.

                                    ?t time:inXSDDateTime ?dt.

                                }group by (?s)

                            }

                            FILTER (

                               (xsd:double(?lat) >= "-90"^^xsd:double)

                            && (xsd:double(?lat) <= "90"^^xsd:double)

                            && ( xsd:double(?long) >= "-180"^^xsd:double) 

                            && ( xsd:double(?long) <= "180"^^xsd:double)

                            ) 

                        } group by (?s) ?tim ?val ?lat ?long

                    ]]></query>

                </prt:query-request>

              </fed:queryControl>

        </fed:FISMO>

        <fed:FISMO name="4thUseCase">

            <fed:description>3rd usecase with noise more than x dB(A)</fed:description>

            <fed:discoverable>true</fed:discoverable>

            <fed:experimentControl>

                <fed:scheduling>

                    <fed:startTime>2016-11-08T18:50:00.0Z</fed:startTime>

                    <fed:Periodicity>250</fed:Periodicity>

                    <fed:stopTime>2017-11-08T18:49:59.0Z</fed:stopTime>

                </fed:scheduling>

            </fed:experimentControl>

            <fed:experimentOutput location="http://ExperimentServer.org/store/"></fed:experimentOutput>

            <fed:queryControl>

                <prt:query-request>

                    <query><![CDATA[

                        # [1 / 1] visualization type: 'Gauge' and sensors

                        Prefix ssn: <http://purl.oclc.org/NET/ssnx/ssn#>

                        Prefix iotlite: <http://purl.oclc.org/NET/UNIS/fiware/iot-lite#>

                        Prefix dul: <http://www.loa.istc.cnr.it/ontologies/DUL.owl#>

                        Prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>

                        Prefix time: <http://www.w3.org/2006/time#>

                        Prefix m3-lite: <http://purl.org/iot/vocab/m3-lite#>

                        Prefix xsd: <http://www.w3.org/2001/XMLSchema#>

                        select ?s (max(?ti) as ?tim) ?val ?lat ?long

                        where {

                            ?o a ssn:Observation.

                            ?o ssn:observedBy ?s.  

                            ?o ssn:observedProperty ?qkr.

                            ?qkr a ?qk.

                            Values ?qk {m3-lite:Sound m3-lite:SoundPressureLevelAmbient}

                            ?o ssn:observationSamplingTime ?t.

                            ?o geo:location ?point.

                            ?point geo:lat ?lat.

                            ?point geo:long ?long.

                            ?t time:inXSDDateTime ?ti.

                            ?o ssn:observationResult ?or.

                            ?or  ssn:hasValue ?v.

                            ?v dul:hasDataValue ?val.

                            {

                                select  (max(?dt)as ?ti) ?s         

                                where {

                                    ?o a ssn:Observation.

                                    ?o ssn:observedBy ?s.  

                                    ?o ssn:observedProperty ?qkr.

                                    ?qkr a ?qk.

                                    Values ?qk {m3-lite:Sound m3-lite:SoundPressureLevelAmbient}

                                    ?o ssn:observationSamplingTime ?t.

                                    ?t time:inXSDDateTime ?dt.

                                }group by (?s)

                            }

                            FILTER (

                               (xsd:double(?lat) >= "-90"^^xsd:double)

                            && (xsd:double(?lat) <= "90"^^xsd:double)

                            && ( xsd:double(?long) >= "-180"^^xsd:double) 

                            && ( xsd:double(?long) <= "180"^^xsd:double)

                            )  

                            FILTER(?val>="75"^^xsd:double)

                        } group by (?s) ?tim ?val ?lat ?long

                    ]]></query>

                </prt:query-request>

              </fed:queryControl>

        </fed:FISMO>

        <fed:FISMO name="5thUseCase">

            <fed:description>3rd usecase with noise less than x dB(A)</fed:description>

            <fed:discoverable>true</fed:discoverable>

            <fed:experimentControl>

                <fed:scheduling>

                    <fed:startTime>2016-11-08T18:50:00.0Z</fed:startTime>

                    <fed:Periodicity>250</fed:Periodicity>

                    <fed:stopTime>2017-11-08T18:49:59.0Z</fed:stopTime>

                </fed:scheduling>

            </fed:experimentControl>

            <fed:experimentOutput location="http://ExperimentServer.org/store/"></fed:experimentOutput>

            <fed:queryControl>

                <prt:query-request>

                    <query><![CDATA[

                        # [1 / 1] visualization type: 'Gauge' and sensors

                        Prefix ssn: <http://purl.oclc.org/NET/ssnx/ssn#>

                        Prefix iotlite: <http://purl.oclc.org/NET/UNIS/fiware/iot-lite#>

                        Prefix dul: <http://www.loa.istc.cnr.it/ontologies/DUL.owl#>

                        Prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>

                        Prefix time: <http://www.w3.org/2006/time#>

                        Prefix m3-lite: <http://purl.org/iot/vocab/m3-lite#>

                        Prefix xsd: <http://www.w3.org/2001/XMLSchema#>

                        select ?s (max(?ti) as ?tim) ?val ?lat ?long

                        where {

                            ?o a ssn:Observation.

                            ?o ssn:observedBy ?s.  

                            ?o ssn:observedProperty ?qkr.

                            ?qkr a ?qk.

                            Values ?qk {m3-lite:Sound m3-lite:SoundPressureLevelAmbient}

                            ?o ssn:observationSamplingTime ?t.

                            ?o geo:location ?point.

                            ?point geo:lat ?lat.

                            ?point geo:long ?long.

                            ?t time:inXSDDateTime ?ti.

                            ?o ssn:observationResult ?or.

                            ?or  ssn:hasValue ?v.

                            ?v dul:hasDataValue ?val.

                            {

                                select  (max(?dt)as ?ti) ?s        

                                where {

                                    ?o a ssn:Observation.

                                    ?o ssn:observedBy ?s.  

                                    ?o ssn:observedProperty ?qkr.

                                    ?qkr a ?qk.

                                    Values ?qk {m3-lite:Sound m3-lite:SoundPressureLevelAmbient}

                                    ?o ssn:observationSamplingTime ?t.

                                    ?t time:inXSDDateTime ?dt.

                                }group by (?s)

                            }

                            FILTER (

                               (xsd:double(?lat) >= "-90"^^xsd:double)

                            && (xsd:double(?lat) <= "90"^^xsd:double)

                            && ( xsd:double(?long) >= "-180"^^xsd:double) 

                            && ( xsd:double(?long) <= "180"^^xsd:double)

                            )  

                            FILTER(?val<="45"^^xsd:double)

                        } group by (?s) ?tim ?val ?lat ?long

                    ]]></query>

                </prt:query-request>

</fed:queryControl>

        </fed:FISMO>

    </fed:FEMO>

</fed:FEDSpec>