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

Path meta data doesn’t include node labels or rel type (HTTP API) #12613

Closed
johannessen opened this issue Oct 26, 2020 · 7 comments
Closed
Labels

Comments

@johannessen
Copy link

johannessen commented Oct 26, 2020

When Cypher statements returning paths are executed over the Transactional HTTP API, the JSON results do not include the labels of the nodes in the path, nor do they include the types of the relationships in the path.

This issue just came up in a conversation with @fbiville. In #12306 (comment), @technige mentioned that several issues around the HTTP output format were already known, so I kind of expected that this particular issue was one of them and never pursued this up until now.

Reproducing the issue

Run the following query on the transactional HTTP interface.

CREATE p=(a:Test)-[b:TEST]->(c:Test) RETURN p

Expected JSON result

{
  "data": [
    {
      "meta": [
        [
          { "deleted": false, "id": 5,   "type": "node",         "labels": ["Test"] },
          { "deleted": false, "id": 368, "type": "relationship", "relationship_type": "TEST" },
          { "deleted": false, "id": 6,   "type": "node",         "labels": ["Test"] }
        ]
      ],
      ...
    }
  ]
}

Actual JSON result

{
  "data": [
    {
      "meta": [
        [
          { "deleted": false, "id": 5,   "type": "node" },
          { "deleted": false, "id": 368, "type": "relationship" },
          { "deleted": false, "id": 6,   "type": "node" }
        ]
      ],
      ...
    }
  ]
}

Note that the rest resultDataContents also do not include node labels or relationship types. The graph resultDataContents do, but it seems to me that this meta data should really be available in the meta resultDataContents.

One way of resolving this issue would be to add the labels/type in Neo4jJsonCodec.writeMeta(), with writeNodeOrRelationshipMeta() being adjusted accordingly.

@technige
Copy link
Contributor

technige commented Nov 3, 2020

@johannessen A new additional result format will be available in Neo4j 4.2. This should include more complete information, so will hopefully address your issue.

@johannessen
Copy link
Author

Jolt looks good to me. Nice job, thanks!

@Maadhav
Copy link

Maadhav commented Dec 20, 2021

I am not sure if I am missing something, but on neo4j 2.4.1 I still don't see any labels information in the meta property of the response. Are there any future plans for adding them?

@fbiville
Copy link
Contributor

@Maadhav I assume you mean Neo4j 4.2.1, right?
Have you checked out https://neo4j.com/docs/http-api/current/actions/result-format/#_jolt?

@Maadhav
Copy link

Maadhav commented Dec 21, 2021

@fbiville I have never worked before with jolt, and all my frontend apps, are using the JSON response from the rest of API. Just wanted to know if it would be possible to add the labels key in the meta field of the response in the future.
Thanks.

@fbiville
Copy link
Contributor

@Maadhav I'm fairly confident this won't happen. You will need to switch to Jolt.

@johannessen
Copy link
Author

As pointed out in the initial report, labels and types are available in JSON as part of the graph result if requested. Correlating the meta data this way on the client side seems a bit of a hassle though. I’d say Jolt should be considered the solution here.

Also, Jolt is much faster than JSON. ⚡️

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

No branches or pull requests

4 participants