1
votes

Matching and returning a path should return the nodes and the relationships between them in path order.

According to the Cypher documentation, this should include the relationship types. If you look at the developer docs, and search for any query that ends with return p, the returned pattern always includes the type of each relationship, such as:

[Node[2]\{name:"Michael Douglas"\},:ACTED_IN[5]\{role:"President Andrew Shepherd"\},Node[6]\{title:"The American President"\}]

However, in the Neo4j 3.0.3 browser (and assuming other versions as well, haven't seen the fix in the 3.0.4 changelog), any output of a relationship (whether as part of a path or otherwise) returns the relationship properties only, or an empty object {} if no properties exist. The type doesn't output at all:

[{name: Black}, {}, {name: Red}, {}, {name: Yellow}, {}, {name: Black}, {}, {name: Blue}]

I can output the relationships separately, in another column by adding this to the return:

EXTRACT(rel in RELS(path) | TYPE(rel)) as relType

But what I really want is the path output (lists of nodes and relationships between each node) but including the relationship type.

Is there some option I can turn on, or some other function or query workaround that outputs this?

1

1 Answers

1
votes

In the browser, you can click on the Code tab (on the lefthand side of the response panel, underneath Graph, Rows, and Text) to see the full Response (in the Commit Transaction box on the right).

Alternatively, you can download the full response in a JSON (or CSV) file using the download icon at the top of each query panel.

The full response contains all the relationship data and metadata (including the relationship type).

[UPDATED]

The Code pane shows you the POST requests that the browser web app makes to the neo4j transactional endpoint. So, the results in that pane are actually the same results that any client would receive for the same request.

However, when you make the calls yourself, you can reduce the amount of data returned (much of which is redundant or perhaps uninteresting) by modifying the optional arguments in the payload of the "Commit Transaction". For example, you can try specifying a resultDataContents array with just a "graph" element, and omitting the "includeStats" argument entirely. The response will basically just contain the "graph" data elements.