org.openanzo.common.rdb.layout
Class NodeURILayout<T extends org.openrdf.model.Resource>

java.lang.Object
  extended by org.openanzo.common.rdb.layout.NodeLayoutBase<T>
      extended by org.openanzo.common.rdb.layout.NodeURILayout<T>
Type Parameters:
T - type of Resource being stored in this layout
All Implemented Interfaces:
INodeLayout<T>

public class NodeURILayout<T extends org.openrdf.model.Resource>
extends NodeLayoutBase<T>

Layout for Node_URI and Node_Blank. Based on NodeLayoutBase which enables long node support for uri types that provide a long table name.

Author:
Joe Betz, Stephen Evanchik

Constructor Summary
NodeURILayout(NodeType type, SQLCache sqlCache, Sequence sequence, java.lang.String sequenceName, java.lang.String longSequenceName, java.lang.String tableName, java.lang.String resourceTempTableName, java.lang.String idTempTableName, java.lang.String optimizationString)
          Construct a layout to store Resources (URIs or BNodes) in a database
NodeURILayout(NodeType type, SQLCache sqlCache, Sequence sequence, java.lang.String sequenceName, java.lang.String longSequenceName, java.lang.String tableName, java.lang.String longTableName, java.lang.String resourceTempTableName, java.lang.String idTempTableName, int maxLength, java.lang.String optimizationString)
          Construct a layout to store Resources (URIs or BNodes) in a database
 
Method Summary
 T convert(java.lang.String value, java.lang.Long modifiedId)
          Convert raw value from database into Node of appropriate type
 T fetchValue(java.lang.Long id)
          Fetches a nodes value from the database based on its long identifier and NodeType.
 NodeType getType()
           
 java.util.Map<java.lang.Long,T> resolveStoredIds(java.util.Set<java.lang.Long> ids)
          This method will determine which IDs in a list of given Ids are already stored in the database.
 java.util.Map<T,java.lang.Long> resolveStoredNodes(java.util.Set<T> nodes, boolean storeUnResolvedNodes)
          This method will determine which nodes in a list of given nodes are already stored in the database.
 java.lang.Long store(T n)
          Stores a node in the database
 
Methods inherited from class org.openanzo.common.rdb.layout.NodeLayoutBase
fetchId, getLongSequenceName, getSequenceName, isLong
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeURILayout

public NodeURILayout(NodeType type,
                     SQLCache sqlCache,
                     Sequence sequence,
                     java.lang.String sequenceName,
                     java.lang.String longSequenceName,
                     java.lang.String tableName,
                     java.lang.String resourceTempTableName,
                     java.lang.String idTempTableName,
                     java.lang.String optimizationString)
Construct a layout to store Resources (URIs or BNodes) in a database

Parameters:
type - Type of nodes this is storing
sqlCache - The interface to the SQL prepared statement cache
sequence - The sequence Object that is used to get IDs
sequenceName - The name of the sequence that is used to get IDs
longSequenceName - The name of the sequence that is used to get IDs for long objects
tableName - The name of the table where the nodes are stored
resourceTempTableName - The name of the temporary table used to bulk insert nodes
idTempTableName - The name of the temporary table used to bulk id resolution
optimizationString - Extra parameters added to queries for database specific optimizations

NodeURILayout

public NodeURILayout(NodeType type,
                     SQLCache sqlCache,
                     Sequence sequence,
                     java.lang.String sequenceName,
                     java.lang.String longSequenceName,
                     java.lang.String tableName,
                     java.lang.String longTableName,
                     java.lang.String resourceTempTableName,
                     java.lang.String idTempTableName,
                     int maxLength,
                     java.lang.String optimizationString)
Construct a layout to store Resources (URIs or BNodes) in a database

Parameters:
type - Type of nodes this is storing
sqlCache - The interface to the SQL prepared statement cache
sequence - The sequence Object that is used to get IDs
sequenceName - The name of the sequence that is used to get IDs
longSequenceName - The name of the sequence that is used to get IDs for long objects
tableName - The name of the table where the nodes are stored
longTableName - The name of the table where excessively long nodes are stored
resourceTempTableName - The name of the temporary table used to bulk insert nodes
idTempTableName - The name of the temporary table used to bulk id resolution
maxLength - The maximum length of a node's string representation before it is considered long
optimizationString - Extra parameters added to queries for database specific optimizations
Method Detail

store

public java.lang.Long store(T n)
Description copied from interface: INodeLayout
Stores a node in the database

Parameters:
n - The node to be stored
Returns:
The ID of the node stored

fetchValue

public T fetchValue(java.lang.Long id)
Description copied from interface: INodeLayout
Fetches a nodes value from the database based on its long identifier and NodeType.

Parameters:
id - The ID of the node to be found
Returns:
The node

convert

public T convert(java.lang.String value,
                 java.lang.Long modifiedId)
Description copied from interface: INodeLayout
Convert raw value from database into Node of appropriate type

Parameters:
value - raw value of node from database
modifiedId - for literal values
Returns:
converted Node of appropriate type

resolveStoredNodes

public java.util.Map<T,java.lang.Long> resolveStoredNodes(java.util.Set<T> nodes,
                                                          boolean storeUnResolvedNodes)
Description copied from interface: INodeLayout
This method will determine which nodes in a list of given nodes are already stored in the database. If storeUnresolvedNodes is true, then any node that is unresolved will be stored.

Parameters:
nodes - The nodes which need to be resolved to whether they are already stored or need to be stored.
storeUnResolvedNodes - Store nodes that are not already stored
Returns:
A Map of the nodes already stored in the database.

getType

public NodeType getType()
Returns:
type of Nodes this layout handles

resolveStoredIds

public java.util.Map<java.lang.Long,T> resolveStoredIds(java.util.Set<java.lang.Long> ids)
Description copied from interface: INodeLayout
This method will determine which IDs in a list of given Ids are already stored in the database.

Parameters:
ids - The ids which need to be resolved to whether they are already stored.
Returns:
A Map of the ids already stored in the database.


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.