Overview | Package | Class | Use | Tree | Deprecated | Index | Help

Neo4j Community
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.neo4j.unsafe.batchinsert
Interface BatchInserter

All Known Implementing Classes:
  BatchInserterImpl

    public interface BatchInserter

The batch inserter drops support for transactions and concurrency in favor of insertion speed. When done using the batch inserter `shutdown()` must be invoked and complete successfully for the Neo4j store to be in consistent state.

Only one thread at a time may work against the batch inserter, multiple threads performing concurrent access have to employ synchronization.

Transactions are not supported so if the JVM/machine crashes or you fail to invoke `shutdown()` before JVM exits the Neo4j store can be considered being in non consistent state and the insertion has to be re-done from scratch.

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.
`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.
`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 property)` Removes the property named from the node with id , if present.
`void` | `removeRelationshipProperty(long relationship, String property)` 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.

Method Detail

### createNode

    long createNode(Map<String,Object> properties)

  Creates a node assigning next available id to id and also adds any properties supplied.

  Parameters:
    `properties` - a map containing properties or `null` if no properties should be added.
  Returns:
    The id of the created node.

### nodeExists

    boolean nodeExists(long nodeId)

  Checks if a node with the given id exists.

  Parameters:
    `nodeId` - the id of the node.
  Returns:
    `true` if the node exists.

### setNodeProperties

    void setNodeProperties(long node,
                           Map<String,Object> properties)

  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 `getNodeProperties(long)` will have bad performance.

  Parameters:
    `node` - the id of the node.
    `properties` - map containing the properties or `null` to clear all properties.

### nodeHasProperty

    boolean nodeHasProperty(long node,
                            String propertyName)

  Returns true iff the node with id has a property with name .

  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

    boolean relationshipHasProperty(long relationship,
                                    String propertyName)

  Returns true iff the relationship with id has a property with name .

  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

    void setNodeProperty(long node,
                         String propertyName,
                         Object propertyValue)

  Sets the property with name of node with id to the value . If the property exists it is updated, otherwise created.

  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

    void setRelationshipProperty(long relationship,
                                 String propertyName,
                                 Object propertyValue)

  Sets the property with name of relationship with id to the value . If the property exists it is updated, otherwise created.

  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

### getNodeProperties

    Map<String,Object> getNodeProperties(long nodeId)

  Returns a map containing all the properties of this node.

  Parameters:
    `nodeId` - the id of the node.
  Returns:
    map containing this node's properties.

### getRelationshipIds

    Iterable<Long> getRelationshipIds(long nodeId)

  Returns an iterable over all the relationship ids connected to node with supplied id.

  Parameters:
    `nodeId` - the id of the node.
  Returns:
    iterable over the relationship ids connected to the node.

### getRelationships

    Iterable<BatchRelationship> getRelationships(long nodeId)

  Returns an iterable of `relationships` connected to the node with supplied id.

  Parameters:
    `nodeId` - the id of the node.
  Returns:
    iterable over the relationships connected to the node.

### createNode

    void createNode(long id,
                    Map<String,Object> properties)

  Creates a node with supplied id and properties. If a node with the given id exist a runtime exception will be thrown.

  Parameters:
    `id` - the id of the node to create.
    `properties` - map containing properties or `null` if no properties should be added.

### createRelationship

    long createRelationship(long node1,
                            long node2,
                            RelationshipType type,
                            Map<String,Object> properties)

  Creates a relationship between two nodes of a specific type.

  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.

### getRelationshipById

    BatchRelationship getRelationshipById(long relId)

  Gets a relationship by id.

  Parameters:
    `relId` - the relationship id.
  Returns:
    a simple relationship wrapper for the relationship.

### setRelationshipProperties

    void setRelationshipProperties(long rel,
                                   Map<String,Object> properties)

  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 `getRelationshipProperties(long)` will have bad performance.

  Parameters:
    `rel` - the id of the relationship.
    `properties` - map containing the properties or `null` to clear all properties.

### getRelationshipProperties

    Map<String,Object> getRelationshipProperties(long relId)

  Returns a map containing all the properties of the relationships.

  Parameters:
    `relId` - the id of the relationship.
  Returns:
    map containing the relationship's properties.

### removeNodeProperty

    void removeNodeProperty(long node,
                            String property)

  Removes the property named from the node with id , if present.

  Parameters:
    `node` - The id of the node from which to remove the property
    `property` - The name of the property

### removeRelationshipProperty

    void removeRelationshipProperty(long relationship,
                                    String property)

  Removes the property named from the relationship with id , if present.

  Parameters:
    `relationship` - The id of the relationship from which to remove the property
    `property` - The name of the property

### shutdown

    void shutdown()

  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.

### getStoreDir

    String getStoreDir()

  Returns the path to this Neo4j store.

  Returns:
    the path to this Neo4j store.

### getReferenceNode

    long getReferenceNode()

  Returns the reference node id or `-1` if it doesn't exist.

  Returns:
    the reference node

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

Neo4j Community
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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