de.fuberlin.wiwiss.d2rq.algebra
Class VariableConstraints

java.lang.Object
  extended by de.fuberlin.wiwiss.d2rq.algebra.VariableConstraints

public class VariableConstraints
extends Object

A map from variables to NodeMakers that helps to build up constraints in cases where a variable is bound multiple times. If several node makers are added for the same variable name, then only one will be kept, and a constraint expression will be built up. The expression ensures that both identically-named node makers produce the same node for any result row that matches the expression.

Author:
Richard Cyganiak (richard@cyganiak.de)

Constructor Summary
VariableConstraints()
           
 
Method Summary
 void add(Var var, NodeMaker nodeMaker, AliasMap aliases)
           
 void addAll(NodeRelation nodeRelation)
           
 void addIfVariable(Node possibleVariable, NodeMaker nodeMaker, AliasMap aliases)
           
 Set<Var> allNames()
           
 Set<ProjectionSpec> allProjections()
           
 Expression constraint()
           
 Map<Var,AliasMap> relationAliases()
           
 boolean satisfiable()
           
 Map<Var,NodeMaker> toMap()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VariableConstraints

public VariableConstraints()
Method Detail

add

public void add(Var var,
                NodeMaker nodeMaker,
                AliasMap aliases)

addIfVariable

public void addIfVariable(Node possibleVariable,
                          NodeMaker nodeMaker,
                          AliasMap aliases)

addAll

public void addAll(NodeRelation nodeRelation)

satisfiable

public boolean satisfiable()
Returns:
false if two identically-named node makers cannot produce the same node

constraint

public Expression constraint()
Returns:
An expression that, if it holds for a result row, will ensure that any two identically-named node makers produce the same node

toMap

public Map<Var,NodeMaker> toMap()
Returns:
A regular map from variable names to NodeMakers

allNames

public Set<Var> allNames()

relationAliases

public Map<Var,AliasMap> relationAliases()

allProjections

public Set<ProjectionSpec> allProjections()
Returns:
All projections needed by any of the retained node makers