Re: [Neo4j] REST API How to get custom properties instead neo4j ids.

101 views
Skip to first unread message

Michael Hunger

unread,
Aug 18, 2012, 3:02:00 AM8/18/12
to ne...@googlegroups.com
you can retrieve the individual properties using cypher

POST http://localhost/db/data/cypher
{"query", "start n=node({ids}) return n.prop", "params": {"ids", [1,2,3,4]}}

and

POST http://localhost/db/data/cypher
{"query", "start r=rel({ids}) return r.prop", "params": {"ids", [1,2,3,4]}}

HTH

Michael

Am 17.08.2012 um 23:16 schrieb harleyrjacome:

> Hi I'm new using neo, and possibly this question is very silly.
>
> I'm using REST API (.Net Client) and I am trying to make a route search by using Dijkstra algorithm, the search works well, but it returns the nodes and relationship ids that Neo4J uses internally. However I need you to return a specific property on both: nodes and relationships, and I don't know how to do this.
>
> Find the properties by using the given node or relationship is not an option because the real search returns about 500 to 10000 results.
>
> Here is the request and response:
>
> REQUEST:
> http://localhost:7474/db/data/node/130659/path --> ( 130659 SHOULD BE A PROPERTY VALUE INSTEAD A NEO4J ID)
> application/json
> {
> "to" : "http://localhost:7474/db/data/node/130721 ", --> (130721 SHOULD BE A PROPERTY VALUE INSTEAD A NEO4J ID)
> "cost_property" : "lon",
> "relationships" : {
> "type" : "Vial",
> "direction" : "out"
> },
> "algorithm" : "dijkstra"
> }
>
> RESPONSE:
> {
> "weight" : 257.3847491837731,
>
> "start" : "http://localhost:7474/db/data/node/130659",
>
> "nodes" :
> [
> "http://localhost:7474/db/data/node/130659", --> ( 130659, 130705,...130721 SHOULD BE NODES PROPERTY VALUES INSTEAD A NEO4J IDS)
> "http://localhost:7474/db/data/node/130705",
> "http://localhost:7474/db/data/node/130722",
> "http://localhost:7474/db/data/node/130721"
> ],
> "length" : 3,
>
> "relationships" :
> [
> "http://localhost:7474/db/data/relationship/151", --> (151, 10909, 4009 SHOULD BE RELATIONSHIP PROPERTY VALUES INSTEAD A NEO4J IDS)
> "http://localhost:7474/db/data/relationship/10909",
> "http://localhost:7474/db/data/relationship/4009"
> ],
>
> "end" : "http://localhost:7474/db/data/node/130721"
> }
>
>
> Any help would be appreciated.
> Thank you.
>
>
> --
>
>

harleyrjacome

unread,
Aug 20, 2012, 6:31:24 PM8/20/12
to ne...@googlegroups.com
Thanks Michael, cypher worked perfectly. !!
Reply all
Reply to author
Forward
0 new messages