Getting End Node from Relationship Record

4 views
Skip to first unread message

James Hughes

unread,
Oct 30, 2015, 7:22:02 AM10/30/15
to clojure-neo4j
Hello,

I am currently unsure how to correctly retrieve a node from a relationship via neocons.

For example the following code returns a relationship record.

(nrl/get connection relationship-id)

//
#clojurewerkz.neocons.rest.records.Relationship{:id 17, :location-uri "http://localhost:7474/db/data/relationship/17", :start "http://localhost:7474/db/data/node/45", :end "http://localhost:7474/db/data/node/47", :type "decision", :data {:content "Do another"}}


From this record I would like to get the end node however I'm not sure of the correct way of doing this.  For example I could get the :end property and grab the id from the string but this feels a bit weird to me.  

Going back a bit what I really need to do is get the end node of a relationship when I have been given that relationship ID so I guess I could use cypher for it to get what I want but again I'm not sure if this the best way doing things.

Any tips would be appreciated.

James.

Rohit Aggarwal

unread,
Oct 30, 2015, 8:40:49 AM10/30/15
to clojure-neo4j
Hi James,
I would recommend using cypher for something like this as that is the cleanest solution.

Alternatively, you could try using the `extract-id` function in `clojurewerkz.neocons.rest.helpers` by passing it the `:end` property. But this is very much doing something similar to grabbing the id from the URL.

Hope this helps
Rohit
Reply all
Reply to author
Forward
0 new messages