de.fuberlin.wiwiss.d2rq.values
Class Pattern

java.lang.Object
  extended by de.fuberlin.wiwiss.d2rq.values.Pattern
All Implemented Interfaces:
ValueMaker

public class Pattern
extends Object
implements ValueMaker

A pattern that combines one or more database columns into a String. Often used as an UriPattern for generating URIs from a column's primary key.

Author:
Richard Cyganiak (richard@cyganiak.de)

Nested Class Summary
static class Pattern.EncodeFunction
           
 
Field Summary
static String DELIMITER
           
 
Fields inherited from interface de.fuberlin.wiwiss.d2rq.values.ValueMaker
NULL
 
Constructor Summary
Pattern(String pattern)
          Constructs a new Pattern instance from a pattern syntax string
 
Method Summary
 List<Attribute> attributes()
           
 void describeSelf(NodeSetFilter c)
           
 boolean equals(Object otherObject)
           
 String firstLiteralPart()
           
 int hashCode()
           
 boolean isEquivalentTo(Pattern p)
           
 String lastLiteralPart()
           
 boolean literalPartsMatchRegex(String regex)
           
 String makeValue(ResultRow row)
          Constructs a String from the pattern using the given database row.
 boolean matches(String value)
           
 List<OrderSpec> orderSpecs(boolean ascending)
           
 Iterator<Object> partsIterator()
           
 Set<ProjectionSpec> projectionSpecs()
          Returns a set of all ProjectionSpecs containing data necessary for this ValueSource.
 ValueMaker renameAttributes(ColumnRenamer renames)
           
 Expression toExpression()
           
 String toString()
           
 boolean usesColumnFunctions()
           
 Expression valueExpression(String value)
          A SQL expression that selects only rows where this value maker produces the specified value.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DELIMITER

public static final String DELIMITER
See Also:
Constant Field Values
Constructor Detail

Pattern

public Pattern(String pattern)
Constructs a new Pattern instance from a pattern syntax string

Parameters:
pattern - a pattern syntax string
Throws:
D2RQException - on malformed pattern
Method Detail

firstLiteralPart

public String firstLiteralPart()

lastLiteralPart

public String lastLiteralPart()

literalPartsMatchRegex

public boolean literalPartsMatchRegex(String regex)

attributes

public List<Attribute> attributes()

describeSelf

public void describeSelf(NodeSetFilter c)
Specified by:
describeSelf in interface ValueMaker

matches

public boolean matches(String value)

valueExpression

public Expression valueExpression(String value)
Description copied from interface: ValueMaker
A SQL expression that selects only rows where this value maker produces the specified value. Expression.FALSE if this value maker is incapable of producing the value.

Specified by:
valueExpression in interface ValueMaker
Parameters:
value - A value
Returns:
An expression that selects rows that produce this value

projectionSpecs

public Set<ProjectionSpec> projectionSpecs()
Description copied from interface: ValueMaker
Returns a set of all ProjectionSpecs containing data necessary for this ValueSource.

Specified by:
projectionSpecs in interface ValueMaker
Returns:
a set of ProjectionSpecs

makeValue

public String makeValue(ResultRow row)
Constructs a String from the pattern using the given database row.

Specified by:
makeValue in interface ValueMaker
Parameters:
row - a database row
Returns:
the pattern's value for the given row

orderSpecs

public List<OrderSpec> orderSpecs(boolean ascending)
Specified by:
orderSpecs in interface ValueMaker

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object otherObject)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

isEquivalentTo

public boolean isEquivalentTo(Pattern p)
Returns:
true if the pattern is identical or differs only in the column names

renameAttributes

public ValueMaker renameAttributes(ColumnRenamer renames)
Specified by:
renameAttributes in interface ValueMaker

partsIterator

public Iterator<Object> partsIterator()

toExpression

public Expression toExpression()

usesColumnFunctions

public boolean usesColumnFunctions()
Returns:
TRUE if this pattern uses any column function (encode, urlify, etc.)