public class BatchInserterImpl extends Object implements BatchInserter
| Modifier and Type | Method and Description |
|---|---|
ConstraintCreator |
createDeferredConstraint(Label label)
Returns a
ConstraintCreator where details about the constraint can be
specified. |
IndexCreator |
createDeferredSchemaIndex(Label label)
Returns an
IndexCreator where details about the index to create can be
specified. |
void |
createNode(long id,
Map<String,Object> properties,
Label... labels)
Creates a node with supplied id and properties.
|
long |
createNode(Map<String,Object> properties,
Label... labels)
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.
|
org.neo4j.kernel.IdGeneratorFactory |
getIdGeneratorFactory() |
org.neo4j.kernel.impl.index.IndexStore |
getIndexStore() |
Iterable<Label> |
getNodeLabels(long node) |
Map<String,Object> |
getNodeProperties(long nodeId)
Returns a map containing all the properties of this node.
|
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 |
nodeHasLabel(long node,
Label label) |
boolean |
nodeHasProperty(long node,
String propertyName)
Returns true iff the node with id
node has a property with name
propertyName. |
boolean |
relationshipHasProperty(long relationship,
String propertyName)
Returns true iff the relationship with id
relationship has a
property with name propertyName. |
void |
removeNodeProperty(long node,
String propertyName)
Removes the property named
property from the node with id
id, if present. |
void |
removeRelationshipProperty(long relationship,
String propertyName)
Removes the property named
property from the relationship with id
id, if present. |
void |
setNodeLabels(long node,
Label... labels)
Replaces any existing labels for the given node with the supplied list of labels.
|
void |
setNodeProperties(long node,
Map<String,Object> properties)
Sets the properties of a node.
|
void |
setNodeProperty(long node,
String propertyName,
Object newValue)
Sets the property with name
propertyName of node with id
node to the value propertyValue. |
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
propertyName of relationship with id
relationship to the value propertyValue. |
void |
shutdown()
Shuts down this batch inserter syncing all changes that are still only
in memory to disk.
|
String |
toString() |
public boolean nodeHasProperty(long node,
String propertyName)
BatchInserternode has a property with name
propertyName.nodeHasProperty in interface BatchInserternode - The node id of the node to check.propertyName - The property name to check forpublic boolean relationshipHasProperty(long relationship,
String propertyName)
BatchInserterrelationship has a
property with name propertyName.relationshipHasProperty in interface BatchInserterrelationship - The relationship id of the relationship to check.propertyName - The property name to check forpublic void setNodeProperty(long node,
String propertyName,
Object newValue)
BatchInserterpropertyName of node with id
node to the value propertyValue. If the property exists
it is updated, otherwise created.setNodeProperty in interface BatchInserternode - The node id of the node whose property is to be setpropertyName - The name of the property to setnewValue - The value of the property to setpublic void setRelationshipProperty(long relationship,
String propertyName,
Object propertyValue)
BatchInserterpropertyName of relationship with id
relationship to the value propertyValue. If the property
exists it is updated, otherwise created.setRelationshipProperty in interface BatchInserterrelationship - The node id of the relationship whose property is to
be setpropertyName - The name of the property to setpropertyValue - The value of the property to setpublic void removeNodeProperty(long node,
String propertyName)
BatchInserterproperty from the node with id
id, if present.removeNodeProperty in interface BatchInserternode - The id of the node from which to remove the propertypropertyName - The name of the propertypublic void removeRelationshipProperty(long relationship,
String propertyName)
BatchInserterproperty from the relationship with id
id, if present.removeRelationshipProperty in interface BatchInserterrelationship - The id of the relationship from which to remove the
propertypropertyName - The name of the propertypublic IndexCreator createDeferredSchemaIndex(Label label)
BatchInserterIndexCreator where details about the index to create can be
specified. When all details have been entered create
must be called for it to actually be created.
Creating an index enables indexing for nodes with the specified label. The index will
have the details supplied to the returned index creator.
Indexes created with the method are deferred until the batch inserter is shut down, at
which point a background job will populate all indexes, i.e. the index
is not available during the batch insertion itself. It is therefore advisable to
create deferred indexes just before shutting down the batch inserter.createDeferredSchemaIndex in interface BatchInserterlabel - label on nodes to be indexedIndexCreator capable of providing details for, as well as creating
an index for the given label.public ConstraintCreator createDeferredConstraint(Label label)
BatchInserterConstraintCreator where details about the constraint can be
specified. When all details have been entered ConstraintCreator.create()
must be called for it to actually be created.
Creating a constraint will have the transaction creating it block on commit until
all existing data has been verified for compliance. If any existing data doesn't
comply with the constraint the transaction will not be able to commit, but
fail in Transaction.close().createDeferredConstraint in interface BatchInserterlabel - the label this constraint is for.ConstraintCreator capable of providing details for, as well as creating
a constraint for the given label.public long createNode(Map<String,Object> properties, Label... labels)
BatchInsertercreateNode in interface BatchInserterproperties - a map containing properties or null if no
properties should be added.labels - a list of labels to initially create the node with.public void createNode(long id,
Map<String,Object> properties,
Label... labels)
BatchInsertercreateNode in interface BatchInserterid - the id of the node to create.properties - map containing properties or null if no
properties should be added.labels - a list of labels to initially create the node with.public void setNodeLabels(long node,
Label... labels)
BatchInsertersetNodeLabels in interface BatchInserternode - the node to set labels for.labels - the labels to set for the node.public Iterable<Label> getNodeLabels(long node)
getNodeLabels in interface BatchInserternode - the node to get labels for.public boolean nodeHasLabel(long node,
Label label)
nodeHasLabel in interface BatchInserternode - the node to check.label - the label to check.true if a node has a given label, otherwise false.public long createRelationship(long node1,
long node2,
RelationshipType type,
Map<String,Object> properties)
BatchInsertercreateRelationship in interface BatchInserternode1 - the start node.node2 - the end node.type - relationship type.properties - map containing properties or null if no
properties should be added.public void setNodeProperties(long node,
Map<String,Object> properties)
BatchInserter
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.
setNodeProperties in interface BatchInserternode - the id of the node.properties - map containing the properties or null to
clear all properties.public void setRelationshipProperties(long rel,
Map<String,Object> properties)
BatchInserter
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.
setRelationshipProperties in interface BatchInserterrel - the id of the relationship.properties - map containing the properties or null to
clear all properties.public boolean nodeExists(long nodeId)
BatchInserternodeExists in interface BatchInserternodeId - the id of the node.true if the node exists.public Map<String,Object> getNodeProperties(long nodeId)
BatchInsertergetNodeProperties in interface BatchInserternodeId - the id of the node.public Iterable<Long> getRelationshipIds(long nodeId)
BatchInsertergetRelationshipIds in interface BatchInserternodeId - the id of the node.public Iterable<BatchRelationship> getRelationships(long nodeId)
BatchInserterrelationships connected
to the node with supplied id.getRelationships in interface BatchInserternodeId - the id of the node.public BatchRelationship getRelationshipById(long relId)
BatchInsertergetRelationshipById in interface BatchInserterrelId - the relationship id.public Map<String,Object> getRelationshipProperties(long relId)
BatchInsertergetRelationshipProperties in interface BatchInserterrelId - the id of the relationship.public void shutdown()
BatchInserterAfter this method has been invoked any other method call to this batch inserter is illegal.
shutdown in interface BatchInserterpublic String getStoreDir()
BatchInsertergetStoreDir in interface BatchInserterpublic org.neo4j.kernel.impl.index.IndexStore getIndexStore()
public org.neo4j.kernel.IdGeneratorFactory getIdGeneratorFactory()
Copyright © 2002–2015 The Neo4j Graph Database Project. All rights reserved.