de.fuberlin.wiwiss.d2rq.rdql
Class ConstraintHandler

java.lang.Object
  extended byde.fuberlin.wiwiss.d2rq.rdql.ConstraintHandler

class ConstraintHandler
extends java.lang.Object

Handles variable node constraints for a TripleQuery conjunction. Assumption: Bound variables in conjunction allready have been bound. (This code could as well be kept in PatternQueryCombiner.)

Author:
jgarbers

Nested Class Summary
 class ConstraintHandler.NodeMakerIterator
          Iterates over all the nodes of a triple conjunction.
 
Field Summary
 VariableBindings bindings
           
(package private)  TripleQuery[] conjunction
           
 boolean possible
           
(package private)  java.util.Collection rdqlConstraints
           
(package private)  ExpressionTranslator rdqlTranslator
           
 java.util.Map variableToConstraint
          Mapping between a variable (Node) and its NodeConstraints.
 
Constructor Summary
(package private) ConstraintHandler()
           
 
Method Summary
 void addConstraintsToSQL(SQLStatementMaker sql)
          Creates SQL code for the node constraints.
(package private)  void addRDQLConstraints(SQLStatementMaker sql)
          Adds constraints that come from the RDQL expression.
 void makeConstraints()
          Creates Node constraints for all shared Bind variables.
 ConstraintHandler.NodeMakerIterator makeNodeMakerIterator(java.util.Set indexSet)
           
 void setRDQLConstraints(java.util.Collection rdqlConstraints)
           
 void setTripleQueryConjunction(TripleQuery[] conjunction)
           
 void setVariableBindings(VariableBindings bindings)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

possible

public boolean possible

bindings

public VariableBindings bindings

conjunction

TripleQuery[] conjunction

variableToConstraint

public java.util.Map variableToConstraint
Mapping between a variable (Node) and its NodeConstraints.


rdqlConstraints

java.util.Collection rdqlConstraints

rdqlTranslator

ExpressionTranslator rdqlTranslator
Constructor Detail

ConstraintHandler

ConstraintHandler()
Method Detail

setVariableBindings

public void setVariableBindings(VariableBindings bindings)

setTripleQueryConjunction

public void setTripleQueryConjunction(TripleQuery[] conjunction)

setRDQLConstraints

public void setRDQLConstraints(java.util.Collection rdqlConstraints)

makeConstraints

public void makeConstraints()
Creates Node constraints for all shared Bind variables. Iterates over the positions, where shared Bind variables occour until no more constraint information is derived.


addConstraintsToSQL

public void addConstraintsToSQL(SQLStatementMaker sql)
Creates SQL code for the node constraints.

Parameters:
sql - contains both the places where to store expressions and the methods, how to format them.

addRDQLConstraints

void addRDQLConstraints(SQLStatementMaker sql)
Adds constraints that come from the RDQL expression. The RDQL query not just contains triple but also conditions about nodes, such as ! (?a = "v"). Note that the SQL term given to the database becomes stronger, so that less entries are returned. The class of the rdqlTranslator is settable in the mapping file. Note that its constructor must have exactly the same signature as ExpressionTranslator. This is likely to change in the future.

Parameters:
sql - contains information about the SQL dialect of the database and aliases.

makeNodeMakerIterator

public ConstraintHandler.NodeMakerIterator makeNodeMakerIterator(java.util.Set indexSet)