|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface GraphDatabaseService
The main access point to a running Neo4j instance. The most common
implementation is the EmbeddedGraphDatabase
class, which is used to
embed Neo4j in an application. Typically, you would create an
EmbeddedGraphDatabase
instance as follows:
GraphDatabaseService graphDb = new EmbeddedGraphDatabase( "var/graphDb" );
// ... use Neo4j
graphDb.shutdown()
;
GraphDatabaseService provides operations to enable
the shell
, create nodes
, get
nodes given an id
, get the reference node
and
ultimately shutdown Neo4j
.
Please note that all operations that read or write to the graph must be
invoked in a transactional context
. Failure to do so will
result in a NotInTransactionException
being thrown.
Method Summary | |
---|---|
Transaction |
beginTx()
Starts a new transaction and associates it with the current thread. |
Node |
createNode()
Creates a new node. |
boolean |
enableRemoteShell()
Enables remote shell access (with default configuration) to this Neo4j instance, if the Neo4j shell component is available on the classpath. |
boolean |
enableRemoteShell(Map<String,Serializable> initialProperties)
Enables remote shell access to this Neo4j instance, if the Neo4j Shell component is available on the classpath. |
Iterable<Node> |
getAllNodes()
Returns all nodes in the node space. |
Node |
getNodeById(long id)
Looks up a node by id. |
Node |
getReferenceNode()
Returns the reference node, which is a "starting point" in the node space. |
Relationship |
getRelationshipById(long id)
Looks up a relationship by id. |
Iterable<RelationshipType> |
getRelationshipTypes()
Returns all relationship types currently in the underlying store. |
void |
shutdown()
Shuts down Neo4j. |
Method Detail |
---|
Node createNode()
Node getNodeById(long id)
id
- the id of the node
id
if found
NotFoundException
- if not foundRelationship getRelationshipById(long id)
id
- the id of the relationship
id
if found
NotFoundException
- if not foundNode getReferenceNode()
NotFoundException
- if unable to get the reference nodeIterable<Node> getAllNodes()
Iterable<RelationshipType> getRelationshipTypes()
node.createRelationshipTo(...)
. Note that this method is guaranteed to
return all known relationship types, but it does not guarantee that it
won't return more than that (e.g. it can return "historic"
relationship types that no longer have any relationships in the node
space).
void shutdown()
boolean enableRemoteShell()
enableRemoteShell( null )
.
true
if the shell has been enabled,
false
otherwise (false
usually
indicates that the shell
jar dependency is not on
the classpath)boolean enableRemoteShell(Map<String,Serializable> initialProperties)
org.neo4j.shell.ShellClient
from the Neo4j Shell project.
Typically, the neo4j-shell
binary package is used (see neo4j.org/download).
The shell is parameterized by a map of properties passed in to this method. Currently, two properties are used:
port
, an Integer
describing the port of the RMI
registry where the Neo4j shell will be bound, defaults to
1337
name
, the String
under which the Neo4j shell
will be bound in the RMI registry, defaults to shell
initialProperties
- a set of properties that will be used to
configure the remote shell, or null
if the
default properties should be used
true
if the shell has been enabled,
false
otherwise (false
usually
indicates that the shell
jar dependency is not on
the classpath)
ClassCastException
- if the shell library is available, but one (or
more) of the configuration properties have an unexpected type
IllegalStateException
- if the shell library is available, but the
remote shell can't be enabled anywayTransaction beginTx()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |