de.fuberlin.wiwiss.d2rq.map
Class BlankNodeIdentifier

java.lang.Object
  extended byde.fuberlin.wiwiss.d2rq.map.BlankNodeIdentifier
All Implemented Interfaces:
java.lang.Cloneable, Prefixable, ValueSource

class BlankNodeIdentifier
extends java.lang.Object
implements ValueSource, Prefixable

A blank node identifier that uniquely identifies all resources generated from a specific ClassMap.

(Note: The implementation makes some assumptions about the Column class to keep the code simple and fast. This means BlankNodeIdentifier might not work with some hypothetical subclasses of Column.) TODO: Write tests for matches, extractColumnValues, getValue

History:
08-03-2004: Initial version of this class.

Version:
V0.2
Author:
Richard Cyganiak

Field Summary
private  java.lang.String classMapID
           
private  java.util.Set identifierColumns
           
 
Constructor Summary
BlankNodeIdentifier(java.lang.String columns, java.lang.String classMapID)
          Constructs a new blank node identifier.
 
Method Summary
 java.lang.Object clone()
          Make a shallow copy of this.
 boolean couldFit(java.lang.String anonID)
          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 anonID)
          Extracts column values from a blank node ID string.
 java.lang.String getValue(java.lang.String[] row, java.util.Map columnNameNumberMap)
          Creates an identifier from a database row.
 void prefixTables(TablePrefixer prefixer)
          Changes the fields in a newly created clone that are to be modified when making aliasses.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

classMapID

private java.lang.String classMapID

identifierColumns

private java.util.Set identifierColumns
Constructor Detail

BlankNodeIdentifier

public BlankNodeIdentifier(java.lang.String columns,
                           java.lang.String classMapID)
Constructs a new blank node identifier.

Parameters:
columns - a comma-seperated list of column names uniquely identifying the nodes
classMapID - a string that is unique for the class map whose resources are identified by this BlankNodeIdentifier
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Description copied from interface: Prefixable
Make a shallow copy of this. General advice: Do not overwrite clone(). prefixTables() works best with shallow copy which Object implements. Issues: I have not found a (preferred) static equivalent of clone(). Since Objects clone() method is protected, we cannot just declare Cloneable, if we want to call clone() from outside of that class hierarchy. Instead it must be public and implemented in each Prefixable class by a call to super.clone().

Specified by:
clone in interface Prefixable
Throws:
java.lang.CloneNotSupportedException

prefixTables

public void prefixTables(TablePrefixer prefixer)
Description copied from interface: Prefixable
Changes the fields in a newly created clone that are to be modified when making aliasses.

Specified by:
prefixTables in interface Prefixable
Parameters:
prefixer - does the actual prefixing of simple and complex types.

couldFit

public boolean couldFit(java.lang.String anonID)
Description copied from interface: ValueSource
Checks if a given value fits this source without querying the database.

Specified by:
couldFit in interface ValueSource

getColumns

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

Specified by:
getColumns in interface ValueSource
Returns:
a set of {Column}s

getColumnValues

public java.util.Map getColumnValues(java.lang.String anonID)
Extracts column values from a blank node ID string. The keys are Columns, the values are strings.

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

getValue

public java.lang.String getValue(java.lang.String[] row,
                                 java.util.Map columnNameNumberMap)
Creates an identifier from a database row.

Specified by:
getValue in interface ValueSource
Parameters:
row - a database row
columnNameNumberMap - a map from qualified column names to indices into the row array
Returns:
this column's blank node identifier

toString

public java.lang.String toString()