Replicating Neo4j browser autocomplete feature in cypher expression

I am trying to replicate the "autocomplete" functionality of the neo4j browser interface using just a cypher request. A successful implementation would mean that if the request is made in a browser, then enabling the autocomplete button will have no effect, since all the "additional relationships" are specified in the request.

I am using a browser to prototype the requests and then use RNeo4j to implement them. Ideally, I would like the RNeo4j result to match the browser result, including autocomplete.

As an example, consider a query:

`MATCH p = (n:label1 {name:'tom'})-[r*2..3]-(n:label1 {name:'jerry'})
RETURN p`

      

In a browser with autocomplete disabled, I only get what I asked for (as expected), whereas when autocomplete is turned on, I get all relationships between any nodes in the path where there is no node "tom" or "jerry".

I tried to use WITH

and then the second one MATCH

after the first one MATCH

, but that does not give the required results.

Any help is greatly appreciated!

+3


source to share


1 answer


the autocomplete function makes another call to get the relationship between all node ids it currently has



match a-[r]-b where id(a) in [1,2...] and id(b) in [1,2,3...] return r

      

+6


source







All Articles