de.fuberlin.wiwiss.d2rq.map
Class BlankNodeMaker

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

class BlankNodeMaker
extends java.lang.Object
implements NodeMaker, Prefixable

BlankNodeMakers transform attribute values from a result set into blank nodes.

History:
06-21-2004: Initial version of this class.

Version:
V0.2
Author:
Chris Bizer chris@bizer.de, Richard Cyganiak

Field Summary
private  java.lang.String id
           
private  ValueSource valueSource
           
 
Constructor Summary
BlankNodeMaker(java.lang.String id, ValueSource valueSource)
           
 
Method Summary
 java.lang.Object clone()
          Make a shallow copy of this.
 boolean couldFit(com.hp.hpl.jena.graph.Node node)
          Checks if a node could fit this NodeMaker without querying the database.
 java.util.Set getColumns()
          Returns a set of all columns containing data necessary for this NodeMaker to build its nodes.
 java.util.Map getColumnValues(com.hp.hpl.jena.graph.Node node)
          Returns a map of database fields and values corresponding to the argument node.
 com.hp.hpl.jena.graph.Node getNode(java.lang.String[] row, java.util.Map columnNameNumberMap)
          Creates a new blank node based on the current row of the result set and the mapping of database column names to elements of the array.
 void matchConstraint(NodeConstraint c)
          Adds constraint information to a NodeConstraint.
 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

valueSource

private ValueSource valueSource

id

private java.lang.String id
Constructor Detail

BlankNodeMaker

public BlankNodeMaker(java.lang.String id,
                      ValueSource valueSource)
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.

matchConstraint

public void matchConstraint(NodeConstraint c)
Description copied from interface: NodeMaker
Adds constraint information to a NodeConstraint. In a RDQL query a shared variable generally corresponds to different NodeMakers.

Specified by:
matchConstraint in interface NodeMaker
Parameters:
c -
See Also:
NodeConstraint

couldFit

public boolean couldFit(com.hp.hpl.jena.graph.Node node)
Description copied from interface: NodeMaker
Checks if a node could fit this NodeMaker without querying the database.

Specified by:
couldFit in interface NodeMaker

getColumns

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

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

getColumnValues

public java.util.Map getColumnValues(com.hp.hpl.jena.graph.Node node)
Description copied from interface: NodeMaker
Returns a map of database fields and values corresponding to the argument node.

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

Specified by:
getColumnValues in interface NodeMaker
Parameters:
node - a concrete, non-null RDF node
Returns:
a map with Column keys, and string values.

getNode

public com.hp.hpl.jena.graph.Node getNode(java.lang.String[] row,
                                          java.util.Map columnNameNumberMap)
Creates a new blank node based on the current row of the result set and the mapping of database column names to elements of the array. Returns null if a NULL value was retrieved from the database.

Specified by:
getNode in interface NodeMaker
Parameters:
row - a database result row
columnNameNumberMap - a map from Table.Column style column names to Integers representing indices within the row array
Returns:
a node created from the row, or null if a NULL value was encountered in a required field.

toString

public java.lang.String toString()