1 m ea su re me nt Mo le cu l e (: m M olec u le ,(: t ype ,: M e as ur e D a ta ) ,(: floa t Val u e , " 96 .0 " ˆ ˆ : flo a t ) ,(: uom ,: fah re n he it ) ) : -
2 tri p le (: m1 ,: type ,: Me a su r e D at a ) & tri p le (: m1 ,: f l oat V alu e ,"9 6 .0 "ˆ ˆ : flo a t ) &
3 tri p le (: m1 ,: uom ,: f a h r en h e i t ) & uri (: mMole c ule ,[ f loa t ( "9 6 . 0 "ˆ ˆ : fl o a t ) , l oc a ln am e (: fah r e n he it ) ] ) .
(a) Datalog Rule 1. A measurement molecule with URI :mMolecule.
1 o bs er va ti on Mo le cu l e (: o M olec u le ,(: proc e d ure ,: T R19 7 ) ,(: type ,: T e m p O bs er va ti o n ),
2 (: o bs e rv e dP r op e rt y ,: Ai r Te m p ) ,[(: h a sObs ,: obs1 ) ] ) : -
3 tri p le (: obs1 ,: p roce d ure ,: T R19 7 ) & t r ipl e (: obs1 ,: t ype ,: T e m p O b se rv at i o n ) &
4 tri p le (: obs1 ,: obs e rv e dP r op e rt y ,: A ir T em p ) & t r ip l e (: obs1 ,: result ,: m1 ) &
5 tri p le (: m1 ,: f l oat V alu e ,"9 6 .0 "ˆ ˆ : flo a t ) & t r ipl e (: m1 ,: uom ,: fa h re nh e it )& uri (: oM o lecu l e ,[ l o c a ln a me (:
obs1 ) .
(b) Base Case of Datalog Rule 2. An observation molecule with URI :oMolecule.
1 o bs er va ti on Mo le cu l e (: o M olec u le ,(: proc e d ure ,: T R19 7 ) ,(: type ,: T e m p O bs er va ti o n ),
2 (: o bs e rv e dP r op e rt y ,: Ai r Te m p ) , EM = [ (: hasObs , : obs1 ) ,(: hasOb s ,: o b s2 ) ]) : -
3 o b s e r v a t i o n M o l e c ul e (: o1 ,(: proce d ure ,: T R19 7 ) ,(: type ,: Te mp Ob se r v a t i o n ) ,
4 (: ob s er v ed P ro p er t y ,: Air T em p ) ,[(: hasObs ,: ob s 1 ) ]) & o b s e r v a t i o n M o l e c u le (: o2 ,(: p r oced u re ,: T R 197 ) ,
5 (: type , : T e m p O b s e rv at io n ) ,(: ob s er ve d Pr o pe r ty ,: Ai r Te m p ) ,[( ssd : has O b s ,: o bs2 ) ]) &
6 E M 1 =[ ( : hasObs ,: o b s 1 ) | EM1 ] , t r ipl e (: obs1 ,: result , : m1) & tr i ple (: m1 ,: uom ,: f ah r en he i t ) &
7 tri p le (: m1 ,: f l oat V alu e ,"9 6 .0 "ˆ ˆ : flo a t ) & E M 2 =[ ( : hasObs ,: o b s 2 ) | EM2 ] & tri p le (: obs2 ,: res u l t ,: m2 ) &
8 tri p le (: m2 ,: uom , : fah re n he it ) & tr i pl e (: m2 ,: floa t Val u e , " 96 .0 " ˆˆ : flo a t ) & : m 1 !=: m2 &
9 u r i (: o M olec u le ,[ l oc a l n am e (: o1 ) , l oc a ln a me (: o2 ) ]) & con c at ([(: hasObs ,: ob s 1 ) ] ,[(: h a s O b s ,: o bs2 ) ] , E M )
.
(c) Recursive Case of Datalog Rule 2. An observation molecule with URI :oMolecule.
1 tr i pl e (: o Mole c u le , : result , : m Mo le c ul e ) : -
2 m e a s u r e m e n t M o l e c ul e (: mM o lecu l e ,(: type ,: M e a su re D a t a ) ,(: f l oat V a lue ,"96 .0 " ˆ ˆ : flo a t ) ,
3 (: uom ,: fah r e n he it ) ) & o b s e r v a t i o nM ol ec ul e (: oM o lecu l e , (: p roc e d ure ,: T R19 7 ) ,
4 (: type , : T e m p O b s e rv at io n ) ,(: ob s er ve d Pr o pe r ty ,: Ai r Te m p ) , EM = [ ( : h a sObs ,: obs1 ) | E M 1 ] ,
5 tri p le (: obs1 ,: r e s u l t ,: m1 ) , t r ipl e (: m1 ,: uom ,: fa h re n h e it ) , t rip l e (:m1 ,: fl o atV a lue , " 9 6. 0 " ˆ ˆ: f l o at ) .
(d) Datalog Rule 3. Observation and Measurement Molecules are Linked.
Figure 5: Example of Datalog Rules for Molecule Creation and Linking: (a) Rule 1 creates a measurement molecule
:mMolecule with value and unit. (b) Rule 2 is the base case to create the observation molecule :oMolecule. (c) Recursive
case of Rule 2 combines observation molecules that comprise observation molecule :oMolecule, i.e., molecules such that all
observation molecules with same sensor, observed phenomenon, observed property, measurement unit, and value; (d) Rule 3
links observation and measurement molecules. Molecules of measurements and observations are identified with URIs.
cache, we execute the same query five times by drop-
ping the cache just before running the first iteration of
the query; thus, data temporally stored in cache du-
ring the execution of iteration i can be used in itera-
tion i + 1. The RDF triple store GH-RDF-3X
6
is used
to execute the SPARQL queries. GH-RDF3X is built
on top of RDF-3X version 0.3.4., and it is tailored to
execute star-shaped queries and bushy tree plans.
Effectiveness of the Semantic Sensor Data Facto-
rization For evaluating the effectiveness of the pro-
posed factorization techniques and answer research
each query by performing the command sh -c "sync ; echo
3 > /proc/sys/vm/drop caches".
6
https://github.com/gh-rdf3x/gh-rdf3x. Downloaded on
March 2016
questions RQ1, we execute the factorized decompo-
ser on datasets D1, D2, and D3. The effectiveness
of the factorization approach is studied in terms of
the reduction of RDF triples (NT). Table 1 shows the
number of RDF triples (NT) in datasets D1, D2, and
D3 before and after the factorization. The results de-
monstrate that the proposed factorization techniques
are capable of reducing the RDF triples by at least
53.24%. Moreover, the results report that the factori-
zed representation of sensor observations requires in
average a small number of RDF triples, i.e., five RDF
triples instead of ten, while preserving all the infor-
mation within the original RDF graph. These results
allows us to positively answer research question RQ1,
i.e., factorized RDF graphs effectively reduce redun-
Efficient Processing of Semantically Represented Sensor Data
257