Database Reference
In-Depth Information
tps://github.com/neo4j/java-rest-binding
)
to begin navigating through all of Adam's rela-
tionships. This particular binding conveniently wraps the REST calls behind the well-
known
GraphDatabaseService
API, which you've already encountered in the Neo4j
embedded mode.
Listing 10.8. Java REST client using the java-rest-binding library
Note
The neo4j-rest-graphdb binding provides two ways to interact with the server. The first
is the
RestAPIFacade
interface that provides simple wrappers around the basic Neo4j
REST API. The other approach (used in
listing 10.8
) is to use a
GraphDatabaseSer-
vice
implementation that delegates to the appropriate REST API calls behind the scenes.
Although this second approach can be very convenient in that it uses the
GraphData-
baseService
interface you've come to know and love, it must be stressed that you
shouldn't expect the same performance that you'll get from the embedded mode. The ad-
ditional network calls involved will make the Neo4j server calls perform less optimally
than simple embedded calls. You'll need to employ different tactics when using a
GraphDatabaseService
that's talking to a Neo4j server over the network to get ac-
ceptable performance. We'll be looking into these options later in the chapter.