de.fuberlin.wiwiss.d2rq.values
Class Pattern
java.lang.Object
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)
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 |
DELIMITER
public static final String DELIMITER
- See Also:
- Constant Field Values
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
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
ProjectionSpec
s containing data necessary
for this ValueSource.
- Specified by:
projectionSpecs
in interface ValueMaker
- Returns:
- a set of
ProjectionSpec
s
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.)