org.openanzo.common.rdb.layout
Class NodeXMLLiteralLayout

java.lang.Object
  extended by org.openanzo.common.rdb.layout.NodeLayoutBase<org.openrdf.model.Literal>
      extended by org.openanzo.common.rdb.layout.NodeXMLLiteralLayout
All Implemented Interfaces:
INodeLayout<org.openrdf.model.Literal>

public class NodeXMLLiteralLayout
extends NodeLayoutBase<org.openrdf.model.Literal>

Layout for XML Node_Literal type. Based on NodeLayoutBase which enables long node support and aggregates two ValueLayouts for literal datatype and language support.

Author:
Joe Betz, Stephen Evanchik

Constructor Summary
NodeXMLLiteralLayout(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, IValueLayout datatypeLayout, IValueLayout languageLayout, NodeCentricSchema.XMLNode literalSchema, NodeCentricSchema.LongXMLNode longLiteralSchema)
          Create a new NodeLiteralLayout
 
Method Summary
 java.util.Map<java.lang.Long,org.openrdf.model.Literal> batchStore(java.util.Collection<org.openrdf.model.Literal> nodes)
          This method will insert a list of Node_Literal, mapping each node to a unique ID.
 org.openrdf.model.Literal convert(java.lang.String value, java.lang.Long modifierId)
          Convert raw value from database into Node of appropriate type
 java.lang.Long fetchId(org.openrdf.model.Literal literal)
          Fetches a node's ID from the database
 org.openrdf.model.Literal 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,org.openrdf.model.Literal> 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<org.openrdf.model.Literal,java.lang.Long> resolveStoredNodes(java.util.Set<org.openrdf.model.Literal> 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(org.openrdf.model.Literal literal)
          Stores a node in the database
 
Methods inherited from class org.openanzo.common.rdb.layout.NodeLayoutBase
getLongSequenceName, getSequenceName, isLong
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeXMLLiteralLayout

public NodeXMLLiteralLayout(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,
                            IValueLayout datatypeLayout,
                            IValueLayout languageLayout,
                            NodeCentricSchema.XMLNode literalSchema,
                            NodeCentricSchema.LongXMLNode longLiteralSchema)
Create a new NodeLiteralLayout

Parameters:
sqlCache - SQLCache from underlying connection
sequence - Sequence for getting IDs for literals
sequenceName - Name of sequence for getting IDs for literals
longSequenceName - Name of sequence for getting IDs for long literals
tableName - Name of table where literals are stored
longTableName - Name of table where long literals are stored
resourceTempTableName - Name of temporary table used during insertion and resolving of ids
idTempTableName - Name of temporary table used to resolve values
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
datatypeLayout - The layout that contains Datatype data
languageLayout - The layout that contains Language data
literalSchema - Schema for literals
longLiteralSchema - Schema for long literals
Method Detail

store

public java.lang.Long store(org.openrdf.model.Literal literal)
Description copied from interface: INodeLayout
Stores a node in the database

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

fetchValue

public org.openrdf.model.Literal 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 org.openrdf.model.Literal convert(java.lang.String value,
                                         java.lang.Long modifierId)
Description copied from interface: INodeLayout
Convert raw value from database into Node of appropriate type

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

fetchId

public java.lang.Long fetchId(org.openrdf.model.Literal literal)
Description copied from interface: INodeLayout
Fetches a node's ID from the database

Specified by:
fetchId in interface INodeLayout<org.openrdf.model.Literal>
Overrides:
fetchId in class NodeLayoutBase<org.openrdf.model.Literal>
Parameters:
literal - The node who's ID is to be found
Returns:
The ID of the node or null if not found

batchStore

public java.util.Map<java.lang.Long,org.openrdf.model.Literal> batchStore(java.util.Collection<org.openrdf.model.Literal> nodes)
This method will insert a list of Node_Literal, mapping each node to a unique ID.

Parameters:
nodes - The list of Literals to store
Returns:
map of IDs to their Literals

getType

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

resolveStoredNodes

public java.util.Map<org.openrdf.model.Literal,java.lang.Long> resolveStoredNodes(java.util.Set<org.openrdf.model.Literal> 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.

resolveStoredIds

public java.util.Map<java.lang.Long,org.openrdf.model.Literal> 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.