Stream Reasoning For Linked Data M. Balduini, J-P Calbimonte, O. Corcho, D. Dell'Aglio, E. Della Valle, and J.Z. Pan http://streamreasoning.org/sr4ld2013 SPARQLStream: Ontology- based access to data streams Jean-Paul Calbimonte, Oscar Corcho jp.calbimonte@upm.es, ocorcho@fi.upm.es http://www.oeg-upm.net/
Share, Remix, Reuse — Legally § This work is licensed under the Creative Commons Attribution 3.0 Unported License. § You are free: • to Share — to copy, distribute and transmit the work • to Remix — to adapt the work § Under the following conditions • Attribution — You must attribute the work by inserting – “ [source http://streamreasoning.org/sr4ld2013] ” at the end of each reused slide – a credits slide stating - These slides are partially based on “ Streaming Reasoning for Linked Data 2013 ” by M. Balduini, J-P Calbimonte, O. Corcho, D. Dell'Aglio, E. Della Valle, and J.Z. Pan http://streamreasoning.org/sr4ld2013 § To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ 2 http://streamreasoning.org/sr4ld2013
SPARQLStream § Virtual RDF views over data streams § Ontology-based access to data streams • Examples • Architecture • Underlying query processors § SPARQLStream language § Query rewriting • R2RML mappings § Resources 3 http://streamreasoning.org/sr4ld2013
Querying RDF Streams users, applications +streams +streams RDF Stream query processing RDF Stream Processor Wrap Import Where is the data coming from? Load Contino usly Existing streaming Sensor … data sources DSMS CEP middleware 4 http://streamreasoning.org/sr4ld2013
Virtual RDF views over data streams users, applications +streams SPARQLStream Virtual RDF Stream Morph-streams query processing RDF Stream Processor queries Sensor … data layer DSMS CEP middleware 5 http://streamreasoning.org/sr4ld2013
Already seen somewhere…? RDF SPARQL Query Processor R2RML Load, Mappings import DBMS 6 http://streamreasoning.org/sr4ld2013
Stream Processor Implementations CQL/Stream Borealis Data Stream Management Systems (DSMS) StreamMill NiagaraCQ TelegraphCQ Esper GEM Rapide Complex Event Processors (CEP) Oracle CEP Cayuga CEDR IBM InfoSphere Microsoft StreamInsight Hourglass Cosm Stream Data Middleware SStreamWare GSN Sybase CEP StreamBase Diverse query languages Different query capabilities Different query models 7 http://streamreasoning.org/sr4ld2013
Morph-streams: Overview SELECT ?proximity π FROM STREAM <http://streamreasoning.org/ timed,prox SensorReadings.srdf> [NOW–5 S] σ prox>10 WHERE { ?obs a ssn:ObservationValue; ω qudt:numericalValue ?proximity; 5 Seconds FILTER (?proximity>10) } sens SELECT prox FROM sens.win:time(5 sec) Query WHERE prox >10 Algebra rewriting expression SPARQL Stream SNEE Client Esper Query R2RML Processing Mappings GSN Cosm pull/push Data [tuples] translation [triples/ Other bindings] Morph-streams procesing SPARQL Stream queries https://github.com/jpcik/morph-streams 8 http://streamreasoning.org/sr4ld2013
SPARQLStream Language ISTREAM DSTREAM RSTREAM WINDOW FROM NAMED STREAM Underlying data source restrictions 9 http://streamreasoning.org/sr4ld2013
SPARQLStream: examples SPARQL Stream PREFIX sr4ld: <http://www.streamreasoning.org/ontologies/socialsensor,owl#> SELECT ?room FROM NAMED STREAM <http://www.streamreasoning.org/streams/socialsensor.srdf> [NOW-10 S] WHERE { ?obs sr4ld:observedBy ?sensor. ?obs sr4ld:where ?room. } All rooms where something was observed in the last 10s PREFIX sr4ld: <http://www.streamreasoning.org/ontologies/socialsensor,owl#> SELECT (COUNT(?person) AS ?nmb) ?room FROM NAMED STREAM <http://www.streamreasoning.org/streams/socialsensor.srdf> [NOW-10 S] WHERE { ?obs sr4ld:who ?pers. ?obs sr4ld:where ?room. } GROUP BY ?room Number of persons observed in each room in the last 10s 10 http://streamreasoning.org/sr4ld2013
SPARQLStream Language NamedStream à ‘FROM’ [‘NAMED’] ‘STREAM’ StreamIRI ‘[’ Window ‘]’ § Window à ‘NOW-’ Integer TimeUnit [ UpperBound ] [ Slide ] § à ‘TO NOW-’ Integer TimeUnit UpperBound § à ‘SLIDE’ Integer TimeUnit Slide § à ‘MS’ | ‘S’ | ‘MINUTES’| ‘HOURS’ | ‘DAY’ TimeUnit § SELECT ISTREAM ?room FROM NAMED STREAM <http://www.streamreasoning.org/streams/socialsensor.srdf> [NOW-10 S] WHERE { … Select à ‘SELECT’ [ Xstream ] [ Distinct | Reduced ] … § à ‘RSTREAM’ | ‘ISTREAM’ | ‘DSTREAM’ Xstream § 11 http://streamreasoning.org/sr4ld2013
Morph-streams: Overview SELECT ?proximity π FROM STREAM <http://streamreasoning.org/ timed,prox SensorReadings.srdf> [NOW–5 S] σ prox>10 WHERE { ?obs a ssn:ObservationValue; ω qudt:numericalValue ?proximity; 5 Seconds FILTER (?proximity>10) } sens SELECT prox FROM sens.win:time(5 sec) Query WHERE prox >10 Algebra rewriting expression SPARQL Stream SNEE Client Esper Query R2RML Processing Mappings GSN Cosm pull/push Data [tuples] translation [triples/ Other bindings] Morph-streams procesing SPARQL Stream queries https://github.com/jpcik/morph-streams 12 http://streamreasoning.org/sr4ld2013
Now, where is the data? . . . . . . (bob,room2) τ i (alice,room3) τ i+1 (luke,room1) τ i+1 . . . sensor (alice,room1) τ i-‑1 (carl,room1) τ i stream tuples (person,room,…) τ i Stream Schema DSMS, CEP, middleware can evaluate queries over this model 13 http://streamreasoning.org/sr4ld2013
Underlying Query Processors Esper SNEE • CEP/DSMS • DSMS/Sensor Network Query Evaluator • EPL language • Compile queries to sensor code SELECT prox FROM sensors.win:time(5 minute) SELECT prox FROM sensors [FROM NOW-5 WHERE prox >10 MINUTES TO NOW] WHERE prox >10 GSN Cosm/Xively • Sensor middleware • Sensor middleware • REST API • Open platform • REST API http://montblanc.slf.ch:22001/multidata? vs[0]=sensors& http://api.cosm.com/v2/feeds/14321/datastreams/ field[0]=proximity_field&c_min[0]=10& 4? from=15/05/2012+05:00:00&to=15/05/2012+10:00: start=2012-05-15T05:00:00Z&end=2012-05-15T1 00 0:00:00Z 14 http://streamreasoning.org/sr4ld2013
Underlying Query Processors SPARQLStream R2RML SELECT ?proximity π FROM STREAM <http://streamreasoning.org/SensorReadings.srdf> timed, [NOW–5 S] prox WHERE { σ ?obs a ssn:ObservationValue; Query prox>10 qudt:numericalValue ?proximity; rewriting FILTER (?proximity>10) } ω 5 Seconds sensors SELECT prox FROM sensors [FROM NOW-5 MINUTES TO NOW] WHERE prox >10 SNEE (DSMS) SELECT prox FROM sensors.win:time(5 minute) WHERE prox >10 Esper (CEP) http://montblanc.slf.ch:22001/multidata? vs[0]=sensors&field[0]=proximity_field&c_min[0]=10& from=15/05/2012+05:00:00&to=15/05/2012+10:00:00 GSN (middlwr) http://api.cosm.com/v2/feeds/14321/datastreams/4? start=2012-05-15T05:00:00Z&end=2012-05-15T10:00:00Z Cosm Xively http://streamreasoning.org/sr4ld2013 15
Underlying query processors Features Esper SNEE GSN Cosm/Xively Projection ✔ ✔ ✔ Fixed Proj expression ✔ ✔ ✖ ✖ Joins ✔ ✔✖ only window ✖ ✖ Union ✖ ✔✖ not windows ✔ ✖ Selection ✔ ✔ ✔ ✖✔ limited Aggregates ✔ ✔ ✔✖ ✖ Time window ✔ ✔ ✔ ✔ Tuple window ✔ ✔ ✔ ✖ R2S ✔ ✔ ✖ ✖ Conjunction, Disj ✔ ✖ ✖ ✖ Repetition pattern ✔ ✖ ✖ ✖ Sequence ✔ ✖ ✖ ✖ 16 http://streamreasoning.org/sr4ld2013
Configuring Morph-streams § Main ingredients: 1. Data streams Link both 2. Ontology (network) models 3. R2RML mappings 17 http://streamreasoning.org/sr4ld2013
SSN Ontology with other ontologies W3C SSN Ontology modeling our streaming data combine with domain ontologies 18 http://streamreasoning.org/sr4ld2013
Our simpler ontology… subClassOf where Observation Room observes subPropOf who Post Sensor discusses subClassOf authorOf Person We can use different ontologies for the same data 19 http://streamreasoning.org/sr4ld2013
Our simpler ontology… where Observation Room observes detec4ons (person, ¡ ¡room,…) Sensor who subClassOf Define mappings Person 20 http://streamreasoning.org/sr4ld2013
R2RML - Overview 21 http://streamreasoning.org/sr4ld2013
R2RML - Overview 22 http://streamreasoning.org/sr4ld2013
Encoding in R2RML the stream Mapping definition name stream :triplesMap a rr:TriplesMap; attributes rr:logicalTable [ rr:tableName ” sensors "; ] subject URI rr:subjectMap [ rr:template "http://streamreasoning.org/data/Observation/{ person }{ timed }"; rr:class sr4ld:Observation ; rr:graph sr4ld:socialstream.srdf ]; triple predicate + object rr:predicateObjectMap [ rr:predicate sr4ld:who ; rr:objectMap [ rr:template “http://streamreasoning.org/data/Person/{ person }” ]];. the object (a URI in this case) 23 http://streamreasoning.org/sr4ld2013
Now some code Morph-streams: § Coded in Scala § JAR bundle, use it from Scala or Java code § Maven, Sbt § Examples • One off query • Register continuous query • Pull data • Push • Basic REST § https://github.com/jpcik/morph-streams 24 http://streamreasoning.org/sr4ld2013
Recommend
More recommend