I've created a NeoVis based on the example given here: NeoVis Form Example
I've adapted it a little bit - but I really am simply passing a Cypher query in as a string - and for the most part it works completely as expected.
But I have one important scenario where the Cypher results are not as expected. Moreover, in this scenario alone, they are different to the results obtained running the same Cypher in the Neo4J browser.
Here is the Cypher query I'm dealing with:
MATCH (n: Question) WHERE n.question_id = "9377398" OPTIONAL MATCH (n: Question)-[r:connected]->(m: Theme) WHERE n.question_id = "9377398" RETURN n, r, m
The node that is matched, namely the node of Label 'Question' having question_id "9377398", does NOT currently have any relationships to any nodes of Label 'Theme', and so it is the first MATCH clause (rather than the subsequent OPTIONAL MATCH clause) that returns results, and hence it is only the "n" part of the RETURN clause that is not null.
When we run the Neo4J browser, we find (as expected) results consisting of one node of Label 'Question' having question_id "9377398" (and no relationships, etc).
By contrast, when we run via the NeoVis implementation, NO results at all are returned. Yet, when we amend the query as follows:
MATCH (n: Question) WHERE n.question_id = "9377398" OPTIONAL MATCH (n: Question)-[r:connected]->(m: Theme) WHERE n.question_id = "9377398" RETURN n
... in other words we have explicitly removed the possibility to return any relationships and connected nodes, should they exist, then in that case the NeoVis implementation now successfully returns just the one node of Label 'Question' having question_id "9377398" (and no relationships, etc).
I would appreciate any assistance in either making adjustments to my NeoVis implementation to align its behaviour with the Neo4J browser or otherwise assistance in constructing a Cypher query which will be robust to this issue (NB// I have attempted to do like MATCH ... RETURN n UNION MATCH ... RETURN n, r, m
yet even then, the NeoVis implementation won't return anything )
Thanks in advance