johannessen / neo4j-driver-perl

Neo4j graph database driver (Bolt/Jolt) for Perl
https://metacpan.org/pod/Neo4j::Driver
Artistic License 2.0
5 stars 1 forks source link

Neo4j nodes and relationships are returned as hash refs #2

Closed johannessen closed 5 years ago

johannessen commented 5 years ago

Queries returning entire Neo4j nodes or relationships (e. g. MATCH (a) RETURN (a)) return hash refs of the respective properties. They should instead return blessed objects with methods to access both properties and meta data (id etc.).

This issue is already classified as a bug in the Neo4j::Driver documentation, which in general terms describes all significant differences in behaviour between this driver and the official Neo4j drivers as bugs. Fixing this will constitute an unavoidable breaking change.

johannessen commented 5 years ago

20dbc8afff1f3a2b5079e9ad3be66a41f74b1168 addresses this by blessing the existing data structures for nodes, relationships and paths. Meta data is added to these under the hash key _meta. Code which doesn’t use properties with that name and also doesn’t use ref or similar checks on the type of the data structures returned from Neo4j will continue to work fine.

For now, that is.

The “old” way to access the properties directly using ->{…} is now deprecated. In order to support properties named _meta, the implementation of these objects will eventually have to change in a way that—barring any black magic with operator overloading—will not be backwards-compatible. Such a change will likely take place around the shift to version 1.0.