Find file History
Pull request Compare This branch is 1 commit ahead, 8 commits behind larusba:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
src
README.adoc
pom.xml

README.adoc

Neo4j JDBC Driver - Bolt

This module implements the neo4j-jdbc driver with the BOLT protocol.

This module is a JDBC-way wrapper of the Neo4j-java driver currently implementing an alpha version of the BOLT protocol for Java.

Special wrapping for neo4j nodes relationships and paths.

Even if you can access each value in a ResultSet with multiple type-specific method, you might want to get a whole node, relationship or path.

This can’t be done by default with JDBC standard methods, to allow this usage we re-invented the use of getObject(*) method.

If the object you are trying to get is an instanceof InternalNode (thus being a neo4j Node) it will be returned wrapped in a Map<String, Object>. This map will contain all the object’s properties where their names (String) are the keys. It will also contains two default values mapped as “_id”, representing neo4j internal identity ID and “_labels”, a Collection of all the labels of that node.

If the object is instead an instanceof InternalRelationship (thus being a neo4j Relationship) it will be also returned as a Map<String, Object>. This map will contain all the object’s properties and the four default: “_id” the internal neo4j ID, “_type” that is the type of the relationship, “_startId” that is the internal neo4j Node ID where the relation starts from, “_endId” that is the internal neo4j Node ID where the relation ends.

If the object is instead an instanceof InternalPath (thus being a neo4j Path) it will be also returned as an ArrayList<Map<String, Object>>. this list will contain an alternation of Node and Relationship converted following the below two lines' specifications.

Important
You can’t get an InternalNode or InternalRelationship directly InternalPath

When the object is not recognized as one of the two specified it is treated as a standard object and returned directly.

Bolt module specific URL parameters

When using the jdbc Bolt module you will be able to specify dedicated parameters, here is a list of them:

Flatten

When a ResultSet is flattened it explodes the returned columns (ONLY if they are ALL nodes and relationships) adding virtual columns with id, labels, type and entity specific fields.

You can enable such behaviour just by adding ?flatten=x to your url connection where x possible values are:

  • -1: the entire resultSet is fetched (may slow down the performances with big resultSets) for retrieving nodes and relationships structure (useful if you’re retrieving results with lots of different properties)

  • N > 0: the specified number of rows are fetched for retrieving specific properties

Example: Given a :User node connected to :Attributes nodes like (:Attribute {age:20})< -[:AGED]-(:User {username:"username"})-[FULL_NAME]- >(:Attribute {full_name:"Name Surname"})

with the query:

MATCH (u:User)--(a:Attribute) RETURN u, a;

you will have only the columns (u, a) with flattening disabled;

with flatten=1 you will have u, u.id, u.labels, u.username, a, a.id, a.type, a.age

with flatten=-1 you will have u, u.id, u.labels, u.username, a, a.id, a.type, a.age, a.full_name