sarmbruster / neo4j-uuid

Neo4j-uuid is a unmanaged extension to Neo4j. It features automatic UUIDs on nodes and relationships.
GNU General Public License v3.0
25 stars 11 forks source link

Return UUID on Creation #1

Closed Marquis103 closed 10 years ago

Marquis103 commented 11 years ago

How can I achieve this? If I go to my console and run a query that creates nodes or relationships the uuid creates successfully, but is there a way that I can return the UUID on object (node, relationship) creation?

sarmbruster commented 11 years ago

e.g. with cypher CREATE (n) RETURN n.uuid should work.

Marquis103 commented 11 years ago

hey @sarmbruster thanks for the response. I definitely thought that'd work, but it returns null. Do you think it is an issue because i'm using milestone 06 of version 2.0?

sarmbruster commented 11 years ago

You're right, Cypher statements do not return the uuid generated in the same statement:

create n return id(n), n.uuid

returns the node's id but not the uuid. A subsequent query returns the uuid:

start n=node(<previousId>) return n.uuid

The problem is that the uuid is applied in a TransactionEventHandler which is executed on transaction commit. At that time the cypher statement is already processed. Need to investigate what we can do about it. For now query the uuid in a separate statements as a workaround.

sarmbruster commented 11 years ago

update: 1.9.x has the same behaviour.

neo4j-uuid was initially created for a non-cypher project.

Marquis103 commented 11 years ago

No problem, I was just making sure I understood the functionality. If the uuid wasn't designed to work using cypher, it's not a big deal. Thanks for your time and development.

sqreept commented 10 years ago

Hi @sarmbruster. Any news on this issue?

sarmbruster commented 10 years ago

There is no way to solve this without applying larger changes inside Neo4j. Please feel free to raise a feature request with https://github.com/neo4j/neo4j/issues for making changes done in TransactionEventHandlers visible to Cypher's RETURN clause.

sqreept commented 10 years ago

Thanks a lot for clarifying this. On Apr 12, 2014 10:28 AM, "Stefan Armbruster" notifications@github.com wrote:

There is no way to solve this without applying larger changes inside Neo4j. Please feel free to raise a feature request with https://github.com/neo4j/neo4j/issues for making changes done in TransactionEventHandlers visible to Cypher's RETURN clause.

Reply to this email directly or view it on GitHubhttps://github.com/sarmbruster/neo4j-uuid/issues/1#issuecomment-40274054 .