# QB4 MobOLAP: A Vocabulary Extension for Mobility OLAP on the Semantic Web
## 4 Results and Discussion
### Defining MD Data Instance in QB4 MobOLAP
Dimension values and measure values are associated with a fact F. Dimension values are denoted by \(f\to v(d_{i})\) and measure values denoted by \(f\to v(m_{j})\). The value of \(v(d_{i})\in I\), is the identifier of a level member in \(LM\) (\(l_{j}\)). The value of every measure \(m_{j}\) is a literal such that \(v(d_{i})\in L\). The RDF graph formulation of the fact members \(FM\) (\(F\)) is represented as:  
\[ \begin{array}{l}G\;I\;FM(F)\;=\;\cup_{n=1}^{m}\left(G{I_{fi}}\right)\\ \\ \cup_{n=1}^{m}\left(G{I_{fi}}\right)=\{(\text{id}(\text{f}_{i})\text{rdf:type qb:Observation})\}\cup\\ \cup_{l_{j}\in L(f_{i})}\left\{\left({id^{l}\;(f_{i})id^{S}\;(l_{j})id^{l}\; \left(v_{l_{j}}\right)\left|f_{i}\;\to\;v_{l_{j}}\right.\right)}\right\}\cup \\ \cup_{m_{k}\in M(f_{i})}\left\{\left({id^{l}(f_{i})id^{S}(m_{k})id^{l}\;(m_{m_{k }})\;\left|f_{i}\;\to\;v_{m_{k}}\right.\right)}\right\}\end{array} \]  
The RDF representation example below shows the fact member of FFB DW using the above definition. Note that the fact member and corresponding level members relating to dimensions are given with the prefix ffbi: _idS (a1D)_ is a surrogate key that links the fact member with the corresponding dimensions. Example 7  
#Measure Instance  
ffb:delivery_071219_1 rdf:type qb:Observation;  
ffb:truckKey ffb:truck_1;  
ffb:dateKey ffb:date_1;  
ffb:plantationKey ffb:plantation_1;  
ffb:Route \"TGEOFOINT((-7.7737022 110.4307821@2019-09-02 08:00:01, -7.7753163 110. The query involves some operations that are rolled-up along the Time and Truck dimensions. Then, the computation of the distance on the moving object data is conducted. Finally, slicing operations are performed for the Time dimension. ```
SELECT?month?truckKey(AVG(jsfn:length(?droute))as?lengthRoute) WHERE{?obsrdft:typeqb:Observation; ffb:truckKey?truckKey; ffb:dateKey?dateKey; ffb:Route?droute. ffb:Route?droute. ?dateKey@b4o:memberOfftb:date; ffb:quarter?quarter; ffb:year?year; ffb:month?month. FILTER(?quarter=3)&&(?year=2019)) GROUPBY?month?truckKey
```  
Query#2: Give the average delivery duration per truck owner in September 2019. The query involves some operations that are rolled-up along the Truck dimension. Then, the computation of the duration of the moving objects is conducted. Finally, slicing operations are performed for the Time dimension. ```
SELECT?oName(AVG(jsfn:Duration(?droute))as?RouteTimeSpan) WHERE{?obsrdftypeqb:Observation; ffb:truckKey?truckKey; ffb:detKey?datKey; ffb:Route?droute. ?dateKey qb4o:memberOfftb:date; ffb:month?month; ffb:year?year. ?truckKey@b4o:memberOfftb:truck; ffb:ownerName?oName. FILTER((?month=9)&&(?year=2019)) } GROUPBY?oName
```  
Query#3: Give the average duration of FFB delivery inside the Afdeling Alfa per truck owner. The query involves some operations that are rolled-up along the Truck dimension. Then, the computation of the duration of the moving objects and geometry operations is conducted. Finally, spatial-slicing operations are performed within areas as a spatial function, sfWithin. ```
SELECT?oName(AVG(jsfn:Duration(jsfn:insideGeometry(?droute,?drafelingGeo)))as?x) WHERE{?obsrdft:typeqb:Observation; ffb:truckKey?truckKey; ffb:Route?droute; ffb:plantationKey?plantationKey. ?plantationKey qb4o:memberOfftb:plantation; ffb:plantationGeo?plantationGeo. ?drafelingKey qb4o:memberOfffb:jafdeling; ffb:afdelingGeo?afdelingGeo; ffb:zfdelingName'Afdeling'. ?truckKey@b4o:memberOfftb:truck; ffb:ownerName?oName. FILTER((?month=9)&&(?year=2019)) GROUPBY?oName
```  
Query#4: Compute the truck's average speed from the farmer's plantation to the factory. The query involves spatiotemporal roll-up along the Truck dimension, speed computation of the delivery, and slicing of the truck and date dimension. SELECT?lplate (AVG(jsfn:TWAvg(jsfn:TSpeed(?drroute))) as?AvgSpeed)  
WHERE {  
?obs rdf:type qb:Observation;  
ffb:truckKey?truckKey;  
ffb:dateKey?dateKey;  
ffb:Route?drroute. ?truckKey \(\mathrm{\upd}\):memberOf ffb:truck;  
ffb:ownerName?NoName;  
ffb:licensePlate?lplate. ?dateKey \(\mathrm{\upd}\):memberOf ffb:date;  
ffb:year?year.