Neo4j Enterprise

org.neo4j.kernel.api.operations
Interface LabelOperations

All Known Subinterfaces:
StatementContext

public interface LabelOperations


Method Summary
 boolean addLabelToNode(long labelId, long nodeId)
          Labels a node with the label corresponding to the given label id.
 long getLabelId(String label)
          Returns a label id for a label name.
 String getLabelName(long labelId)
          Returns the label name for the given label id.
 Iterator<Long> getLabelsForNode(long nodeId)
          Returns all labels set on node with id nodeId.
 long getOrCreateLabelId(String label)
          Returns a label id for a label name.
 boolean isLabelSetOnNode(long labelId, long nodeId)
          Checks if a node is labeled with a certain label or not.
 boolean removeLabelFromNode(long labelId, long nodeId)
          Removes a label with the corresponding id from a node.
 

Method Detail

getOrCreateLabelId

long getOrCreateLabelId(String label)
                        throws ConstraintViolationKernelException
Returns a label id for a label name. If the label doesn't exist prior to this call it gets created.

Throws:
ConstraintViolationKernelException

getLabelId

long getLabelId(String label)
                throws LabelNotFoundKernelException
Returns a label id for a label name. If the label doesn't exist a LabelNotFoundKernelException will be thrown.

Throws:
LabelNotFoundKernelException

getLabelName

String getLabelName(long labelId)
                    throws LabelNotFoundKernelException
Returns the label name for the given label id.

Throws:
LabelNotFoundKernelException

addLabelToNode

boolean addLabelToNode(long labelId,
                       long nodeId)
                       throws EntityNotFoundException
Labels a node with the label corresponding to the given label id. If the node already had that label nothing will happen. Label ids are retrieved from getOrCreateLabelId(String) or getLabelId(String).

Throws:
EntityNotFoundException

isLabelSetOnNode

boolean isLabelSetOnNode(long labelId,
                         long nodeId)
                         throws EntityNotFoundException
Checks if a node is labeled with a certain label or not. Returns true if the node is labeled with the label, otherwise false. Label ids are retrieved from getOrCreateLabelId(String) or getLabelId(String).

Throws:
EntityNotFoundException

getLabelsForNode

Iterator<Long> getLabelsForNode(long nodeId)
                                throws EntityNotFoundException
Returns all labels set on node with id nodeId. If the node has no labels an empty Iterable will be returned.

Throws:
EntityNotFoundException

removeLabelFromNode

boolean removeLabelFromNode(long labelId,
                            long nodeId)
                            throws EntityNotFoundException
Removes a label with the corresponding id from a node. If the node doesn't have that label nothing will happen. Label ids are retrieved from getOrCreateLabelId(String) or getLabelId(String).

Throws:
EntityNotFoundException

Neo4j Enterprise

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