<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Rules and RDF Streams - A Position Paper</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>James Anderson</string-name>
          <email>james@dydra.com</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Tara Athan</string-name>
          <email>taraathan@inf.fu-berlin.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Adrian Paschke</string-name>
          <email>paschke@inf.fu-berlin.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Corporate Semantic Web, Freie Universitat Berlin</institution>
          ,
          <addr-line>Germany [taraathan</addr-line>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Datagraph</institution>
          ,
          <addr-line>GmbH</addr-line>
        </aff>
      </contrib-group>
      <abstract>
        <p>We propose a minor extension of the Graph Store Protocol and the SPARQL syntax that should be su cient to enable the application of rules to some kinds of RDF Streams (as de ned by the the RDF Stream Processing W3C Community Group) to generate new RDF streams. The IRI identifying an RDF stream is extended with a query string eld-value pair de ning a sequence of windows of the stream. The extended IRI is passed to a data concentrator, which recasts the stream as a dynamic RDF dataset. A SPARQL query may then be applied to this dynamic dataset whenever it is updated, i.e. when the content of the next window as been fully received. The SPARQL query uses the CONSTRUCT form to generate a new element of the resultant RDF stream. The approach is illustrated with a prototypical example from the healthcare domain.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>RDF Graph Stores are increasingly used in the private and public sector to
manage knowledge. In practice, although these Graph Stores can be dynamic, most
individual transactions involve either complete replacement or small changes.
When transactions are made by many users simultaneously or through streaming
from data sources, the rate of change can be quite fast, relative to the timescale
of query processing. E ectively delivering an up-to-date view (i.e. results of a
stored query) of a dynamic Graph Store in real time requires a di erent
approach to query processing than that implemented in most RDF query engines
currently available.</p>
      <p>
        The RDF standards have not addressed dynamics to a signi cant extent,
other than to informally propose a name: \We informally use the term RDF
source to refer to a persistent yet mutable source or container of RDF graphs.
An RDF source is a resource that may be said to have a state that can change
over time. A snapshot of the state can be expressed as an RDF graph." [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]
      </p>
      <p>The RDF Stream Processing Community Group3 is taking on a specialized
case of dynamic RDF called an RDF Stream, corresponding to the case of a
3 https://www.w3.org/community/rsp/
sequence of RDF datasets called \timestamped RDF graphs", where a
particular triple in the default graph has been designated as the timestamp triple.
A sequence of overlapping windows (contiguous subsequences) can, in general,
be considered as snapshots of a dynamic Graph Store4 such that whenever the
window shifts to a new position, a few stream elements expire from and a few
new stream elements are added to the dynamic Graph Store.
1.1</p>
      <p>
        Business Drivers
Autonomous, distributed sources will eventually yield data in quantities limited
only by the aggregate bandwidth of wireless transmission media. It has been
estimated, the market for devices and services in support of this processing will
reach a value in excess of twelve digits by 2020 [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. Based on the relative
expenditures by established telecommunication rms - such as AT&amp;T or Deutsche
Telekom, where the software budget constitutes roughly one percent of their
gross income [
        <xref ref-type="bibr" rid="ref3 ref4">3, 4</xref>
        ], one can expect the software costs to reach ten gures, of
which database services constitute an undisclosed, but substantial portion.
      </p>
      <p>The task to purposefully process this data promises to be formidable. A
service which leverages the advantages of RDF data processing, to provide a
mechanism for rule based integration, validation and evaluation of diverse streaming
data sources, will o er signi cant advantage.</p>
      <p>
        Particular drivers in this setting are the following:
{ develop a mechanism to augment assertions during query processing of
dynamic RDF Graph Stores, at basically the complexity of SPARQL construct
{ create means to express actions that should happen when a speci ed integrity
constraint is violated by a dynamic RDF Graph Store
{ implement real-time processing of such features with good scaling properties
in size and rate of change of the Graph Store
{ enable linked data to full l compliance requirements [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]
{ expand the query capabilities available to dynamic RDF Graph Store users,
by extending standard query capabilities over streams.
{ enhance the management capabilities of dynamic RDF Graph Store
publishers, by automating both internal updates and their propagation.
{ increase user and owner con dence in published RDF sources
{ increase dynamic RDF Graph Store customer satisfaction through
minimizing latency associated with automatic updates and integrity-constraint
checking
2
      </p>
    </sec>
    <sec id="sec-2">
      <title>Technological Challenges</title>
      <p>RDFS and OWL are the traditional technologies for expressing conceptual
models for RDF data, and can in theory be used to augment assertions during query
processing, e.g. SPARQL under the RDFS- or OWL-entailment regime.
4 Because blank nodes are shared between elements of an RDF stream, then the
dynamic Graph Store must also share blank nodes between versions if this
correspondence is to hold.</p>
      <p>Due to the Open World Assumption, RDFS and OWL models cannot be
used for validation of RDF according to a data model, except for the extreme
case that results in inconsistency.</p>
      <p>SPARQL queries express validation and integrity constraints well, but the
queries for these tasks are not intuitive, and thus are di cult to properly
construct and maintain. It is imperative that extensions to incorporate rules and
process data streams avoid compounding these di culties.</p>
      <p>
        The challenge is to develop a language with the optimum satisfaction of the
following characteristics:
{ syntax that is both intuitive for the audience (close to RDF) and su ciently
expressive
{ has well-de ned execution semantics
{ can be integrated into remote service control and data ows.
{ permits real-time performance, which requires e cient target data-set
generation (whether update di s or inherent stream structure) and an activation
network implementation. [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]
{ supports named graphs and RDF Datasets as static or dynamic sources
{ supports modularization
{ permits descriptions of reactions (e.g. to integrity constraint violations)
3
      </p>
    </sec>
    <sec id="sec-3">
      <title>RDF-Stream Options</title>
      <p>Numerous alternatives (see Table 1) have been proposed to query dynamic RDF
data. These include proposals for both streaming and versioned data. In order
to provide a service which supports queries of adequate complexity, we expect
we will need to provide the following combinations and variations:
{ treat queries as autonomous views in order to promote reuse;
{ separate query expressions from temporal attributes in order to permit
combinations;
{ permit temporal attributes to be computed as an aspect of query processing;
{ remain compatible with standard SPARQL in order to permit sharing and
simplify development
{ remain compatible with standard RDF data models
{ permit named graphs in order to ful l application requirements and permit
compatibility with standard encodings
{ restrict the processing model to just essential components in order to limit
the deployment and management complexity</p>
      <p>This perspective eliminates those proposals which either reify statements in
the data model or add a temporal term. It also argues against a processing model
which involves query re-writing and delegation. It also eliminates language
extensions which encode temporal attributes as static values in special clauses. It
leads to the proposal for Dydra, to combine REVISION and WINDOW speci
cations for temporal properties to designate the target dataset, and to make the
temporal state available through the function THEN (e.g. returns the time when
the processor had received all the elements in a stream window) and permit the
window or revision expression to contain variables, but otherwise to conform to</p>
      <sec id="sec-3-1">
        <title>SPARQL 1.1.</title>
        <p>4</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Rule-based Options</title>
      <sec id="sec-4-1">
        <title>There are several existing languages for applying rules to RDF.</title>
        <p>SPARQL Inferencing Notation (SPIN), also called SPARQL Rules, is a W3C
Member Submission5 as well as a \defacto industry standard"6 implemented
by Top Braid. The Member Submission de nes the SPIN syntax via a schema,
but does not provide semantics. In particular, although the SPIN submission
is claimed to be an alternative syntax for SPARQL, the transformation from
SPIN to SPARQL has not been published. Further, although SPIN uses an
RDF-based syntax, this alone is not su cient to achieve rule semantics; a
su ciently expressive entailment regime must be de ned (e.g. based on the
as-yet unpublished transformation to SPARQL) that asserts the constructed
source jointly with the queried sources.</p>
        <p>
          Shape Expressions Language (ShEx) is speci ed in a W3C member
submission7. It is intended to ll the same role for RDF graphs that the schema
language Relax NG lls for XML, and its design is inspired by Relax NG,
particular in its foundation on regular expressions. ShEx has both a compact
and an RDF-based syntax, in the same way that Relax NG has a compact
and an XML-based syntax. The execution semantics of ShEx is well-de ned,
but is of limited expressivity. In particular, ShEx does not support named
graphs or RDF Datasets. ShEx precedents are strictly targeted REST [
          <xref ref-type="bibr" rid="ref19">19</xref>
          ];
it is not clear whether ShEx is applicable to streams. ShEx does not support
modularization, but this extension could be easily incorporated following
the approach of Relax NG, or, better, a monotonic restriction of that
approach [
          <xref ref-type="bibr" rid="ref20">20</xref>
          ]. ShEx has no constructive capability, and so can only perform
validation.
        </p>
        <p>Shapes Constraint Language (SHACL) is intended as an successor and
extension of ShEx developed by the RDF Shapes Working Group.8. SHACL
does not support named graphs or RDF Datasets directly, but has an
advanced syntax that allows the use of SPARQL. SHACL does not support
modularization; it is not obvious how to make this extension. Like ShEx,
SHACL has no constructive capability, and so can only perform validation.
Semantic Web Rule Language (SWRL) is a W3C Member Submission9 with
well-de ned semantics having a logical expressivity that exceeds SPARQL.
5 SPIN - Overview and Motivation https://www.w3.org/Submission/2011/</p>
        <p>SUBM-spin-overview-20110222/
6 http://spinrdf.org/
7 Shape Expressions 1.0 De nition: https://www.w3.org/Submission/shex-defn/
8 https://www.w3.org/2014/data-shapes/wiki/Main_Page
9 https://www.w3.org/Submission/SWRL/
[[56]] GraphPatternNotTriples ::=</p>
        <p>OptionalGraphPattern | GroupOrUnionGraphPattern |
MinusGraphPattern | GraphGraphPattern |</p>
        <p>RevisionGraphPattern | WindowsGraphPattern | ServiceGraphPattern
[[60 a ]] RevisionGraphPattern ::=</p>
        <p>'REVISION ' ( Var | Revision | String ) GroupGraphPattern
[[60 b ]] WindowsGraphPattern ::=</p>
        <p>'WINDOWS ' WindowRef GroupGraphPattern
[[60 c ]] WindowRef ::= ( 'R ' Integer ? '/' ) ? WindowRelation
[[60 d ]] WindowRelation ::=</p>
        <p>Revision ( '/' ( Revision | XPathDuration )</p>
        <p>
          ( '/' ( XPathDuration | Integer ) )? )?
[[60 e ]] Revision ::= UUID | / HEAD (~[
          <xref ref-type="bibr" rid="ref1 ref2 ref3 ref4 ref5 ref6 ref7 ref8 ref9">0 -9</xref>
          ]+)?/ | XPathDateTime | Integer
[[111 b ]] NullOperator ::= 'RAND ' | 'NOW ' | 'UUID ' | 'STRUUID ' | 'THEN '
Due to the coverage of e.g. relations and functions with arbitrary arity, the
syntax is not close to RDF triples.
        </p>
        <p>
          Rule Interchange Format [
          <xref ref-type="bibr" rid="ref21">21</xref>
          ] (RIF) is a W3C Recommendation. It includes
a standard mapping from RDF triples to RIF frames10, allowing rules to be
applied to RDF triples. This approach requires recasting RDF into RIF,
violating the requirement to remain close to RDF. Also it is not clear if RIF
is applicable to RDF datasets and Graph Stores, as the mapping of RDF
triples to RIF frames does not address this form.
        </p>
        <p>Each of the existing languages described above has drawbacks that make it
unsatisfactory relative to the evaluation criteria of the business case. Instead,
we consider a minor extension to SPARQL and the Graph Store protocol.
Figure 1 describes the grammar extensions to support elementary dataset
revisions, dataset interval revisions, and repeated interval datasets (aka windows of
streams).</p>
        <p>Figures 3 and 4 illustrates a query which combines static base data with a
temporal clause - in this case in the \validity time" domain, with a clause for
which the dataset constitutes a stream.</p>
        <p>Figure 2 depicts how the generated solution propagation graph is amenable
to a static temporality analysis, based upon which the process control is tailored
to the dataset form.</p>
        <p>
          In Figure 3, we show a query supporting the \connected patient" scenario
[
          <xref ref-type="bibr" rid="ref22">22</xref>
          ]; the patient is monitored with physiology (including heart rate) and activity
sensors. The objective is to notify a designated responder with an SMS message
when there is a combination of sensor readings suggesting an abnormally elevated
heart rate that is not explained by vigorous physical activity. A sequence of
windows of the heart rate and activity sensors are de ned by strings of the form
'?WINDOWS=R/HEAD/PT05M/PT01M', which de ne a sequence of window functions
that are applied to the stream. Following ISO-8601 [
          <xref ref-type="bibr" rid="ref23">23</xref>
          ], the text R/ means a
Compatibility
        </p>
        <p>https://www.w3.org/TR/rif-rdf-owl/#RDF_
10 RIF-RDF</p>
        <p>Compatibility</p>
        <p>James</p>
        <p>Anderson
et</p>
        <p>al.
the pro cessor, a data concentrator comp onent, to start the windowing op eration
as
so on
as
p ossible.</p>
        <p>The
text</p>
        <p>PT05M/
sp eci
es
the
duration
of
the
temp oral
interval
of the time-based window function, while
PT01M/ sp eci
es the duration
of
the
interval
b etween
start
p oints
of
adjacent window
functions.</p>
      </sec>
      <sec id="sec-4-2">
        <title>The query,</title>
        <p>written in the syntax of the prop osed SPARQL extension, constructs the content
of the SMS message.</p>
      </sec>
      <sec id="sec-4-3">
        <title>The approach illustrated in</title>
        <p>datatyp e xsd:dateTimeStamp, and no two elements
in
the stream have the same
timestamp,
giving a total order
to the
stream
elements.</p>
      </sec>
      <sec id="sec-4-4">
        <title>This</title>
        <p>p ermits
a unique
interpretation
of</p>
      </sec>
      <sec id="sec-4-5">
        <title>HEAD as the most</title>
        <p>recent window
of the stream.</p>
        <p>For simplicity, in
the concatenation ab ove, the IRI
of the RDF
stream is
assumed to not already have a query string. It is
straight-forward to accommo date
this
p ossibility
in</p>
        <p>the query.
11</p>
        <p>RDF</p>
        <p>Distinct</p>
        <p>Time-Series
pro
le
http://streamreasoning.github.
io/RSP- QL/Abstract%20Syntax%20and%20Semantics%20Document/
#distinct- time- series- profile</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Implementation Approach</title>
      <p>The proposed approach, to express temporal speci cations in a SPARQL dataset
designator, has its origin in the unique architecture of Dydra12, Datagraph's
SPARQL query service. This comprises two independent components, the RDF
data store and the SPARQL query processor. These communicate through a
limited interface, which allows the processor just to associate a speci c dataset
revision with an access transaction as the target and to use statement patterns
to perform count, match and scan operations on this target.</p>
      <p>The following changes will su ce to support streams based on this
architecture:
{ Extend the RDF store SPARQL Graph Store Protocol implementation to
interpret intra-request state to indicate transaction boundaries. This can be
HTTP chunking boundaries, RDF graph boundaries, or some other marker.
Based on current import rates, the store should be able to accept 105
statements per second per stream with the e ective rate for sensor readings
dependent on the number of statements per reading.
{ Extend the dataset designators to designate the dataset state which
corresponds to some speci c set of transactions. The speci cation will permit
combinations of temporal and cardinality constraints.
{ Extend the query processor control model from one which performs a single
reduction of an algebra graph to one in which individual branches can be
reiterated according to their temporal attributes, while unchanged
intermediate results are cached and re-used.
{ Extend the response encoding logic to permit alternative stream
packaging options, among them, repeated http header/content encoding and http
chunking with and without boundary signi cance.
6</p>
    </sec>
    <sec id="sec-6">
      <title>Conclusion and Future Work</title>
      <p>We have presented the grammar for a SPARQL extension and described a related
Graph Store protocol extension that enables a sliding window operation on an
RDF stream to be interpreted as a dynamic dataset. We illustrated the usage of
this extension to describe a continuous query, with rules given in the SPARQL
CONSTRUCT/WHERE form, on an RDF Stream in the distinct time-series
pro le with a sample query and a data propagation diagram.</p>
      <p>Future work includes generalizing the SPARQL and Graph Store protocol
extensions to cover a larger class of RDF streams, and demonstrating the feasibility
and performance of the extension with a prototype implementation.</p>
    </sec>
    <sec id="sec-7">
      <title>Acknowledgement</title>
      <p>This work has been partially supported by the \InnoPro le-Transfer Corporate
Smart Content" project funded by the German Federal Ministry of Education
12 http://dydra.com
and Research (BMBF) and the BMBF Innovation Initiative for the New German
Lander - Entrepreneurial Regions. The authors wish to thank Davide Sottara of
Arizona State University for assistance developing the connected patient query,
and the reviewers for helpful suggestions.
temporal literal, R a revision identi er and G a graph name. Temporality indicates
whether temporal properties are speci ed through variables bound and constrained in
a BGP and/or through a dataset clause.</p>
      <p>XXXXXXXXX</p>
      <p>Feature
Proposal</p>
      <sec id="sec-7-1">
        <title>Data</title>
        <p>Model</p>
      </sec>
      <sec id="sec-7-2">
        <title>Temporality</title>
        <p>
          temporal RDF
[
          <xref ref-type="bibr" rid="ref9">9</xref>
          ]
((S
        </p>
        <p>O)</p>
        <p>T )</p>
        <p>
          BGP
TriplePattern ::= (Subject Predicate Object ) : [T]
R&amp;W Base
[
          <xref ref-type="bibr" rid="ref10">10</xref>
          ]
        </p>
        <p>
          ((S
Datatset ::= FROM VersionIri
R34ples
C-SPARQL
CQELS
[
          <xref ref-type="bibr" rid="ref11">11</xref>
          ]
[
          <xref ref-type="bibr" rid="ref12">12</xref>
          ]
[
          <xref ref-type="bibr" rid="ref13">13</xref>
          ]
((S
((S
Datatset ::= FROM Graph REVISION VersionIdentifier
Datatset ::= FROM Iri Window?
        </p>
        <p>Window ::= ( RANGE Number TimeUnit ( ( STEP Number TimeUnit ) | TUMBLING ) )
| ( TRIPLES Number )
((S
((S</p>
        <p>P
P</p>
        <p>O)
O)</p>
        <p>T ) +</p>
        <p>T )</p>
      </sec>
      <sec id="sec-7-3">
        <title>Dataset</title>
        <p>GraphPatternNotTriples ::= ... | StreamGraphPattern</p>
        <p>
          StreamGraphPattern ::= RANGE [ Window ] VarOrIRIReference TriplesTemplate
Window ::= ( RANGE Number TimeUnit ( SLIDE Number TimeUnit )? )
| ( TRIPLES Number ) | NOW | ALL
SPARQL Stream [
          <xref ref-type="bibr" rid="ref14">14</xref>
          ]
((S
        </p>
        <p>P</p>
        <p>O)</p>
        <p>T )</p>
      </sec>
      <sec id="sec-7-4">
        <title>Dataset</title>
        <p>Datatset ::= FROM STREAM Iri Window ?
Window ::= FROM NOW ( - Number TimeUnit )?
TO NOW ( - Number TimeUnit )?
( STEP Number TimeUnit ) ?</p>
      </sec>
      <sec id="sec-7-5">
        <title>SPARQL 1.1 application compatible graphs yes</title>
        <p>"virtual",
graph</p>
        <p>R
no,
no,
graph
graph</p>
        <p>R</p>
        <p>
          T
yes
yes
yes
yes
no
yes
EP-SPARQL
[
          <xref ref-type="bibr" rid="ref15">15</xref>
          ] ((S
        </p>
        <p>P</p>
        <p>O)</p>
        <p>T</p>
        <p>T ) BGP
GraphPatternNotTriples ::= ... | SeqGraphPattern | EqualsGraphPattern
| OptionalSeqGraphPattern | OptionalEqualsGraphPattern</p>
        <p>
          NullOperator ::= ... | getDURATION | getENDTIME | getSTARTTIME
INSTANS
Verb ::= ... | :hasWindow
DIACHRON
[
          <xref ref-type="bibr" rid="ref16">16</xref>
          ]
[
          <xref ref-type="bibr" rid="ref17">17</xref>
          ]
(S
((S
        </p>
        <p>O</p>
        <p>G)</p>
        <p>BGP
O)</p>
        <p>R)
federated
metadata</p>
      </sec>
      <sec id="sec-7-6">
        <title>RETE rewrite, delegate</title>
        <p>
          SourceClause ::= ... | ( FROM DATASET URI ( AT VERSION URI )? ) | ( FROM CHANGES URI ( BEFORE VERSION URI )? )
| ( AFTER VERSION URI ) | ( BETWEEN VERSIONS URI URI )
SourcePattern ::= ... | (DATASET URI ( AT VERSION URI )? ) | ( CHANGES URI ( BEFORE VERSION URI )? )
| ( AFTER VERSION URI ) | ( BETWEEN VERSIONS URI URI )
Dydra
[
          <xref ref-type="bibr" rid="ref18">18</xref>
          ]
(S
        </p>
        <p>O</p>
        <p>G)
RevisionGraphPattern ::= 'REVISION' ( Var | Revision | String ) GroupGraphPattern
WindowsGraphPattern ::= 'WINDOWS' WindowRef GroupGraphPattern</p>
        <p>BGP
Dataset
algebra
reduction yes
O)</p>
        <p>R)</p>
        <p>BGP
O)
O)</p>
        <p>R)
T )</p>
        <p>BGP</p>
      </sec>
      <sec id="sec-7-7">
        <title>Dataset reduction yes</title>
        <p>P
P
P
P
P
P
P</p>
      </sec>
      <sec id="sec-7-8">
        <title>Process</title>
        <p>Model
algebra
reduction
rewrite,
generate
dataset,
delegate
rewrite,
generate
dataset,
algebra
algebra
reduction
rewrite
(SQL),
delegate
rewrite
(DSMS),
delegate
rewrite
(PROLOG),
delegate
no
yes
no
no
no
yes
no
no
PREFIX fhir : &lt;http :// hl7 / org / fhir /&gt;
PREFIX obs : &lt;http :// hl7 / org / fhir / Observation .&gt;
PREFIX sct : &lt;http :// snomed . info / id /&gt;
PREFIX prov : &lt;http :// www . w3 . org / ns / prov #&gt;
PREFIX lr : &lt;http :// localhost / local - records #&gt;
CONSTRUCT {</p>
        <p>GRAPH ? elementID {
? obsID a &lt;http :// hl7 / org / fhir / Observation &gt;;
obs : subject ? patient ;
obs : effectiveDateTime ? heartRate_time ;
obs : code &lt;http :// localhost / local - records # AbnormallyHighHeartRate &gt; ;
obs : valueCodeableConcept [ fhir : CodeableConcept . text 'yes ' ] .
}
? elementID prov : generatedAtTime ? generatedTime ;
# this would likely be provided with the request as a protocol parameter
lr : stream &lt;urn : uuid : b4f166f6 -387c -11 e6 -83 de -180373 ae0412 &gt; .
}
# determine heart rate exceeding some limit
# based on history , activity and institutional factors
WHERE {
# this would likely be provided with the request as a protocol parameter
BIND ( &lt; patient / @pat2 &gt; AS ? patient )
? patient lr : isConnectedTo ? heartRateSensor .
? heartRateSensor lr : hasStreamID ? heartRateStreamID ;</p>
        <p>a lr : HeartRateSensor .
? patient lr : isConnectedTo ? activitySensor .
? activitySensor lr : hasStreamID ? activityStreamID ;</p>
        <p>a lr : ActivitySensor .
} }
? patient fhir : Patient . birthDate ? birthdate .</p>
        <p>BIND ( ( YEAR ( NOW ()) - ? birthdate ) AS ? age )</p>
        <p>VALUES ( ? ageLevel ? ageMin ? ageMax ? ageFactor ) {
( lr : elderly 70 120 0.7 )
( lr : midaged 30 70 1.0 )
( lr : young 0 30 1.3 )
}
FILTER ( ? age &gt;= ? ageMin &amp;&amp; ? age &lt; ? ageMax )
VALUES (? activityLevel ? energyExpMin ? energyExpMax ? activityFactor ) {
( lr : high 25 100 2.0)
( lr : medium 11 25 1.0)
( lr : low 0 10 0.7 )
}
FILTER ( ? maxEnergyExp &gt;= ? energyExpMin * ? ageFactor &amp;&amp;</p>
        <p>? maxEnergyExp &lt; ? energyExpMax * ? ageFactor )
BIND ( ( (1 + ? patient_heartRate_std ) * ? activityFactor )</p>
        <p>AS ? relHeartRate_delta_threshold )
BIND ( (? heartRate_base * (1 + ? relHeartRate_delta_threshold ))</p>
        <p>AS ? heartRate_threshold )
# determine current pulse averages from sensors
BIND ( IRI ( CONCAT ( STR (? heartRateStreamID ), '? WINDOWS =R/ HEAD / PT05M / PT30S '))</p>
        <p>AS ? service_heartRate_ST )</p>
        <p>SERVICE ? service_heartRate_ST
{ SELECT ( AVG (? heartRate ) AS ? heartRate_avgST )
# if the transaction timestamp , instead
# ( THEN () AS ? heartRate_time )
( MAX (? heartRateTime ) AS ? heartRate_time )
WHERE {
?g prov : generatedAtTime ? gen .
{ GRAPH ?g {
[] a &lt;http :// hl7 . org / fhir / Observation &gt; ;
obs : effectiveDateTime ? heartRateTime ;
obs : code &lt;http :// snomed . info / sct :36407505 &gt; ; # heart rate
obs : valueQuantity [ fhir : Quantity . value ? heartRate ;</p>
        <p>fhir : Quantity . unit 'bpm ' ] .
} } } }
# test limit
FILTER ( ? heartRate_avgST &gt; ? heartRate_threshold )
# iff it gets this far , it will generate a result observation
BIND ( UUID () AS ? obsID )
BIND ( UUID () AS ? elementID )
BIND ( NOW () AS ? generatedTime )</p>
        <p>Fig. 4. Combined base-data, temporal and streaming query, continued</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Cyganiak</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wood</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lanthaler</surname>
            ,
            <given-names>M.:</given-names>
          </string-name>
          <article-title>RDF 1.1 concepts and abstract syntax</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Norton</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          :
          <article-title>Internet of things market to reach 1.7 trillion by 2020: IDC</article-title>
          . http://blogs.wsj.com/cio/2015/06/02/ internet-of
          <article-title>-things-market-to-reach-1-7-trillion-</article-title>
          <string-name>
            <surname>by-</surname>
          </string-name>
          2020-idc/ (
          <year>June 2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3. AT&amp;T, Inc.: mobilizing your world: AT&amp;T inc.
          <year>2015</year>
          <article-title>annual report</article-title>
          . http://www.att.com/Investor/ATT_Annual/2015/downloads/att_ar2015_ completeannualreport.pdf (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>Deutsche</given-names>
            <surname>Telekom</surname>
          </string-name>
          :
          <article-title>Answers for the digital future: The 2015 nancial year</article-title>
          . http: //www.telekom.com/static/-/298764/9/
          <fpage>160225</fpage>
          -q4
          <string-name>
            <surname>-</surname>
          </string-name>
          allinone-si (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Solbrig</surname>
            ,
            <given-names>H.R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Prudhommeaux</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sharma</surname>
            ,
            <given-names>D.K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Chute</surname>
            ,
            <given-names>C.G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Jiang</surname>
          </string-name>
          , G.:
          <article-title>Feasibility of modeling hl7 fhir pro les using rdf shape expressions language</article-title>
          .
          <source>In: SWAT4LS</source>
          <year>2015</year>
          ;
          <article-title>Semantic Web Applications and Tools for Life Sciences</article-title>
          . Volume
          <volume>1296</volume>
          <source>of CEUR. CEUR-WS.org/</source>
          Vol-
          <volume>1546</volume>
          / 208{
          <fpage>209</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Rinne</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nuutila</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Trm</surname>
            ,
            <given-names>S.:</given-names>
          </string-name>
          <article-title>INSTANS: High-performance event processing with standard RDF and SPARQL</article-title>
          .
          <source>In: 11th International Semantic Web Conference ISWC</source>
          <year>2012</year>
          ,
          <article-title>CEUR-WS</article-title>
          .org/Vol-
          <volume>914</volume>
          /
          <fpage>101</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Rinne</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Abdullah</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          , Torma,
          <string-name>
            <given-names>S.</given-names>
            ,
            <surname>Nuutila</surname>
          </string-name>
          , E.:
          <article-title>Processing heterogeneous RDF events with standing sparql update rules</article-title>
          .
          <source>In: On the Move to Meaningful Internet Systems: OTM 2012</source>
          . Springer (
          <year>2012</year>
          )
          <volume>797</volume>
          {
          <fpage>806</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Rinne</surname>
            , M.,
            <given-names>T</given-names>
          </string-name>
          orma,
          <string-name>
            <given-names>S.</given-names>
            ,
            <surname>Nuutila</surname>
          </string-name>
          , E.:
          <article-title>Sparql-based applications for rdf-encoded sensor data</article-title>
          .
          <source>In: Semantic Sensor Networks. Volume 904. CEUR-WS.org/</source>
          Vol-
          <volume>904</volume>
          / (
          <year>2012</year>
          )
          <volume>81</volume>
          {
          <fpage>96</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Gutierrez</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hurtado</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Vaisman</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Temporal RDF</article-title>
          .
          <source>In: European Semantic Web Conference</source>
          , Springer (
          <year>2005</year>
          )
          <volume>93</volume>
          {
          <fpage>107</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Sande</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Colpaert</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Verborgh</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Coppens</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mannens</surname>
          </string-name>
          , E.,
          <string-name>
            <surname>de</surname>
            <given-names>Walle</given-names>
          </string-name>
          , R.:
          <string-name>
            <surname>R</surname>
          </string-name>
          &amp;
          <article-title>Wbase: git for triples</article-title>
          .
          <source>In: Linked Data on the Web Workshop</source>
          . (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Graube</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hensel</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Urbas</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          :
          <article-title>R43ples: Revisions for triples</article-title>
          .
          <source>Proc. of LDQ</source>
          (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Barbieri</surname>
            ,
            <given-names>D.F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Braga</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ceri</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Valle</surname>
            ,
            <given-names>E.D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Grossniklaus</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Querying RDF streams with C-SPARQL</article-title>
          .
          <source>ACM SIGMOD Record</source>
          <volume>39</volume>
          (
          <issue>1</issue>
          ) (
          <year>2010</year>
          )
          <volume>20</volume>
          {
          <fpage>26</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Le-Phuoc</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dao-Tran</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Parreira</surname>
            ,
            <given-names>J.X.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hauswirth</surname>
            ,
            <given-names>M.:</given-names>
          </string-name>
          <article-title>A native and adaptive approach for uni ed processing of linked streams and linked data</article-title>
          .
          <source>In: International Semantic Web Conference</source>
          , Springer (
          <year>2011</year>
          )
          <volume>370</volume>
          {
          <fpage>388</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <surname>Calbimonte</surname>
            ,
            <given-names>J.P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Corcho</surname>
            ,
            <given-names>O.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gray</surname>
            ,
            <given-names>A.J.:</given-names>
          </string-name>
          <article-title>Enabling ontology-based access to streaming data sources</article-title>
          .
          <source>In: International Semantic Web Conference</source>
          , Springer (
          <year>2010</year>
          )
          <volume>96</volume>
          {
          <fpage>111</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <surname>Anicic</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Fodor</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rudolph</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Stojanovic</surname>
          </string-name>
          , N.:
          <article-title>Ep-sparql: a uni ed language for event processing and stream reasoning</article-title>
          .
          <source>In: Proceedings of the 20th international conference on World wide web, ACM</source>
          (
          <year>2011</year>
          )
          <volume>635</volume>
          {
          <fpage>644</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16.
          <string-name>
            <surname>Rinne</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nuutila</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          , Torma, S.:
          <article-title>Instans: High-performance event processing with standard RDF and sparql</article-title>
          .
          <source>In: Proceedings of the 2012th International Conference on Posters &amp; Demonstrations Track-Volume</source>
          <volume>914</volume>
          ,
          <string-name>
            <surname>CEUR-WS. org</surname>
          </string-name>
          (
          <year>2012</year>
          )
          <volume>101</volume>
          {
          <fpage>104</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17.
          <string-name>
            <surname>Meimaris</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Papastefanatos</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Viglas</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Stavrakas</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Pateritsas</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Anagnostopoulos</surname>
            ,
            <given-names>I.:</given-names>
          </string-name>
          <article-title>A query language for multi-version data web archives</article-title>
          .
          <source>arXiv preprint arXiv:1504</source>
          .
          <year>01891</year>
          (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          18.
          <string-name>
            <surname>Anderson</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bendiken</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Transaction-time queries in dydra</article-title>
          .
          <source>In: Joint Proceedings of the 2nd Workshop on Managing the Evolution and Preservation of the Data Web (MEPDaW 2016) and the 3rd Workshop on Linked Data Quality (LDQ</source>
          <year>2016</year>
          )
          <article-title>co-located with 13th European Semantic Web Conference (ESWC</article-title>
          <year>2016</year>
          )
          <article-title>: MEPDaW-LDQ 2016</article-title>
          .
          <article-title>Volume 1585</article-title>
          .
          <article-title>CEUR-WS</article-title>
          .org/Vol-
          <volume>1585</volume>
          / (
          <year>2016</year>
          )
          <volume>11</volume>
          {
          <fpage>19</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          19.
          <string-name>
            <surname>Gayo</surname>
            ,
            <given-names>J.E.L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Prud</surname>
          </string-name>
          'hommeaux, E.,
          <string-name>
            <surname>Solbrig</surname>
            ,
            <given-names>H.R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rodrguez</surname>
            ,
            <given-names>J.M..</given-names>
          </string-name>
          <article-title>: Validating and describing linked data portals using RDF shape expressions</article-title>
          .
          <source>In: LDQ</source>
          <year>2014</year>
          :
          <article-title>Linked Data Quality, CEUR-WS</article-title>
          .org/Vol-
          <volume>1215</volume>
          /
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          20.
          <string-name>
            <surname>Athan</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Boley</surname>
          </string-name>
          , H.:
          <article-title>The MYNG 1.01 suite for deliberation RuleML 1.01: Taming the language lattice</article-title>
          . In: Rule Challenge @
          <article-title>RuleML 2014</article-title>
          .
          <article-title>Volume 1296 of CEUR</article-title>
          .
          <source>CEUR-WS.org/</source>
          Vol-
          <volume>1296</volume>
          /
          <fpage>14</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          21.
          <string-name>
            <surname>Boley</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hallmark</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kifer</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Paschke</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Polleres</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Reynolds</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          :
          <article-title>RIF core dialect</article-title>
          (
          <year>February 2013</year>
          )
          <article-title>W3C Recommendation</article-title>
          . http://www.w3.org/TR/rifcore/.
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          22.
          <string-name>
            <surname>Athan</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bell</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kendall</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Paschke</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sottara</surname>
            ,
            <given-names>D.:</given-names>
          </string-name>
          <article-title>Api4kp metamodel: A meta-api for heterogeneous knowledge platforms</article-title>
          . In Bassiliades, N.,
          <string-name>
            <surname>Gottlob</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sadri</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Paschke</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Roman</surname>
          </string-name>
          , D., eds.: Rule Technologies: Foundations, Tools, and Applications: 9th International Symposium, RuleML
          <year>2015</year>
          , Berlin, Germany,
          <source>August 2-5</source>
          ,
          <year>2015</year>
          , Proceedings, Cham, Springer International Publishing (
          <year>2015</year>
          )
          <volume>144</volume>
          {
          <fpage>160</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          23. International Organization for Standardization:
          <article-title>Data elements and interchange formats { Information interchange { Representation of dates and times</article-title>
          ,
          <source>ISO</source>
          <volume>8601</volume>
          :
          <year>2000</year>
          . (
          <year>December 2000</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>