neo4j - Using Cypher within the Clojure Neocons library. Where's the synergy? -


being new both clojure , neo4j i'm sure i'm missing point of neocons library, can't find sensible way of mixing library's "native" functions node/update results returned cypher/tquery.

creating node in neo4j via node/create returns:

clojurewerkz.neocons.rest.records.node{:id 999, :location-uri        http://localhost:7474/db/data/node/999, :data {:url http://clojureneo4j.info :color "blue"}, :relationships-uri nil, :create-relationship-uri http://localhost:7474/db/data/node/999/relationships} 

node/find "finds nodes using index". in case didn't set 1 , it's possible don't know node's id in future. resort cypher find node other property (in case id sake of argument):

(clojurewerkz.neocons.rest.cypher/tquery conn "match (n) id(n) = 999 return n") 

which returns

({"n" {:properties "http://localhost:7474/db/data/node/999/properties", :create_relationship "http://localhost:7474/db/data/node/999/relationships", :labels "http://localhost:7474/db/data/node/999/labels", :incoming_relationships "http://localhost:7474/db/data/node/999/relationships/in", :outgoing_relationships "http://localhost:7474/db/data/node/999/relationships/out", :property "http://localhost:7474/db/data/node/999/properties/{key}", :paged_traverse "http://localhost:7474/db/data/node/999/paged/traverse/{returntype}{?pagesize,leasetime}", :incoming_typed_relationships "http://localhost:7474/db/data/node/999/relationships/in/{-list|&|types}", :traverse "http://localhost:7474/db/data/node/999/traverse/{returntype}", :all_relationships "http://localhost:7474/db/data/node/999/relationships/all", :extensions {}, :outgoing_typed_relationships "http://localhost:7474/db/data/node/999/relationships/out/{-list|&|types}", :metadata {:id 999, :labels []}, :all_typed_relationships "http://localhost:7474/db/data/node/999/relationships/all/{-list|&|types}", :self "http://localhost:7474/db/data/node/999", :data {:domain "clojureneo4j.info" :color "blue"}}}) 

now, if want update "color" attribute of found node have destructure result id :metadata, , have resupply of old attributes :metadata in order them retained along new associated color value. like:

(node/update conn (:id (:metadata node)) (assoc (:data node) :color "green")) 

(that might not correct i'm not sitting @ repl. gets point across.)

am missing obvious? how supposed retrieve , update nodes when mixing in cypher queries, or when don't have index or node's id filed away? shouldn't able associate new value cypher query result , hand node/update?

thanks!


Comments

Popular posts from this blog

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -