SCOVO examples

The following examples shows how to use SCOVO to model statistics for airline on-time arrivals and departures (based on a real-world example from a blog post).


@prefix ex: <http://example.org/on-time-flight#> .
@prefix scv: <http://purl.org/NET/scovo#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

 # domain schema definitions
 ex:TimePeriod rdfs:subClassOf scv:Dimension ;
   dc:title "time period" .
  
 ex:Q12006 rdf:type ex:TimePeriod ;
   dc:title "2006 Q1" ;
   scv:min "2006-01-01"^^xsd:date ;
   scv:max "2006-03-31"^^xsd:date .
 
 ex:OnTime rdfs:subClassOf scv:Dimension ; 
   dc:title "on-time arrivals or departures" .

 ex:ota rdf:type ex:OnTime ;
   dc:title "on-time arrivals" .
 
 ex:Airport rdfs:subClassOf scv:Dimension ;
   dc:title "airport" .
 
 ex:AtlantaHartsfield rdf:type ex:Airport ;
   dc:title "Atlanta, Hartsfield" .
 
 # dataset and data items instances     
 ex:ontime-flights rdf:type scv:Dataset ;
   dc:title "On-time Flight Arrivals and Departures at Major U.S. Airports: 2006" ;
   scv:datasetOf ex:AtlantaHartsfield-ota-2006-q1 .
 
 ex:AtlantaHartsfield-ota-2006-q1 rdf:type scv:Item ;
   rdf:value 74 ;
   scv:dataset ex:ontime-flights ;
   scv:dimension ex:Q12006 ;
   scv:dimension ex:ota ;
   scv:dimension ex:AtlantaHartsfield .
 		

When we want to find out about how many on-time arrivals there were for a certain airport in a given time period (from Feb 2006 to Aug 2006), the following SPARQL-query can do the job - try it out!:


PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX scv: <http://purl.org/NET/scovo#>
PREFIX ex:  <http://example.org/on-time-flight#>

SELECT ?airport_name ?period ?percent_ontime_arrivals
FROM <http://sw.joanneum.at/scovo/otf-example-full.rdf>
WHERE { 
  ?item rdf:type scv:Item ;
        scv:dimension ?airport;
        scv:dimension ?time_period;
        scv:dimension ex:ota ;
        rdf:value ?percent_ontime_arrivals .
  ?airport rdf:type ex:Airport ;
   dc:title ?airport_name .
  ?time_period rdf:type ex:TimePeriod ;
   scv:min ?min ;
   scv:max ?max ;
   dc:title ?period .
   FILTER ( ?min > "2006-02-01" && ?max < "2006-08-01")
}
 		

The following query can be used to list high-performing aiports (that is higher than 85 % on-time arrivals or departures, along with the time period) - try it out!:

	
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>

PREFIX scv: <http://purl.org/NET/scovo#>
PREFIX ex:  <http://example.org/on-time-flight#>

SELECT DISTINCT ?airport_name ?percent_ontime ?period ?ontime_type
WHERE { 
  ?item rdf:type scv:Item  ;
        scv:dimension ?airport ;
        scv:dimension ?time_period ;
        scv:dimension ?ontime ;
        rdf:value ?percent_ontime .
  ?airport rdf:type ex:Airport ;
   dc:title ?airport_name .
  ?time_period rdf:type ex:TimePeriod ;
    dc:title ?period .
  ?ontime rdf:type ex:OnTime ;
    dc:title ?ontime_type .
  FILTER ( ?percent_ontime > 85)
}   
ORDER BY DESC (?percent_ontime)