The following SPARQL queries demonstrate the capabilities of the OLOUD ontology. Using FILTERs results can be limited to specific entities (rooms, courses, etc.), as the examples below return all data.

1. What are the courses for a given subject in a specific semester?


PREFIX oloud:<http://lod.nik.uni-obuda.hu/oloud/oloud#>

SELECT DISTINCT ?course WHERE {
  ?course a <http://purl.org/vocab/aiiso/schema#Course> .
  ?course oloud:courseSubject <http://lod.nik.uni-obuda.hu/data/NAIAB0SAND> .
  ?course oloud:courseTerm <http://lod.nik.uni-obuda.hu/data/2014Fall> .
}
Try it!

2. On which day a given course is, what time does it starts and how long it is?


PREFIX oloud: <http://lod.nik.uni-obuda.hu/oloud/oloud#>
PREFIX ta: <http://ontology.ihmc.us/temporalAggregates.owl#>
PREFIX time: <http://www.w3.org/2006/time#>

SELECT DISTINCT ?course ?day ?beginhour ?beginminute ?durationhour ?durationminute WHERE {
  ?course a <http://purl.org/vocab/aiiso/schema#Course> .
  ?course oloud:courseTime ?ct .
  ?ct ta:hasTemporalAggregateDescription ?tad .
  ?tad ta:hasithTemporalUnit ?day ;
       ta:hasStart ?start .
  ?start time:hasDurationDescription ?dd ;
         time:hasBeginning ?begin .
  ?dd time:hours ?durationhour ;
      time:minutes ?durationminute .
  ?begin time:inDateTime ?begindatetime .
  ?begindatetime time:hour ?beginhour ;
                 time:minute ?beginminute .
}
Try it!

3. What courses are at the same time partially or completely overlapping?


PREFIX oloud: <http://lod.nik.uni-obuda.hu/oloud/oloud#>
PREFIX ta: <http://ontology.ihmc.us/temporalAggregates.owl#>
PREFIX time: <http://www.w3.org/2006/time#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?course1 ?course2 
{
?course1 oloud:courseTime ?ct1.
?ct1 ta:hasTemporalAggregateDescription ?ta1.
?ta1 ta:hasithTemporalUnit ?day;
	ta:hasStart ?s1.
?s1 time:hasBeginning ?begin1 ; 
    time:hasDurationDescription ?duration1.
?begin1 time:inDateTime  ?dt1 .
?dt1 time:hour ?hour1 ;
    time:minute ?minute1 .
?duration1 time:hours ?durationHour1;
 time:minutes ?durationMinute1.
?course2 oloud:courseTime ?ct2.
?ct2 ta:hasTemporalAggregateDescription ?ta2.
?ta2 ta:hasithTemporalUnit ?day;
	ta:hasStart ?s2.
?s2 time:hasBeginning ?begin2 .
?begin2 time:inDateTime  ?dt2 .
?dt2 time:hour ?hour2 ;
    time:minute ?minute2 .

BIND (xsd:integer(?minute1)+(xsd:integer(?hour1)*60) AS ?start1).
BIND (xsd:integer(?minute2)+(xsd:integer(?hour2)*60) AS ?start2).
BIND (xsd:integer(?durationMinute1)+(xsd:integer(?durationHour1)*60)+?start1 AS ?end1).
FILTER (?start1 < ?start2 && ?start2 < ?end1).
FILTER (?course1 != ?course2 ).
}
Try it!

4. What is the course schedule (with course identifier, time and lecturer) for a specific lecture hall or lab?


PREFIX oloud: <http://lod.nik.uni-obuda.hu/oloud/oloud#>
PREFIX ta: <http://ontology.ihmc.us/temporalAggregates.owl#>
PREFIX time: <http://www.w3.org/2006/time#>
PREFIX iloc: <http://lod.nik.uni-obuda.hu/iloc/iloc#>

SELECT DISTINCT ?course ?room ?day ?beginhour ?beginminute ?teacher WHERE {
  ?room a iloc:Room.
  ?course oloud:locatedAt ?room;
          oloud:courseTeacher ?teacher;
          oloud:courseTime ?ct .
  ?ct ta:hasTemporalAggregateDescription ?tad .
  ?tad ta:hasithTemporalUnit ?day ;
       ta:hasStart ?start .
  ?start time:hasDurationDescription ?dd ;
         time:hasBeginning ?begin .
  ?dd time:hours ?durationhour ;
      time:minutes ?durationminute .
  ?begin time:inDateTime ?begindatetime .
  ?begindatetime time:hour ?beginhour ;
                 time:minute ?beginminute .
}

Try it!

5. What are the required courses of a specific course?


PREFIX oloud: <http://lod.nik.uni-obuda.hu/oloud/oloud#>

SELECT DISTINCT ?dep WHERE {
  <http://lod.nik.uni-obuda.hu/data/NAIDR0SAND> oloud:subjectRequires ?dep
}


Try it!

6. Navigate from the main entrance to a specific course location!


PREFIX oloud: <http://lod.nik.uni-obuda.hu/oloud/oloud#>
PREFIX iloc: <http://lod.nik.uni-obuda.hu/iloc/iloc#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?distance ?sl ?l1 ?l2 ?l3 ?el WHERE {
<http://lod.nik.uni-obuda.hu/data/AB0_EA_2014-15-1> oloud:locatedAt ?end
BIND (<http://lod.nik.uni-obuda.hu/data/PB01> AS ?start ).
OPTIONAL {?start rdfs:label ?sl.}
OPTIONAL {?p1 rdfs:label ?l1.}
OPTIONAL {?p2 rdfs:label ?l2.}
OPTIONAL {?p3 rdfs:label ?l3.}
OPTIONAL {?end rdfs:label ?el.}
?start iloc:connectsPOI ?p1.
?p1 iloc:connectsPOI ?p2.
?p2 iloc:connectsPOI ?p3.
?plast iloc:belongsToRoom ?end.
FILTER (?p3 = ?plast || ?p2 = ?plast || ?p1 = ?plast )
BIND (if( ?p3 = ?plast , 3, if( ?p2 = ?plast , 2, if( ?p1 = ?plast , 1, -1))) AS ?distance)
} ORDER BY ?distance LIMIT 1



Try it!

7. What are the dates of the individual sessions of a given course?


PREFIX oloud: <http://lod.nik.uni-obuda.hu/oloud/oloud#>
PREFIX ta: <http://ontology.ihmc.us/temporalAggregates.owl#>
PREFIX time: <http://www.w3.org/2006/time#>

SELECT DISTINCT ?course ?day ?beginhour ?beginminute WHERE {
  ?course oloud:courseTime ?ct .
  ?ct ta:hasMember ?start .
  ?start time:hasDurationDescription ?dd ;
         time:hasBeginning ?begin .
  ?dd time:hours ?durationhour ;
      time:minutes ?durationminute .
  ?begin time:inDateTime ?begindatetime .
  ?begindatetime time:hour ?beginhour ;
                 time:minute ?beginminute .
}

Try it!