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.

Version:
$Id: Pattern.java,v 1.8 2007/10/23 14:30:33 cyganiak Exp $
Author:
Richard Cyganiak (richard@cyganiak.de)

Field Summary
static String DELIMITER
           
 
Constructor Summary
Pattern(String pattern)
          Constructs a new Pattern instance from a pattern syntax string
 
Method Summary
 Map attributeConditions(String value)
          Extracts column values according to the pattern from a value string.
 List attributes()
           
 void describeSelf(NodeSetFilter c)
           
 boolean equals(Object otherObject)
           
 int hashCode()
           
 boolean isCompatibleWith(Pattern p)
           
 boolean literalPartsMatchRegex(String regex)
           
 String makeValue(ResultRow row)
          Constructs a String from the pattern using the given database row.
 boolean matches(String value)
          Checks if a given value fits this source without querying the database.
 Iterator partsIterator()
           
 Set projectionAttributes()
          Returns a set of all columns containing data necessary for this ValueSource.
 ValueMaker replaceColumns(ColumnRenamer renames)
           
 String toString()
           
 
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

literalPartsMatchRegex

public boolean literalPartsMatchRegex(String regex)

attributes

public List attributes()

describeSelf

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

matches

public boolean matches(String value)
Description copied from interface: ValueMaker
Checks if a given value fits this source without querying the database.

Specified by:
matches in interface ValueMaker

projectionAttributes

public Set projectionAttributes()
Description copied from interface: ValueMaker
Returns a set of all columns containing data necessary for this ValueSource.

Specified by:
projectionAttributes in interface ValueMaker
Returns:
a set of {Column}s

attributeConditions

public Map attributeConditions(String value)
Extracts column values according to the pattern from a value string. The keys are Attributes, the values are strings.

Specified by:
attributeConditions in interface ValueMaker
Parameters:
value - value to be checked.
Returns:
a map with Column keys and string values
See Also:
ValueMaker.attributeConditions(java.lang.String)

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

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

isCompatibleWith

public boolean isCompatibleWith(Pattern p)

replaceColumns

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

partsIterator

public Iterator partsIterator()