org.neo4j.unsafe.batchinsert
Class BatchInserterImpl

java.lang.Object
  extended by org.neo4j.unsafe.batchinsert.BatchInserterImpl
All Implemented Interfaces:
BatchInserter

public class BatchInserterImpl
extends Object
implements BatchInserter


Method Summary
 void createNode(long id, Map<String,Object> properties)
          Creates a node with supplied id and properties.
 long createNode(Map<String,Object> properties)
          Creates a node assigning next available id to id and also adds any properties supplied.
 long createRelationship(long node1, long node2, RelationshipType type, Map<String,Object> properties)
          Creates a relationship between two nodes of a specific type.
 GraphDatabaseService getBatchGraphDbService()
          Deprecated. as of Neo4j 1.7
 IdGeneratorFactory getIdGeneratorFactory()
           
 org.neo4j.kernel.impl.index.IndexStore getIndexStore()
           
 Map<String,Object> getNodeProperties(long nodeId)
          Returns a map containing all the properties of this node.
 long getReferenceNode()
          Returns the reference node id or -1 if it doesn't exist.
 BatchRelationship getRelationshipById(long relId)
          Gets a relationship by id.
 Iterable<Long> getRelationshipIds(long nodeId)
          Returns an iterable over all the relationship ids connected to node with supplied id.
 Map<String,Object> getRelationshipProperties(long relId)
          Returns a map containing all the properties of the relationships.
 Iterable<BatchRelationship> getRelationships(long nodeId)
          Returns an iterable of relationships connected to the node with supplied id.
 org.neo4j.kernel.impl.batchinsert.SimpleRelationship getSimpleRelationshipById(long relId)
           
 Iterable<org.neo4j.kernel.impl.batchinsert.SimpleRelationship> getSimpleRelationships(long nodeId)
           
 String getStoreDir()
          Returns the path to this Neo4j store.
 boolean nodeExists(long nodeId)
          Checks if a node with the given id exists.
 boolean nodeHasProperty(long node, String propertyName)
          Returns true iff the node with id has a property with name .
 boolean relationshipHasProperty(long relationship, String propertyName)
          Returns true iff the relationship with id has a property with name .
 void removeNodeProperty(long node, String propertyName)
          Removes the property named from the node with id , if present.
 void removeRelationshipProperty(long relationship, String propertyName)
          Removes the property named from the relationship with id , if present.
 void setNodeProperties(long node, Map<String,Object> properties)
          Sets the properties of a node.
 void setNodeProperty(long node, String propertyName, Object propertyValue)
          Sets the property with name of node with id to the value .
 void setRelationshipProperties(long rel, Map<String,Object> properties)
          Sets the properties of a relationship.
 void setRelationshipProperty(long relationship, String propertyName, Object propertyValue)
          Sets the property with name of relationship with id to the value .
 void shutdown()
          Shuts down this batch inserter syncing all changes that are still only in memory to disk.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

nodeHasProperty

public boolean nodeHasProperty(long node,
                               String propertyName)
Description copied from interface: BatchInserter
Returns true iff the node with id has a property with name .

Specified by:
nodeHasProperty in interface BatchInserter
Parameters:
node - The node id of the node to check.
propertyName - The property name to check for
Returns:
True if the node has the named property - false otherwise.

relationshipHasProperty

public boolean relationshipHasProperty(long relationship,
                                       String propertyName)
Description copied from interface: BatchInserter
Returns true iff the relationship with id has a property with name .

Specified by:
relationshipHasProperty in interface BatchInserter
Parameters:
relationship - The relationship id of the relationship to check.
propertyName - The property name to check for
Returns:
True if the relationship has the named property - false otherwise.

setNodeProperty

public void setNodeProperty(long node,
                            String propertyName,
                            Object propertyValue)
Description copied from interface: BatchInserter
Sets the property with name of node with id to the value . If the property exists it is updated, otherwise created.

Specified by:
setNodeProperty in interface BatchInserter
Parameters:
node - The node id of the node whose property is to be set
propertyName - The name of the property to set
propertyValue - The value of the property to set

setRelationshipProperty

public void setRelationshipProperty(long relationship,
                                    String propertyName,
                                    Object propertyValue)
Description copied from interface: BatchInserter
Sets the property with name of relationship with id to the value . If the property exists it is updated, otherwise created.

Specified by:
setRelationshipProperty in interface BatchInserter
Parameters:
relationship - The node id of the relationship whose property is to be set
propertyName - The name of the property to set
propertyValue - The value of the property to set

removeNodeProperty

public void removeNodeProperty(long node,
                               String propertyName)
Description copied from interface: BatchInserter
Removes the property named from the node with id , if present.

Specified by:
removeNodeProperty in interface BatchInserter
Parameters:
node - The id of the node from which to remove the property
propertyName - The name of the property

removeRelationshipProperty

public void removeRelationshipProperty(long relationship,
                                       String propertyName)
Description copied from interface: BatchInserter
Removes the property named from the relationship with id , if present.

Specified by:
removeRelationshipProperty in interface BatchInserter
Parameters:
relationship - The id of the relationship from which to remove the property
propertyName - The name of the property

createNode

public long createNode(Map<String,Object> properties)
Description copied from interface: BatchInserter
Creates a node assigning next available id to id and also adds any properties supplied.

Specified by:
createNode in interface BatchInserter
Parameters:
properties - a map containing properties or null if no properties should be added.
Returns:
The id of the created node.

createNode

public void createNode(long id,
                       Map<String,Object> properties)
Description copied from interface: BatchInserter
Creates a node with supplied id and properties. If a node with the given id exist a runtime exception will be thrown.

Specified by:
createNode in interface BatchInserter
Parameters:
id - the id of the node to create.
properties - map containing properties or null if no properties should be added.

createRelationship

public long createRelationship(long node1,
                               long node2,
                               RelationshipType type,
                               Map<String,Object> properties)
Description copied from interface: BatchInserter
Creates a relationship between two nodes of a specific type.

Specified by:
createRelationship in interface BatchInserter
Parameters:
node1 - the start node.
node2 - the end node.
type - relationship type.
properties - map containing properties or null if no properties should be added.
Returns:
the id of the created relationship.

setNodeProperties

public void setNodeProperties(long node,
                              Map<String,Object> properties)
Description copied from interface: BatchInserter
Sets the properties of a node. This method will remove any properties already existing and replace it with properties in the supplied map.

For best performance try supply all the nodes properties upon creation of the node. This method will delete any existing properties so using it together with BatchInserter.getNodeProperties(long) will have bad performance.

Specified by:
setNodeProperties in interface BatchInserter
Parameters:
node - the id of the node.
properties - map containing the properties or null to clear all properties.

setRelationshipProperties

public void setRelationshipProperties(long rel,
                                      Map<String,Object> properties)
Description copied from interface: BatchInserter
Sets the properties of a relationship. This method will remove any properties already existing and replace it with properties in the supplied map.

For best performance try supply all the relationship properties upon creation of the relationship. This method will delete any existing properties so using it together with BatchInserter.getRelationshipProperties(long) will have bad performance.

Specified by:
setRelationshipProperties in interface BatchInserter
Parameters:
rel - the id of the relationship.
properties - map containing the properties or null to clear all properties.

nodeExists

public boolean nodeExists(long nodeId)
Description copied from interface: BatchInserter
Checks if a node with the given id exists.

Specified by:
nodeExists in interface BatchInserter
Parameters:
nodeId - the id of the node.
Returns:
true if the node exists.

getNodeProperties

public Map<String,Object> getNodeProperties(long nodeId)
Description copied from interface: BatchInserter
Returns a map containing all the properties of this node.

Specified by:
getNodeProperties in interface BatchInserter
Parameters:
nodeId - the id of the node.
Returns:
map containing this node's properties.

getRelationshipIds

public Iterable<Long> getRelationshipIds(long nodeId)
Description copied from interface: BatchInserter
Returns an iterable over all the relationship ids connected to node with supplied id.

Specified by:
getRelationshipIds in interface BatchInserter
Parameters:
nodeId - the id of the node.
Returns:
iterable over the relationship ids connected to the node.

getRelationships

public Iterable<BatchRelationship> getRelationships(long nodeId)
Description copied from interface: BatchInserter
Returns an iterable of relationships connected to the node with supplied id.

Specified by:
getRelationships in interface BatchInserter
Parameters:
nodeId - the id of the node.
Returns:
iterable over the relationships connected to the node.

getSimpleRelationships

public Iterable<org.neo4j.kernel.impl.batchinsert.SimpleRelationship> getSimpleRelationships(long nodeId)

getRelationshipById

public BatchRelationship getRelationshipById(long relId)
Description copied from interface: BatchInserter
Gets a relationship by id.

Specified by:
getRelationshipById in interface BatchInserter
Parameters:
relId - the relationship id.
Returns:
a simple relationship wrapper for the relationship.

getSimpleRelationshipById

public org.neo4j.kernel.impl.batchinsert.SimpleRelationship getSimpleRelationshipById(long relId)

getRelationshipProperties

public Map<String,Object> getRelationshipProperties(long relId)
Description copied from interface: BatchInserter
Returns a map containing all the properties of the relationships.

Specified by:
getRelationshipProperties in interface BatchInserter
Parameters:
relId - the id of the relationship.
Returns:
map containing the relationship's properties.

shutdown

public void shutdown()
Description copied from interface: BatchInserter
Shuts down this batch inserter syncing all changes that are still only in memory to disk. Failing to invoke this method may leave the Neo4j store in a inconsistent state.

After this method has been invoked any other method call to this batch inserter is illegal.

Specified by:
shutdown in interface BatchInserter

toString

public String toString()
Overrides:
toString in class Object

getStoreDir

public String getStoreDir()
Description copied from interface: BatchInserter
Returns the path to this Neo4j store.

Specified by:
getStoreDir in interface BatchInserter
Returns:
the path to this Neo4j store.

getReferenceNode

public long getReferenceNode()
Description copied from interface: BatchInserter
Returns the reference node id or -1 if it doesn't exist.

Specified by:
getReferenceNode in interface BatchInserter
Returns:
the reference node

getBatchGraphDbService

public GraphDatabaseService getBatchGraphDbService()
Deprecated. as of Neo4j 1.7


getIndexStore

public org.neo4j.kernel.impl.index.IndexStore getIndexStore()

getIdGeneratorFactory

public IdGeneratorFactory getIdGeneratorFactory()


Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.