de.fuberlin.wiwiss.d2rq.fastpath
Class VariableBindings

java.lang.Object
  extended by de.fuberlin.wiwiss.d2rq.fastpath.VariableBindings

public class VariableBindings
extends Object

A class for capturing binding information for variables that occour in a D2RQPatternStage. It provides for a stage, a set of triples or nodes: - all occuring variable names and nodes. - all positions where a variable is accessed that was bound before (previous stage or previous triple or previous node in triple). - all variables that bind in these triples. (keys in bindVariableToShared) - information if and where these bind variables are used again in bound positions.

Version:
$Id: VariableBindings.java,v 1.2 2006/10/23 14:33:50 cyganiak Exp $
Author:
jgarbers

Field Summary
 Map bindVariableIndexToShared
          variables nodes to be bound in this stage.
 Map bindVariableToShared
          variables nodes to be bound in this stage.
 Map boundDomainIndexToShared
          variable positions bound in previous stages.
 Map boundVariableToShared
          variables nodes bound in a previous stage.
 com.hp.hpl.jena.graph.query.Domain inputDomain
          variable bindings from inputDomain
 Set sharedBindIndices
          set of indices of shared variables in a query.
 Set sharedBindVariables
          set of shared variable Nodes that are to be bound in this stage.
 Map variableNameToNodeMap
          variable Nodes in given triples
 
Constructor Summary
VariableBindings()
           
 
Method Summary
 void addBindNode(com.hp.hpl.jena.graph.Node node, int domainIndex, int tripleNr, int nodeNr)
          Adds information for a variable that is to be bound in this stage.
 void addBoundNode(com.hp.hpl.jena.graph.Node node, int domainIndex, int tripleNr, int nodeNr)
          Adds information for a node that was already bound in this or a previous stage.
protected  void addVariable(com.hp.hpl.jena.graph.Node n)
           
 boolean isBind(com.hp.hpl.jena.graph.Node var)
           
 boolean isBind(String var)
           
 boolean isBind(VariableIndex var)
           
 boolean isBound(com.hp.hpl.jena.graph.Node var)
           
 boolean isBound(String var)
           
 boolean isBound(VariableIndex var)
           
protected  Set mapToSharedPut(Map map, Object key, VariableIndex varIndexMember)
          Looks up key in a object to varIndexSet map, adds varIndexMember to the set or creates it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inputDomain

public com.hp.hpl.jena.graph.query.Domain inputDomain
variable bindings from inputDomain


variableNameToNodeMap

public Map variableNameToNodeMap
variable Nodes in given triples


boundVariableToShared

public Map boundVariableToShared
variables nodes bound in a previous stage. variableIndex -> set of VariableIndex. Optimized for variable lookup in RDQL conditions.

See Also:
bindVariableToShared

boundDomainIndexToShared

public Map boundDomainIndexToShared
variable positions bound in previous stages. Domain index (Integer) -> set of VariableIndex. => update these nodes in actual Triple[].


bindVariableToShared

public Map bindVariableToShared
variables nodes to be bound in this stage. variable (node) -> set of VariableIndex. For each variable a set of occurence positions. Optimized for variable name lookup.


bindVariableIndexToShared

public Map bindVariableIndexToShared
variables nodes to be bound in this stage. variableIndex -> set of VariableIndex. Optimized for variable index lookup.

See Also:
bindVariableToShared

sharedBindVariables

public Set sharedBindVariables
set of shared variable Nodes that are to be bound in this stage.


sharedBindIndices

public Set sharedBindIndices
set of indices of shared variables in a query.

Constructor Detail

VariableBindings

public VariableBindings()
Method Detail

addVariable

protected void addVariable(com.hp.hpl.jena.graph.Node n)

isBound

public boolean isBound(String var)

isBound

public boolean isBound(com.hp.hpl.jena.graph.Node var)

isBound

public boolean isBound(VariableIndex var)

isBind

public boolean isBind(String var)

isBind

public boolean isBind(com.hp.hpl.jena.graph.Node var)

isBind

public boolean isBind(VariableIndex var)

mapToSharedPut

protected Set mapToSharedPut(Map map,
                             Object key,
                             VariableIndex varIndexMember)
Looks up key in a object to varIndexSet map, adds varIndexMember to the set or creates it. Helper method.

Parameters:
map - one of: boundVariableToShared, boundDomainIndexToShared, bindVariableToShared, bindVariableIndexToShared
key -
varIndexMember -
Returns:
the (newly created) varIndexSet as a convenience

addBindNode

public void addBindNode(com.hp.hpl.jena.graph.Node node,
                        int domainIndex,
                        int tripleNr,
                        int nodeNr)
Adds information for a variable that is to be bound in this stage.

Parameters:
node - the variable name
domainIndex - the variable index in Domain
tripleNr - the node's triple position
nodeNr - the node's position within the triple

addBoundNode

public void addBoundNode(com.hp.hpl.jena.graph.Node node,
                         int domainIndex,
                         int tripleNr,
                         int nodeNr)
Adds information for a node that was already bound in this or a previous stage.

Parameters:
node - the variable name
domainIndex - the variable index in Domain
tripleNr - the node's triple position
nodeNr - the node's position within the triple