| Listing 3. RSP-QL query used to compute per-sample activity-index values from synchronized three-axis accelerometer streams. The func:sqrt expression is an implementation-specific extension function provided by the employed RSP engine. |
| PREFIX saref: <https://saref.etsi.org/core/> PREFIX func: <http://extension.org/functions#> PREFIX dahccsensors: <https://dahcc.idlab.ugent.be/Homelab/SensorsAndActuators/> PREFIX : <https://rsp.js> REGISTER RStream <output> AS SELECT ( func:sqrt( ?accX * ?accX + ?accY * ?accY + ?accZ * ?accZ ) AS ?activityIndex ) FROM NAMED WINDOW :w1 ON STREAM :acc_x [RANGE 60000 STEP 20000] FROM NAMED WINDOW :w2 ON STREAM :acc_y [RANGE 60000 STEP 20000] FROM NAMED WINDOW :w3 ON STREAM :acc_z [RANGE 60000 STEP 20000] WHERE { WINDOW :w1 { ?s1 saref:hasValue ?accX . ?s1 saref:hasTimestamp ?timestamp . ?s1 saref:relatesToProperty dahccsensors:wearable.acceleration.x . } WINDOW :w2 { ?s2 saref:hasValue ?accY . ?s2 saref:hasTimestamp ?timestamp . ?s2 saref:relatesToProperty dahccsensors:wearable.acceleration.y . } WINDOW :w3 { ?s3 saref:hasValue ?accZ . ?s3 saref:hasTimestamp ?timestamp . ?s3 saref:relatesToProperty dahccsensors:wearable.acceleration.z . } } |