Benchmark Queries

Below is the list of all 13 queries, their description, syntax (Both CQELS and C-SPARQL). All quereis can also be downloaded from CityBench github repository.

Q1: What is traffic congestion level on each road of my planned journey?

Query description

This query monitors the traffic congestion from all traffic sensors located on the roads which are at the planned journey of user.

CQELS Query

select ?obId1 ?obId2 ?v1 ?v2
  
where {

?p1   a <http://www.insight-centre.org/citytraffic#CongestionLevel>.
?p2   a <http://www.insight-centre.org/citytraffic#CongestionLevel>.

stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData182955> [range 3s] 
{?obId1 a ?ob.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p1.
?obId1 <http://purl.oclc.org/NET/sao/hasValue> ?v1.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData182955<.
}
stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData158505> [range 3s]
{?obId2 a ?ob.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p2.
?obId2 <http://purl.oclc.org/NET/sao/hasValue> ?v2.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData158505>.
}}

C-SPARQL Query

select ?obId1 ?obId2 ?v1 ?v2
 from stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData182955> [range 3000ms step 1s]
 from stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData158505> [range 3000ms step 1s]
 FROM <http://127.0.0.1:9000/WebGlCity/RDF/SensorRepository.rdf> 
 
where {

?p1   a <http://www.insight-centre.org/citytraffic#CongestionLevel>.
?p2   a <http://www.insight-centre.org/citytraffic#CongestionLevel>.

 
{
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p1.
?obId1 <http://purl.oclc.org/NET/sao/hasValue> ?v1.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData182955>.
}

{
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p2.
?obId2 <http://purl.oclc.org/NET/sao/hasValue> ?v2.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData158505>.
}}

Q2: What are traffic congestion level and weather conditions on each road of my planned journey?

Query description

Q2 is similar to Q1 with an additional input streams for weather and provides weather sensors observations together with traffic sensors observations for each road at the planned journey of the user.

CQELS Query

select ?obId1 ?obId2 ?obId3 ?obId4 ?v1 ?v2 ?v3 ?v4
  
where {

?p1   a <http://www.insight-centre.org/citytraffic#Temperature>.
?p2   a <http://www.insight-centre.org/citytraffic#Humidity>.
?p3   a <http://www.insight-centre.org/citytraffic#WindSpeed>.
?p4   a <http://www.insight-centre.org/citytraffic#CongestionLevel>.

stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusWeatherData0> [range 3s ] 
{?obId1 a ?ob.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p1.
?obId1 <http://purl.oclc.org/NET/sao/hasValue> ?v1.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusWeatherData0>.

?obId2 a ?ob.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p2.
?obId2 <http://purl.oclc.org/NET/sao/hasValue> ?v2.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusWeatherData0>.

?obId3 a ?ob.
?obId3 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p3.
?obId3 <http://purl.oclc.org/NET/sao/hasValue> ?v3.
?obId3 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusWeatherData0>.

}
stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData158505> [range 3000ms]
{?obId4 a ?ob.
?obId4 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p4.
?obId4 <http://purl.oclc.org/NET/sao/hasValue> ?v4.
?obId4 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData158505>.
}}

C-SPARQL Query

select ?obId1 ?obId2 ?obId3 ?obId4 ?v1 ?v2 ?v3 ?v4
 FROM <http://127.0.0.1:9000/WebGlCity/RDF/SensorRepository.rdf> 
 FROM stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusWeatherData0> [range 3s step 1s] 
 FROM stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData158505> [range 3000ms step 1s]
 
where {

?p1   a <http://www.insight-centre.org/citytraffic#Temperature>.
?p2   a <http://www.insight-centre.org/citytraffic#Humidity>.
?p3   a <http://www.insight-centre.org/citytraffic#WindSpeed>.
?p4   a <http://www.insight-centre.org/citytraffic#CongestionLevel>.


{
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p1.
?obId1 <http://purl.oclc.org/NET/sao/hasValue> ?v1.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusWeatherData0>.


?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p2.
?obId2 <http://purl.oclc.org/NET/sao/hasValue> ?v2.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusWeatherData0>.


?obId3 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p3.
?obId3 <http://purl.oclc.org/NET/sao/hasValue> ?v3.
?obId3 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusWeatherData0>.
}

{
?obId4 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p4.
?obId4 <http://purl.oclc.org/NET/sao/hasValue> ?v4.
?obId4 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData158505>.
}}

Q3: What is average congestion level and estimated travel time at my path?

Query description

This query includes the aggregate functions and evaluates the average congestion level on all the road of the planned journey and then calculates the estimated travel time.

CQELS Query

### cannot get results on cqels
select ?obId1  ?obId3  ?v1  ?v3    ### not supported in cqels (((?v1+?v3)/2) as ?avgCongest)
  
where {

?p1   a <http://www.insight-centre.org/citytraffic#CongestionLevel>. 
?p3   a <http://www.insight-centre.org/citytraffic#CongestionLevel>.

stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData182955> [range 3s] 
{?obId1 a ?ob.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p1.
?obId1 <http://purl.oclc.org/NET/sao/hasValue> ?v1.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData182955>.



}
stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData158505> [range 3s]
{?obId3 a ?ob.
?obId3 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p3.
?obId3 <http://purl.oclc.org/NET/sao/hasValue> ?v3.
?obId3 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData158505>.


}}

C-SPARQL Query

select ?obId1  ?obId3  ?v1  ?v3   (((?v1+?v3)/2) as ?avgCongest)
 FROM <http://127.0.0.1:9000/WebGlCity/RDF/SensorRepository.rdf>  
from stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData182955> [range 3s step 1s] 
from stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData158505> [range 3s step 1s] 
where {
###  bind((?v1+?v3)/2) as ?avgCongest
###  bind((?v2+?v4)/2) as ?avgEstimatedTime

{?p1   a <http://www.insight-centre.org/citytraffic#CongestionLevel>.} 
 ###UNION{?p1   a <http://www.insight-centre.org/citytraffic#EstimatedTime>.}
{?p3   a <http://www.insight-centre.org/citytraffic#CongestionLevel>. }
 ###UNION{ ?p3   a <http://www.insight-centre.org/citytraffic#EstimatedTime>.}

{?obId1 a ?ob.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p1.
?obId1 <http://purl.oclc.org/NET/sao/hasValue> ?v1.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData182955>.



}
{?obId3 a ?ob.
?obId3 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p3.
?obId3 <http://purl.oclc.org/NET/sao/hasValue> ?v3.
?obId3 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData158505>.


}}

Q4: Which cultural event happenig now is closest to my current location?

Query description

This query consumes user location data streams and integrates it with background knowledge dataset containing list of cultural events to find out the closest cultural event in progress near the current location of the user.

CQELS Query


select ?evtId ?title ?obId2 ?lat1 ?lon1 ?lat2 ?lon2
from named 
where {

graph{
?evtId a ?ob.
?evtId <http://purl.oclc.org/NET/ssnx/ssn#featureOfInterest> ?foi. 
?foi <http://www.insight-centre.org/citytraffic#hasFirstNode> ?node. 
?node <http://www.insight-centre.org/citytraffic#hasLatitude> ?lat1.  
?node <http://www.insight-centre.org/citytraffic#hasLongitude> ?lon1. 
?evtId <http://purl.oclc.org/NET/sao/value> ?title.
 
}

stream <http://www.insight-centre.org/dataset/SampleEventService#UserLocationService> [range 3000ms] 
{?obId2 a ?ob.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p2.
?obId2 <http://purl.oclc.org/NET/sao/hasValue> ?v2.
?v2 <http://www.insight-centre.org/citytraffic#hasLatitude> ?lat2.
?v2 <http://www.insight-centre.org/citytraffic#hasLongitude> ?lon2.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#UserLocationService>.
}

Filter (((?lat2-?lat1)*(?lat2-?lat1)+(?lon2-?lon1)*(?lon2-?lon1))<0.1)
}

C-SPARQL Query

select ?evtId ?title ?node ?obId2 ?lat2 ?lon2 ?lat1 ?lon1

FROM <http://127.0.0.1:9000/WebGlCity/RDF/AarhusCulturalEvents.rdf>  

FROM stream <http://www.insight-centre.org/dataset/SampleEventService#UserLocationService> [range 3000ms step 1s] 

where {
?evtId a  <http://purl.oclc.org/NET/sao/Point>. 
?evtId <http://purl.oclc.org/NET/ssnx/ssn#featureOfInterest> ?foi . 
?foi <http://www.insight-centre.org/citytraffic#hasFirstNode> ?node . 
?node <http://www.insight-centre.org/citytraffic#hasLatitude> ?lat1 .  
?node <http://www.insight-centre.org/citytraffic#hasLongitude> ?lon1 . 
?evtId <http://purl.oclc.org/NET/sao/value> ?title. 

?obId2 a <http://purl.oclc.org/NET/ssnx/ssn#Observation>. 
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p2. 
?obId2 <http://purl.oclc.org/NET/sao/hasValue> ?v2. 
?v2 <http://www.insight-centre.org/citytraffic#hasLatitude> ?lat2. 
?v2 <http://www.insight-centre.org/citytraffic#hasLongitude> ?lon2. 
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#UserLocationService>.

Filter (((?lat2 - ?lat1)*(?lat2 - ?lat1) + (?lon2 - ?lon1)*(?lon2 - ?lon1)) < 0.1)
} 

Q5: What is traffic congestion level on the road where a cultural event X is happening? Notification for congestion level should be generated every minute starting from 10 minutes before event X endtime till 10 minutes after the event endtime.

Query description

Q5 is a conditional query which should be deployed at the occurrence of an event and have predefined execution duration. Pa

CQELS Query


select ?evtId ?title ?obId2 ?lat1 ?lon1 ?lat2 ?lon2
from named <culturalevents>
where {
?p2   a <http://www.insight-centre.org/citytraffic#CongestionLevel>. 
?p2   <http://purl.oclc.org/NET/ssnx/ssn#isPropertyOf> ?foi2.
?foi2 <http://www.insight-centre.org/citytraffic#hasStartLatitude> ?lat2. 
?foi2 <http://www.insight-centre.org/citytraffic#hasStartLongitude> ?lon2. 
 
graph \<culturalevents\> {
 ?evtId a ?ob.
?evtId <http://purl.oclc.org/NET/ssnx/ssn#featureOfInterest> ?foi. 
?foi <http://www.insight-centre.org/citytraffic#hasFirstNode> ?node. 
?node <http://www.insight-centre.org/citytraffic#hasLatitude> ?lat1.  
?node <http://www.insight-centre.org/citytraffic#hasLongitude> ?lon1. 
?evtId <http://purl.oclc.org/NET/sao/value> ?title.
 
}

 stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData158505> [range 3000ms ]
{?obId2 a ?ob.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p2.
?obId2 <http://purl.oclc.org/NET/sao/hasValue> ?v2.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData158505>.
}

Filter (((?lat2-?lat1)*(?lat2-?lat1)+(?lon2-?lon1)*(?lon2-?lon1))<0.1)
}

C-SPARQL Query

select  ?evtId ?title #?lat1 ?lon1

?obId2  ?lat2 ?lon2
from <http://127.0.0.1:9000/WebGlCity/RDF/AarhusCulturalEvents.rdf>  
from <http://127.0.0.1:9000/WebGlCity/RDF/SensorRepository.rdf>  
from stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData158505> [range 3000ms step 1s]
where {
?p2   a <http://www.insight-centre.org/citytraffic#CongestionLevel>. 
?p2   <http://purl.oclc.org/NET/ssnx/ssn#isPropertyOf> ?foi2.
?foi2 <http://www.insight-centre.org/citytraffic#hasStartLatitude> ?lat2. 
?foi2 <http://www.insight-centre.org/citytraffic#hasStartLongitude> ?lon2. 
 
 
{ ?evtId a ?ob.
?evtId <http://purl.oclc.org/NET/ssnx/ssn#featureOfInterest> ?foi. 
?foi <http://www.insight-centre.org/citytraffic#hasFirstNode> ?node. 
?node <http://www.insight-centre.org/citytraffic#hasLatitude> ?lat1.  
?node <http://www.insight-centre.org/citytraffic#hasLongitude> ?lon1. 
?evtId <http://purl.oclc.org/NET/sao/value> ?title.}

 
{?obId2 a ?ob.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p2.
?obId2 <http://purl.oclc.org/NET/sao/hasValue> ?v2.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData158505>.
}

Filter (((?lat2-?lat1)*(?lat2-?lat1)+(?lon2-?lon1)*(?lon2-?lon1)) < 0.1)
}

Q6: What are current parking conditions within range of 1 km from my cur- rent location?

Query description

This query represents a most common query issued by a parking application user to find out a nearby parking place.

CQELS Query


select ?obId1 ?obId2 ?lat1 ?lon1 ?lat2 ?lon2

where {
?p1   a <http://www.insight-centre.org/citytraffic#ParkingVacancy>.
?p1 <http://purl.oclc.org/NET/ssnx/ssn#isPropertyOf> ?foi1.
?foi1 <http://www.insight-centre.org/citytraffic#hasStartLatitude> ?lat1.
?foi1 <http://www.insight-centre.org/citytraffic#hasStartLongitude> ?lon1.

stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataKALKVAERKSVEJ> [range 20s slide 1s] 
{?obId1 a ?ob.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p1.
?obId1 <http://purl.oclc.org/NET/sao/hasValue> ?v1.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataKALKVAERKSVEJ>.
}
 stream <http://www.insight-centre.org/dataset/SampleEventService#UserLocationService> [range 3000ms] 
{?obId2 a ?ob.
?obId2 <http://purl.oclc.org/NET/sao/hasValue> ?v2.
?v2 <http://www.insight-centre.org/citytraffic#hasLatitude> ?lat2.
?v2 <http://www.insight-centre.org/citytraffic#hasLongitude> ?lon2.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#UserLocationService>.
}}

C-SPARQL Query

select ?obId1 ?obId2 ?lat1 ?lon1 ?lat2 ?lon2
from <http://127.0.0.1:9000/WebGlCity/RDF/SensorRepository.rdf>  
from stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataKALKVAERKSVEJ> [range 3s step 1s] 
from stream <http://www.insight-centre.org/dataset/SampleEventService#UserLocationService> [range 3000ms step 1s] 
where {
?p1   a <http://www.insight-centre.org/citytraffic#ParkingVacancy>.
?p1 <http://purl.oclc.org/NET/ssnx/ssn#isPropertyOf> ?foi1.
?foi1 <http://www.insight-centre.org/citytraffic#hasStartLatitude> ?lat1.
?foi1 <http://www.insight-centre.org/citytraffic#hasStartLongitude> ?lon1.


{?obId1 a ?ob.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p1.
?obId1 <http://purl.oclc.org/NET/sao/hasValue> ?v1.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataKALKVAERKSVEJ>.
}

{?obId2 a ?ob.
?obId2 <http://purl.oclc.org/NET/sao/hasValue> ?v2.
?v2 <http://www.insight-centre.org/citytraffic#hasLatitude> ?lat2.
?v2 <http://www.insight-centre.org/citytraffic#hasLongitude> ?lon2.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#UserLocationService>.
}}

Q7: Notify me, whenever a parking place near to my destination is full.

Query description

Q7 is a combination of travel planner and parking application, a user during her journey wants to be notified about parking situation close to her destination.

CQELS Query


select ?obId1 ?obId2 ?v1 ?v2 

where {
?p1   a <http://www.insight-centre.org/citytraffic#ParkingVacancy>.
?p2   a <http://www.insight-centre.org/citytraffic#ParkingVacancy>.

stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataKALKVAERKSVEJ> [range 3s ] 
{?obId1 a ?ob.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p1.
?obId1 <http://purl.oclc.org/NET/sao/hasValue> ?v1.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataKALKVAERKSVEJ>.
}
 stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataSKOLEBAKKEN> [range 3s ] 
{?obId2 a ?ob.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p2.
?obId2 <http://purl.oclc.org/NET/sao/hasValue> ?v2.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataSKOLEBAKKEN>.
}

Filter(?v1<1||?v2<1)
}


C-SPARQL Query


select ?obId1 ?obId2 ?v1 ?v2 
from <http://127.0.0.1:9000/WebGlCity/RDF/SensorRepository.rdf>  
from stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataKALKVAERKSVEJ> [range 3s step 1s] 
from stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataSKOLEBAKKEN> [range 3s step 1s] 
where {
?p1   a <http://www.insight-centre.org/citytraffic#ParkingVacancy>.
?p2   a <http://www.insight-centre.org/citytraffic#ParkingVacancy>.


{?obId1 a ?ob.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p1.
?obId1 <http://purl.oclc.org/NET/sao/hasValue> ?v1.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataKALKVAERKSVEJ>.
}

{?obId2 a ?ob.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p2.
?obId2 <http://purl.oclc.org/NET/sao/hasValue> ?v2.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataSKOLEBAKKEN>.
}

Filter(?v1 < 1 || ?v2 < 1 )
}

Q8: Which parking places are available near by the location of the library event X?

Query description

This query combines parking data streams with the static information about the library events to locate parking space nearby the library.

CQELS Query




select ?obId1 ?obId2 ?v1 ?v2 
from named 
where {
?p1   a <http://www.insight-centre.org/citytraffic#ParkingVacancy>.
?p2   a <http://www.insight-centre.org/citytraffic#ParkingVacancy>.

graph {
?evtId a ?ob.
?evtId <http://purl.oclc.org/NET/ssnx/ssn#featureOfInterest> ?foi. 
?foi <http://www.insight-centre.org/citytraffic#hasFirstNode> ?node. 
#?node <http://www.insight-centre.org/citytraffic#hasLatitude> ?lat1.  
#?node <http://www.insight-centre.org/citytraffic#hasLongitude> ?lon1. 
?evtId <http://purl.oclc.org/NET/sao/value> ?title.
}

stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataKALKVAERKSVEJ> [range 3s ] 
{?obId1 a ?ob.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p1.
?obId1 <http://purl.oclc.org/NET/sao/hasValue> ?v1.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataKALKVAERKSVEJ>.
}
 stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataSKOLEBAKKEN> [range 3s ] 
{?obId2 a ?ob.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p2.
?obId2 <http://purl.oclc.org/NET/sao/hasValue> ?v2.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataSKOLEBAKKEN>.
}

Filter(?v1>0||?v2>0)
}

C-SPARQL Query

select ?obId1 ?obId2 ?v1 ?v2 
from <http://127.0.0.1:9000/WebGlCity/RDF/SensorRepository.rdf>  
from <http://127.0.0.1:9000/WebGlCity/RDF/AarhusLibraryEvents.rdf>  
from stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataKALKVAERKSVEJ> [range 3s step 1s] 
from  stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataSKOLEBAKKEN> [range 3s step 1s] 
where {
?p1   a <http://www.insight-centre.org/citytraffic#ParkingVacancy>.
?p2   a <http://www.insight-centre.org/citytraffic#ParkingVacancy>.

{

?evtId <http://purl.oclc.org/NET/ssnx/ssn#featureOfInterest> ?foi. 
?foi <http://www.insight-centre.org/citytraffic#hasFirstNode> ?node. 
?node <http://www.insight-centre.org/citytraffic#hasLatitude> ?lat1.  
?node <http://www.insight-centre.org/citytraffic#hasLongitude> ?lon1. 
?evtId <http://purl.oclc.org/NET/sao/value> ?title.
}


{
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p1.
?obId1 <http://purl.oclc.org/NET/sao/hasValue> ?v1.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataKALKVAERKSVEJ>.
}

{
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p2.
?obId2 <http://purl.oclc.org/NET/sao/hasValue> ?v2.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataSKOLEBAKKEN>.
}

Filter(?v1 > 0 || ?v2 > 0)
}

Q9: What is parking availability status nearby the city event with cheapest tickets price?

Query description

Similar to Q8, this query locates parking availability near by a city event which has cheapest ticket price.

CQELS Query



### to find the nearest parking of the cheapest event, a sparql query with ORDERBY clause and distance filters needs to be executed,

select ?obId1 ?obId2 ?v1 ?v2 
from named <culturalevents>
where {
?p1   a <http://www.insight-centre.org/citytraffic#ParkingVacancy>.
?p2   a <http://www.insight-centre.org/citytraffic#ParkingVacancy>.

graph <culturalevents> {
?evtId a ?ob.
?evtId <http://purl.oclc.org/NET/ssnx/ssn#featureOfInterest> ?foi. 
?foi <http://www.insight-centre.org/citytraffic#hasFirstNode> ?node. 
?node <http://www.insight-centre.org/citytraffic#hasLatitude> ?lat1.  
?node <http://www.insight-centre.org/citytraffic#hasLongitude> ?lon1. 
?evtId <http://purl.oclc.org/NET/sao/value> ?title.
}

stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataKALKVAERKSVEJ> [range 3s ] 
{?obId1 a ?ob.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p1.
?obId1 <http://purl.oclc.org/NET/sao/hasValue> ?v1.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataKALKVAERKSVEJ>.
}
 stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataSKOLEBAKKEN> [range 3s ] 
{?obId2 a ?ob.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p2.
?obId2 <http://purl.oclc.org/NET/sao/hasValue> ?v2.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataSKOLEBAKKEN>.
}

}

C-SPARQL Query

### to find the nearest parking of the cheapest event, a sparql query with ORDERBY clause and distance filters needs to be executed,

select ?obId1 ?obId2 ?v1 ?v2 
from <http://127.0.0.1:9000/WebGlCity/RDF/AarhusCulturalEvents.rdf>  
from <http://127.0.0.1:9000/WebGlCity/RDF/SensorRepository.rdf>  
from stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataKALKVAERKSVEJ> [range 3s step 1s] 
from stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataSKOLEBAKKEN> [range 3s step 1s] 
where {
?p1   a <http://www.insight-centre.org/citytraffic#ParkingVacancy>.
?p2   a <http://www.insight-centre.org/citytraffic#ParkingVacancy>.

{
?evtId a ?ob.
?evtId <http://purl.oclc.org/NET/ssnx/ssn#featureOfInterest> ?foi. 
?foi <http://www.insight-centre.org/citytraffic#hasFirstNode> ?node. 
?node <http://www.insight-centre.org/citytraffic#hasLatitude> ?lat1.  
?node <http://www.insight-centre.org/citytraffic#hasLongitude> ?lon1. 
?evtId <http://purl.oclc.org/NET/sao/value> ?title.
}


{?obId1 a ?ob.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p1.
?obId1 <http://purl.oclc.org/NET/sao/hasValue> ?v1.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataKALKVAERKSVEJ>.
}
 
{?obId2 a ?ob.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p2.
?obId2 <http://purl.oclc.org/NET/sao/hasValue> ?v2.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusParkingDataSKOLEBAKKEN>.
}

}

Q10: Notify me every 10 minutes, about the highly polluted area in the city.

Query description

Q10 is an analytical query executed over the pollution data streams to find out which area in the city in the most polluted.

CQELS Query


### could not get results on cqels
select ?obId1 ?obId2 #?lat1 ?lon1 ?lat2 ?lon2 ?v1 ?v2

where {

?p1 <http://purl.oclc.org/NET/ssnx/ssn#isPropertyOf> ?foi1.
?foi1 <http://www.insight-centre.org/citytraffic#hasStartLatitude> ?lat1.
?foi1 <http://www.insight-centre.org/citytraffic#hasStartLongitude> ?lon1.

?p2 <http://purl.oclc.org/NET/ssnx/ssn#isPropertyOf> ?foi2.
?foi2 <http://www.insight-centre.org/citytraffic#hasStartLatitude> ?lat2.
?foi2 <http://www.insight-centre.org/citytraffic#hasStartLongitude> ?lon2.

### not supported in cqels
### BIND (?v1+?v2) as ?sumOfAPI
stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusPollutionData201399> [range 3s ] 
{?obId1 a ?ob.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p1.
?obId1 <http://purl.oclc.org/NET/sao/hasValue> ?v1.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusPollutionData201399>.
}
stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusPollutionData197626> [range 3s ] 
{?obId2 a ?ob.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p2.
?obId2 <http://purl.oclc.org/NET/sao/hasValue> ?v2.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusPollutionData197626>.
}}


C-SPARQL Query


select ?obId1 ?obId2 #?lat1 ?lon1 ?lat2 ?lon2 ?v1 ?v2 ((?v1+?v2) as ?sumOfAPI)
from stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusPollutionData201399> [range 3s step 1s] 
from stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusPollutionData184892> [range 3s step 1s] 
from <http://127.0.0.1:9000/WebGlCity/RDF/SensorRepository.rdf> 
where {

#?p1 <http://purl.oclc.org/NET/ssnx/ssn#isPropertyOf> ?foi1.
#?foi1 <http://www.insight-centre.org/citytraffic#hasStartLatitude> ?lat1.
#?foi1 <http://www.insight-centre.org/citytraffic#hasStartLongitude> ?lon1.

#?p2 <http://purl.oclc.org/NET/ssnx/ssn#isPropertyOf> ?foi2.
#?foi2 <http://www.insight-centre.org/citytraffic#hasStartLatitude> ?lat2.
#?foi2 <http://www.insight-centre.org/citytraffic#hasStartLongitude> ?lon2.


{?obId1 a ?ob.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p1.
?obId1 <http://purl.oclc.org/NET/sao/hasValue> ?v1.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusPollutionData201399>.
}

{?obId2 a ?ob.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p2.
?obId2 <http://purl.oclc.org/NET/sao/hasValue> ?v2.
?obId2 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusPollutionData184892>.
}}

Q11: Notify whenever no observation from weather sensor have been gener- ated in last 10 minutes.

Query description

Q11 helps to detect any faulty sensors which are not generating observations due to some reasons.

CQELS Query


### negation not supported in cqels
select ?obId1 

where {

 stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusWeatherData0> [range 3s ] 
{?obId1 a ?ob.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p1.
?obId1 <http://purl.oclc.org/NET/sao/hasValue> ?v1.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusWeatherData0>.
}
###Filter (!bound(?obId2))
}


C-SPARQL Query

### negation supported in csparql but cannot evaluate latency or completeness
Ask  
from stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusWeatherData0> [range 3s step 1s] 
where {

 
{?obId1 a ?ob.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p1.
?obId1 <http://purl.oclc.org/NET/sao/hasValue> ?v1.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusWeatherData0>.
}
Filter (!bound(?obId1))
}

Q12: Notify city administration, whenever congestion level at a certain road surpasses a predefined threshold over 3 times within last 20 minutes.

Query description

This query is a notification service for city administration for early detection of any possible worst traffic conditions on a certain area.

CQELS Query


### ?obId1 should be projected, however we cannot project it in this query as it demands ?obId1 to be grouped, which makes the semantics wrong.
### as a result the latency cannot be evaluated.

select (count(?obId1) as ?obCnt) 
  
where {

?p1   a <http://www.insight-centre.org/citytraffic#CongestionLevel>.


stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData186979> [range 3000ms]
{?obId1 a ?ob.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p1.
?obId1 <http://purl.oclc.org/NET/sao/hasValue> ?v1.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData186979>.
}
Filter(?v1>= -1)
}
### group by ?obId1 

having (count(?obId1) >3)

C-SPARQL Query

### ?obId1 should be projected, however we cannot project it in this query as it demands ?obId1 to be grouped, which makes the semantics wrong.
### as a result the latency cannot be evaluated.

select (count(?obId1) as ?obCnt) 
  from stream <http://www.insight-centre.org/dataset/SampleEventService#AarhusTrafficData186979> [range 3000ms step 1s]
  from <http://127.0.0.1:9000/WebGlCity/RDF/SensorRepository.rdf> 
where {

?p1   a <http://www.insight-centre.org/citytraffic#CongestionLevel>.



{?obId1 a ?ob.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedProperty> ?p1.
?obId1 <http://purl.oclc.org/NET/sao/hasValue> ?v1.
?obId1 <http://purl.oclc.org/NET/ssnx/ssn#observedBy> ?service1.
}
Filter(?v1 >= -1)
}
group by ?service1 

having (count(?obId1) > 3)

Q13: Increase the observation monitoring rate of traffic congestion if it surpasses a pre-specified threshold.

Query description

Q13 facilitates to provide a more frequent status of congestion level during critical conditions e.g. traffic jam or accident.

CQELS Query

Not supported by the RSP engine.

C-SPARQL Query

Not supported by the RSP engine.
* Note: The time window duration in the executable queries may be smaller than those implied by the textual descriptions of the 
queries, because a higher stream rate (compared to real-world sensor service update rate) is configured to accelerate the simulation. 
Hence smaller time windows are used.