In this page, we briefly explain how to deploy the plug-in RDFStreamTransformer plug-in in a LarKC platform v.2.5 workflow (see D5.4.2). Note that this section further details what presented in D2.6.2 (December 2010), i.e., how to identify an RDF streams (by the means of a RDFStreamIdentifier plug-in) and apply window based selection on it (by the means of a RDFStreamSelecter plug-in).
The RDFStreamTransformer plug-in exposes all the functionalities of our C-SPARQL engine. It writes in LarKC data layer the i-graphs and the s-graph originating from one of the streams registered in the C-SPARQL Engine as described in the Streaming Linked Data proposal.
The following code excerpts shows how to connect a RDFStreamTransformer to a ?SparqlQueryEvaluationReasoner using a simple LarKC platform v.2.5 workflow.
@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#> .
_:rdfStreamITransformer a <urn:eu.larkc.plugin.transform.RDFStreamTransformer> .
_:reasoner a <urn:eu.larkc.plugin.SparqlQueryEvaluationReasoner> .
_:rdfStreamITransformer larkc:connectsTo _:reasoner .
_:rdfStreamITransformer larkc:hasParameter _:param1 .
_:param1 csparql:RDFStreamIn "http://larkc.eu/csparql/test/in" .
_:param1 csparql:RDFStreamOut "http://larkc.eu/csparql/test/out" .
_:param1 csparql:Window "[RANGE TRIPLES 10]" .
_:param1 csparql:Prefixes "PREFIX : <http://ex.org/> " .
_:param1 csparql:TransformationCondition
" WHERE {
{ SELECT ?s ?p (count(?o) as ?n)
WHERE { ?s ?p ?o }
GROUP BY ?s
}
}" .
_:param1 csparql:TransformationResult
" [] a :count ;
:triplesGroupBy ?s ;
:result ?n . " .
#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 .The plug-in can be configured using the following parameters:
csparql:Prefixes – a list of prefixes to be used in shortening the IRI in the other parameters (note that the characters “<” and “>” were escaped using “&ln;” and “>” respectively);
- csparql:RDFStreamIn – the name of an external input RDF stream;
- csparl:InternalRDFStreamIn – the name of an internal input RDF stream (no shown in the code excerpt);
- csparql:Window - the window to use to select the data from the RDF Stream;
csparql:?TransformationCondition – a WHERE clause compliant with SPARQL 1.1 specification, thus accepting sub-queries, aggregates and project functions;
csparql:?TransformationResult – a graph template described in SPARQL CONSTRUCT syntax that allows for creating as output of the query an arbitrary RDF graph using the variables defined in the ?TransformationCondition;
- csparql:RDFStreamOut - the name of the resulting stream;
The following code snippet shows a LarKC platform v.2.5 workflow that connects a RDFStreamIdentifier to a RDFStreamTransformer that is then connected to a ??SparqlQueryEvaluation Reasoner. Differently from the previous example the parameter csparl:InternalRDFStreamIn is used to tell the RDFStreamTransformer that it has to apply a window-based selection on the RDF stream that flows through the data layer (i.e., http://larkc.eu/csparql/test/internal).
@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#> .
_:rdfStreamIdentifier a <urn:eu.larkc.plugin.identify.RDFStreamIdentifier> .
_:rdfStreamITransformer a <urn:eu.larkc.plugin.transform.RDFStreamTransformer> .
_:reasoner a <urn:eu.larkc.plugin.SparqlQueryEvaluationReasoner> .
_:rdfStreamIdentifier larkc:connectsTo _:rdfStreamITransformer .
_:rdfStreamIdentifier larkc:hasParameter _:param1 .
_:param1 csparql:RDFStreamIn "http://larkc.eu/csparql/test/in" .
_:param1 csparql:RDFStreamOut "http://larkc.eu/csparql/test/internal" .
_:rdfStreamITransformer larkc:connectsTo _:reasoner .
_:rdfStreamITransformer larkc:hasParameter _:param3 .
_:param3 csparql:InternalRDFStreamIn "http://larkc.eu/csparql/test/internal" .
_:param3 csparql:RDFStreamOut "http://larkc.eu/csparql/test/out" .
_:param3 csparql:Window "[RANGE TRIPLES 10]" .
_:param3 csparql:Prefixes "PREFIX : <http://ex.org/> " .
_:param3 csparql:TransformationCondition
" WHERE {
{ SELECT ?s ?p (count(?o) as ?n)
WHERE { ?s ?p ?o }
GROUP BY ?s
}
}" .
_:param3 csparql:TransformationResult
" [] a :count ;
:triplesGroupBy ?s ;
:result ?n . " .
#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 .