Re: neocons get record from cypher query

2015-09-20 Thread bmcferren
Could you please elaborate on how you came to a solution here and the syntax
involved in accessing that property?

After calling neo4j with neocons (cy/tquery conn node-query {:_nodeid
_nodeid}), how do you perform accessing functions to get property values
from the keys that are returned from the neo4j datastore response?

For example if this object was the response from the neo4j datastore, what
neocons syntax do I use to access the value stored in key "attributes"?

[ {
  "id": "letter-a",
  "name": "Letter A",
  "attributes": [ ... ]
}]

Currently I can only get so far as (first _response) but (get-in (first
_response) [:attributes]) is giving me back nil.

Also tried (println (get-in (first (neorec/instantiate-record-from
_response) ) [:id]) ) and came back with nil

I would be grateful for your help



--
View this message in context: 
http://clojure.2344290.n4.nabble.com/neocons-get-record-from-cypher-query-tp1930p5412.html
Sent from the Users mailing list archive at Nabble.com.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


neocons get record from cypher query

2015-05-17 Thread Sam Raker
I'm using neocons to put some data into a Neo4j database. I need to create 
relationships between nodes I've just created and nodes in the DB. I can't 
retrieve the nodes based on id without caching them locally, and they're 
not unique enough to retrieve using e.g. rest.nodes/find, so I need to use 
Cypher to get at them. I'm wondering if there's a better way to do this 
than what I currently am working with, namely 

(nn/get conn (-  (cy/tquery conn START person=node({sid}) MATCH 
person-[:foo]-o RETURN o {:sid 1}) first (get-in [o :metadata :id]

(this is just a toy example, so if the Cypher query is too simple, forgive 
me).

This seems...too complicated? Am I missing something? Is there a more 
idiomatic way to convert cypher results into neocons records?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: neocons get record from cypher query

2015-05-17 Thread Sam Raker
Figured it out: `neocons.rest.records/instantiate-record-from` does the 
trick.

On Sunday, May 17, 2015 at 7:09:35 PM UTC-4, Sam Raker wrote:

 I'm using neocons to put some data into a Neo4j database. I need to create 
 relationships between nodes I've just created and nodes in the DB. I can't 
 retrieve the nodes based on id without caching them locally, and they're 
 not unique enough to retrieve using e.g. rest.nodes/find, so I need to use 
 Cypher to get at them. I'm wondering if there's a better way to do this 
 than what I currently am working with, namely 

 (nn/get conn (-  (cy/tquery conn START person=node({sid}) MATCH 
 person-[:foo]-o RETURN o {:sid 1}) first (get-in [o :metadata :id]

 (this is just a toy example, so if the Cypher query is too simple, forgive 
 me).

 This seems...too complicated? Am I missing something? Is there a more 
 idiomatic way to convert cypher results into neocons records?


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.