Skip to content

Graph: Compability with non-compact relationship property names #2404

Open
@jonaskello

Description

@jonaskello

Motivation

If you return a relationship using GRAPH.QUERY in non-compact mode the properties of the relationship object are named id, type, src_node, dest_node, properties :

127.0.0.1:16380> GRAPH.QUERY MotoGP "MATCH (a)-[r]->(b) RETURN r"
1) 1) "r"
2) 1) 1) 1) 1) "id"
            2) (integer) 0
         2) 1) "type"
            2) "rides"
         3) 1) "src_node"
            2) (integer) 0
         4) 1) "dest_node"
            2) (integer) 1
         5) 1) "properties"
            2) (empty list or set)
...
3) 1) "Cached execution: 0"
   2) "Query internal execution time: 0.246391 milliseconds"

So this translates to an JSON object like this:

{
    "id": 53,
    "type": "rides",
    "src_node": 0,
    "dest_node": 1,
    "properties": {}
}

However using the graph package in this repo (which uses compact mode) we get this object for a relationship:

{
    "id": 53,
    "relationshipType": "rides",
    "sourceId": 0,
    "destinationId": 1,
    "properties": {}
}

So the property names of the relationship object are different (eg. relationshipType vs type). Our code currently assumes the names we got in non-compact mode. It would be very nice if the graph package could have some option to use the same names as in non-compact mode because then we would not have to rewrite all our code to the use new names.

Basic Code Example

Se above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions