de.fuberlin.wiwiss.d2rq.rdql
Class NodeConstraint

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

public class NodeConstraint
extends java.lang.Object

Holds constraint information for a variable node. In a query a variable node is either a result value, or a shared variable or both. If it is a shared variable, we collect into a NodeConstraint all constraining information that we know about the different node positions from the PropertyBridges.

Since:
V0.3
Author:
jg

Field Summary
static int BlankNodeType
           
protected  java.util.Set columns
          set of columns that are equal with this node
protected  java.util.Set conditions
          valueSource condition Strings (SQL)
 com.hp.hpl.jena.graph.Node fixedNode
          if not null, we allready know the value of the variable, but still have to check for other occourences.
(package private)  boolean infoAdded
          a flag that shows, if constraint information was added.
 LiteralMaker literalMaker
          A literalMaker can be matched against another literalMaker.
static int LiteralNodeType
           
 int nodeType
          What is the type, an URI, a blank node or a literal?
static int NotFixedNodeType
           
protected  java.util.Set patterns
          all patterns to be matched against
 boolean possible
          true means: satisfiable.
static int UriNodeType
           
 
Constructor Summary
NodeConstraint()
           
 
Method Summary
 void addConstraintsToSQL(SQLStatementMaker sql)
          The collected constraints are created as SQL constraints.
 void addEqualColumn(Column c1, Column c2)
           
 void conditionsAddEqual(java.lang.String n1, java.lang.String n2)
          Adds a textual equivalence condition to conditions.
 void matchFixedNode(com.hp.hpl.jena.graph.Node node)
          We see a fixed NodeMaker.
 void matchLiteralMaker(LiteralMaker m)
          We see a literal NodeMaker.
 void matchNodeType(int t)
          We see a NodeMaker, that produces nodes of type BlankNodeType, UriNodeType or LiteralNodeType.
 void matchValueSource(Column c)
          Constraints given on Nodes that are equal to Columns can be directly translated to Column constraints.
 void matchValueSource(Pattern p)
          Pattern-Constraints can be translated to column constraints.
 void matchValueSource(RegexRestriction r)
           
 void matchValueSource(ValueSource s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

possible

public boolean possible
true means: satisfiable.


infoAdded

boolean infoAdded
a flag that shows, if constraint information was added.


fixedNode

public com.hp.hpl.jena.graph.Node fixedNode
if not null, we allready know the value of the variable, but still have to check for other occourences.


nodeType

public int nodeType
What is the type, an URI, a blank node or a literal?


literalMaker

public LiteralMaker literalMaker
A literalMaker can be matched against another literalMaker. Both literals must produce the same language or XSD-Type.


conditions

protected java.util.Set conditions
valueSource condition Strings (SQL)


columns

protected java.util.Set columns
set of columns that are equal with this node


patterns

protected java.util.Set patterns
all patterns to be matched against


NotFixedNodeType

public static final int NotFixedNodeType
See Also:
Constant Field Values

BlankNodeType

public static final int BlankNodeType
See Also:
Constant Field Values

UriNodeType

public static final int UriNodeType
See Also:
Constant Field Values

LiteralNodeType

public static final int LiteralNodeType
See Also:
Constant Field Values
Constructor Detail

NodeConstraint

public NodeConstraint()
Method Detail

matchLiteralMaker

public void matchLiteralMaker(LiteralMaker m)
We see a literal NodeMaker.

Parameters:
m -

matchFixedNode

public void matchFixedNode(com.hp.hpl.jena.graph.Node node)
We see a fixed NodeMaker.

Parameters:
node -

matchNodeType

public void matchNodeType(int t)
We see a NodeMaker, that produces nodes of type BlankNodeType, UriNodeType or LiteralNodeType.

Parameters:
t -

matchValueSource

public void matchValueSource(Column c)
Constraints given on Nodes that are equal to Columns can be directly translated to Column constraints. NodeMakers with an attached ValueSource call this.

Parameters:
c -

matchValueSource

public void matchValueSource(Pattern p)
Pattern-Constraints can be translated to column constraints. NodeMakers with an attached ValueSource call this.

Parameters:
p -

matchValueSource

public void matchValueSource(RegexRestriction r)

matchValueSource

public void matchValueSource(ValueSource s)

addEqualColumn

public void addEqualColumn(Column c1,
                           Column c2)

conditionsAddEqual

public void conditionsAddEqual(java.lang.String n1,
                               java.lang.String n2)
Adds a textual equivalence condition to conditions. We avoid adding both "x=y" and "y=x" by sorting the arguments n1 and n2 first.

Parameters:
n1 -
n2 -

addConstraintsToSQL

public void addConstraintsToSQL(SQLStatementMaker sql)
The collected constraints are created as SQL constraints.

Parameters:
sql - the statment maker that gets the constraints. It knows about Aliases and correct quoting of values for integer/string database columns.