de.fuberlin.wiwiss.d2rq.map
Interface NodeMaker

All Superinterfaces:
java.lang.Cloneable
All Known Implementing Classes:
BlankNodeMaker, FixedNodeMaker, LiteralMaker, UriMaker

public interface NodeMaker
extends java.lang.Cloneable

NodeMakers represent the nodes of the virtual RDF graph created by D2RQ. One NodeMaker instance describes a set of nodes that are created from a common data source, for example a database column. NodeMakers

Most of the actual work is done by a chain of ValueSource instances that lie below the NodeMaker. The NodeMaker only wraps and unwraps the String values (URIs, literals and blank node IDs) into/from Jena Node instances.

NodeMakers are used by PropertyBridges as their subjects, predicates and objects.

There are implementations for the different types of RDF nodes: UriMaker, LiteralMaker and BlankNodeMaker. A special implementation is the FixedNodeMaker, which is a single-element node set.

TODO: Better name for NodeMaker: NodeSetDescription?

History:
06-16-2004: Initial version.
08-04-2004: Added couldFit, getColumns and getColumnValues
11-03-2005: Added matchConstraint

Version:
V0.3
Author:
Chris Bizer chris@bizer.de, Richard Cyganiak , Joerg Garbers

Method Summary
 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 Node from a database result row.
 void matchConstraint(NodeConstraint c)
          Adds constraint information to a NodeConstraint.
 

Method Detail

matchConstraint

public void matchConstraint(NodeConstraint c)
Adds constraint information to a NodeConstraint. In a RDQL query a shared variable generally corresponds to different NodeMakers.

Parameters:
c -
See Also:
NodeConstraint

couldFit

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


getColumnValues

public java.util.Map getColumnValues(com.hp.hpl.jena.graph.Node node)
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.

Parameters:
node - a concrete, non-null RDF node
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 NodeMaker to build its nodes.

Returns:
a set of {Column}s

getNode

public com.hp.hpl.jena.graph.Node getNode(java.lang.String[] row,
                                          java.util.Map columnNameNumberMap)
Creates a new Node from a database result row.

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.