In this page, we briefly explain how the RDFStreamOWLTransitivePropertyIncrementalMaterializer plug-in was developed and how to deploy it in a LarKC platform v.2.5 workflow (see D5.4.2).
Plug-in Architecture
Figure 1 illustrates the architecture of the RDFStreamOWLTransitivePropertyIncrementalMateriali- zer plug-in. It is implemented using the Jena Generic Rule Engine. The Incremental Maintainer component orchestrates the maintenance process. It keeps the current materialization in the Permanent Space and uses the Working Space to compute the net insertions (P+) and deletions (P-). Both spaces consist of an RDF store for the triples and a hash table that caters for efficient management of the expiration time associated with each triple. The continuous alignment of the RDF store and the has table is achieved through three custom reasoner plug-ins: GetET, SetET and DelET. GetET retrieves the expiration time of a triple from the hash table; SetET sets the expiration time of a triple in the hash table; and DelET deletes the expiration time of a triple from the hash table. The LarKC plug-in initialize the reasoner and start the continuous maintenance process on the underlying RDF stream. At each invocation, the LarKC plug-ins accesses the RDF Store in the permanent space, which contains the current materialization, creates a ?SetOfStatements and hands it to the following plug-in (normally, but not necessarily, a ?SparqlQueryEvaluationReasoner).
When the reasoner is initialized the maintenance program is loaded into the rule engine that operates over the RDF store in the working space, the background knowledge is loaded into the permanent space, the maintenance program is evaluated on the background knowledge, the extension of all predicates P is stored in the RDF store, and the expiration time of all triples is set to “cannot expire”. As the window slides over the stream, the incremental maintainer:
- looks up the expired triples in the hash table in the permanent space,
- deletes the expired triples both from the RDF store and the hash table in permanent space,
- puts all triples entering the window in the extension of PIns,
- loads the current materialization and PIns in the working space,
- copies the expiration times from the permanent space into the working space,
- evaluates the maintenance program computing P+ and P-,
- updates the RDF store in the permanent space by adding the extension of P+ and removing the extension of P!,
- updates the hash tables by changing the expiration time of the triples in the extension of P+ and removing from the table the triples of P!, and
- clears the working space for a new evaluation.
How to deploy the plug-in
The following code excerpt shows a simple LarKC platform v.2.5 workflow that connects a RDFStreamOWLTransitivePropertyIncrementalMaterializer to a ?SparqlQueryEvaluationReasoner. The plug-in can be configured using the following parameters:
larkc:input – the folder where the running example RDF Stream is stored2;
- csparql:windowLength - the length (in number of triples) of window the reasoner has to use to select the data from the RDF Stream;
- and csparql:step – the step (in number of triples) of the sliding window.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix larkc: <http://larkc.eu/schema#> .
@prefix csparql: <http://larkc.eu/csparql/schema#> .
_:rdfStreamIReasoner a <urn:eu.larkc.plugin.reason.RDFStreamOWLTransitivePropertyIncrementalMaterializer> .
_:reasoner a <urn:eu.larkc.plugin.SparqlQueryEvaluationReasoner> .
_:rdfStreamIReasoner larkc:connectsTo _:reasoner .
_:rdfStreamIReasoner larkc:hasParameter _:param1 .
_:param1 csparql:input "../sample_data/streamreasoning" .
_:param1 csparql:windowLength "100" .
_:param1 csparql:step "20" .
#Define the endpoint for this workflow.
<urn:eu.larkc.endpoint.sparql.ep1> a <urn:eu.larkc.endpoint.sparql> .
#Endpoints are connected to paths in the workflow. Specify the path the above endpoint refers to.
<urn:eu.larkc.endpoint.sparql.ep1> larkc:links _:path .
_:path a larkc:Path .
#Connect the input of the path to a plugin
_:path larkc:hasInput _:reasoner .
#Connect the output of the path to a plugin
_:path larkc:hasOutput _:reasoner .