Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plans for a Bolt-based api impl? #5

Open
dlutz2 opened this issue Apr 20, 2017 · 10 comments
Open

Plans for a Bolt-based api impl? #5

dlutz2 opened this issue Apr 20, 2017 · 10 comments

Comments

@dlutz2
Copy link

dlutz2 commented Apr 20, 2017

Any plans for a Bolt based implementation of neo4j-tinkerpop-api-impl or something similar? I have looked at neo4j-gremlin-bolt but it has some serious issues which I could not resolve.

@spmallette
Copy link

our of curiosity - what were the issues with neo4j-gremlin-bolt?

@dlutz2
Copy link
Author

dlutz2 commented Apr 20, 2017

The fundamental thing seems to be that vertex IDs are all null till committed (using their NativeID model), so although it could be used as a loader, many uses of traversals either throw a null pointer exception or gives bizarre answers (since there is effectively only one distinguishable vertex)

@spmallette
Copy link

that's not good - didn't know that there was that big a problem.

@dlutz2
Copy link
Author

dlutz2 commented Apr 20, 2017

I was baffled for 3 days thinking I was doing something embarrassingly wrong because I couldnt get past

  Vertex v = graph.addVertex(label);
   g.V(v.id())  or g.V(v)  or g.V(randomString) or g.V(null) ......   ;

@jexp
Copy link
Member

jexp commented Apr 21, 2017

@dlutz2 did you talk to the people from SteelBridgeLabs about the issue?

@dlutz2
Copy link
Author

dlutz2 commented Apr 21, 2017

Yes, filed issue SteelBridgeLabs/neo4j-gremlin-bolt#52 but it was closed without an actual fix.

@rjbaucells
Copy link

This issue is related to the fact that the node/relation identifier is not issued until a CREATE statement is executed on the BOLT driver. Gremlin requires vertex and edge ids to be available on element creation, thing that is not possible if using the neo4j native identifiers.

// create vertex
Vertex v = graph.addVertex(label);
// vertex id() is null until transaction is committed (CREATE statement is executed)
v.id() == null

One solution is to use the client side generated identifiers.

// create vertex
Vertex v = graph.addVertex(label);
// vertex id() is allocated on node/relation creation
v.id() != null

@jexp
Copy link
Member

jexp commented Apr 23, 2017 via email

@rjbaucells
Copy link

Yes the IDs are generated on CREATE statement execution, not on commit. The library does not send any statements to the database until an explicit transaction commit is executed. There is a problem with flushing CREATE statements into the database, node/relation might not have the required fields enforced at the database level with constraints. The transaction commit is an indication that all required fields have been populated and the library throws an exception if this is not the case.

The library supports gremlin by using the non-native id generation, it passes the Tinkerpop integration tests (StructureStandardSuite and ProcessStandardSuite) without problems.

A possible solution would be by implementing another strategy for ID generation, this strategy could persist the node/relation on creation with the constraint that all required fields must be provided at the time, for example:

// create vertex
Vertex v = graph.addVertex(T.label, "label1", "field1", value1, ..., "fieldn", valuen);

Failing to provide a required field value will throw an exception on Graph.addVertex() and Vertex.addEdge().

@dlutz2
Copy link
Author

dlutz2 commented Apr 23, 2017

That last proposal for another ID generation strategy that threw exceptions if the constraint-required field(s) were not present would work for our scenarios since we don't use schema constraints (we also use the same analytics for non-Neo4j backends which don't have constraints)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants