de.fuberlin.wiwiss.d2rq.map
Interface ValueSource

All Known Implementing Classes:
BlankNodeIdentifier, Column, ContainsRestriction, DummyValueSource, MaxLengthRestriction, Pattern, RegexRestriction, TranslationTable.TranslatingValueSource

public interface ValueSource

Describes a set of strings that are obtained in some way from one or more database columns.

Typical implementations are Column (describing the set of strings contained in one database column), Pattern (describing the set of strings that is obtained by sticking the values of several database fields into a string pattern), and BlankNodeIdentifier (similar).

There are several other ValueSources that modify the behaviour of another underlying ValueSource, implementing the Decorator pattern. This includes TranslationTable.TranslatingValueSource (translates values using a translation table or translation class) and the various value restrictions (@link RegexRestriction et. al.).

ValueSources are used by NodeMakers. A node maker wraps the strings into Jena nodes, thus creating a description of a set of RDF nodes.

TODO: Better name for ValueSource: ValueSetDescription?

History:
2004-08-02: Initial version.

Author:
Richard Cyganiak

Method Summary
 boolean couldFit(java.lang.String value)
          Checks if a given value fits this source without querying the database.
 java.util.Set getColumns()
          Returns a set of all columns containing data necessary for this ValueSource.
 java.util.Map getColumnValues(java.lang.String value)
          Returns a map of database fields and values corresponding to the argument.
 java.lang.String getValue(java.lang.String[] row, java.util.Map columnNameNumberMap)
          Retrieves a value from a database row according to some rule or pattern.
 

Method Detail

couldFit

public boolean couldFit(java.lang.String value)
Checks if a given value fits this source without querying the database.


getColumnValues

public java.util.Map getColumnValues(java.lang.String value)
Returns a map of database fields and values corresponding to the argument.

For example, a ValueSource that corresponds directly to a single DB column would return a single-entry map with that column as the key, and value as the value.

Parameters:
value - a non-null value
Returns:
a map with Column keys, and string values.

getColumns

public java.util.Set getColumns()
Returns a set of all columns containing data necessary for this ValueSource.

Returns:
a set of {Column}s

getValue

public java.lang.String getValue(java.lang.String[] row,
                                 java.util.Map columnNameNumberMap)
Retrieves a value from a database row according to some rule or pattern.

Parameters:
row - the database row
columnNameNumberMap - a map from Table.Column style column names to Integer indices into the row array
Returns:
a value created from the row