de.fuberlin.wiwiss.d2rq.rdql
Class D2RQPatternStage
java.lang.Object
com.hp.hpl.jena.graph.query.Stage
de.fuberlin.wiwiss.d2rq.rdql.D2RQPatternStage
public class D2RQPatternStage
- extends Stage
TODO Review comments
Instances of this Stage
are created by D2RQQueryHandler
to handle
a set of query triples that by D2RQ-mapping refer to the same database.
Created by Joerg Garbers on 25.02.05.
A CombinedPatternStage is a Stage
that handles a conjunction of triples (a pattern).
This class is a corrected, clarified and optimized version of PatternStage
.
In the following we try to document the logic and machinery behind it:
An RDQL query (triples
) contains nodes, some of which are
(shared) variables (a-z) which will be bound by successive Stages.
This Stage for example sees variables a,b,c,i,j,k,x,y,z in triples
.
The type of the triple nodes (fixed, bound or bind Element) is
compiled
according to the following schema:
The mapping map
lists variables a,b,c...h (pointers to Domain indices)
that will be bound by a previous stage and put into the Pipe. (Bound
)
This stage will pick up each binding (on its own thread),
substitute variables with existing bindings, and produce additional bindings.
This stage is first to bind some variables i,j,k,x,y,z (1st time Bind
)
Some variables x,y,z are used in more than one triple/node => (2nd time: Bound
)
Some variables l,m,n...u,v,w will still not be bound by this stage and left over
for the next stage.
compiled: for each query triple the compiled node binding information (Bind
, Bound
, Fixed
)
guard: a condition checker for the conditions that come with the query and can
be checked after this stage found a matching solution for the variables,
for example (?x < ?y)
varInfo: fast lookup information for different types of variables (shared, bind, bound)
triples: list of find-triples with inserted bindings by previous stages,
build each time a binding arrives on the Pipe
.
Pulls variable bindings from the previous stage adds bindings and pushes all
into the following stage.
A more efficient version of PatternStage
Includes its run(Pipe,Pipe) and nest() functionality.
Handles the case, where bindings for triples
are not found triple by triple,
but in one step. This is the case for D2RQ.
In our example:
a,b,c get bound by source. They are substituted by asTripleMatch(). (Bound)
i,j,k,x,y,z are bound by p.match() the first time they are seen. (Bind)
x,y,z are checked by p.match() the second time they are seen. (Bound)
- Version:
- $Id: D2RQPatternStage.java,v 1.12 2006/09/18 19:06:54 cyganiak Exp $
- Author:
- jg
Method Summary |
void |
close()
Cancel operation of this stage. |
Pipe |
deliver(Pipe output)
Realizes the piping between the previous, this and the following Stage . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
D2RQPatternStage
public D2RQPatternStage(Collection rdfRelations,
Mapping map,
ExpressionSet expressions,
Triple[] triplePattern)
deliver
public Pipe deliver(Pipe output)
- Realizes the piping between the previous, this and the following
Stage
.
A new thread is created for this stage.
- Specified by:
deliver
in class Stage
- See Also:
PatternStage
close
public void close()
- Cancel operation of this stage. May be called asynchronously
while the engine is running.
- Overrides:
close
in class Stage