ob-cypher icon indicating copy to clipboard operation
ob-cypher copied to clipboard

query neo4j using cypher in org-mode blocks

  • ob-cypher

[[http://melpa.org/#/ob-cypher][file:http://melpa.org/packages/ob-cypher-badge.svg]]

query neo4j using cypher in org-mode blocks

** install

#+begin_src emacs-lisp (use-package ob-cypher :ensure t :config (add-to-list 'org-babel-load-languages '(cypher . t)) (org-babel-do-load-languages 'org-babel-load-languages org-babel-load-languages) (add-to-list 'org-babel-tangle-lang-exts '("cypher" . "cypher"))) #+end_src

** options

| option | example | |--------------+----------------------------------------------| | =:host= | =127.0.0.1= | | =:port= | =1337= | | =:http-port= | =7474= | | =:username= | ="neo4j"= | | =:password= | ="neo4j"= | | =:file= | requires curl and graphviz =:file graph.png= |

** examples

: #+BEGIN_SRC cypher : CREATE (matrix1:Movie { title : 'The Matrix', year : '1999-03-31' }) : CREATE (matrix2:Movie { title : 'The Matrix Reloaded', year : '2003-05-07' }) : CREATE (matrix3:Movie { title : 'The Matrix Revolutions', year : '2003-10-27' }) : CREATE (keanu:Actor { name:'Keanu Reeves' }) : CREATE (laurence:Actor { name:'Laurence Fishburne' }) : CREATE (carrieanne:Actor { name:'Carrie-Anne Moss' }) : CREATE (keanu)-[:ACTS_IN { role : 'Neo' }]->(matrix1) : CREATE (keanu)-[:ACTS_IN { role : 'Neo' }]->(matrix2) : CREATE (keanu)-[:ACTS_IN { role : 'Neo' }]->(matrix3) : CREATE (laurence)-[:ACTS_IN { role : 'Morpheus' }]->(matrix1) : CREATE (laurence)-[:ACTS_IN { role : 'Morpheus' }]->(matrix2) : CREATE (laurence)-[:ACTS_IN { role : 'Morpheus' }]->(matrix3) : CREATE (carrieanne)-[:ACTS_IN { role : 'Trinity' }]->(matrix1) : CREATE (carrieanne)-[:ACTS_IN { role : 'Trinity' }]->(matrix2) : CREATE (carrieanne)-[:ACTS_IN { role : 'Trinity' }]->(matrix3) : #+END_SRC

: #+RESULTS: : : +-------------------+ : : | No data returned. | : : +-------------------+ : : Nodes created: 6 : : Relationships created: 9 : : Properties set: 18 : : Labels added: 6 : : 1353 ms

: #+BEGIN_SRC cypher :file movie.png : match (actor)-[r:ACTS_IN]->(movie) : return * : #+END_SRC

: #+RESULTS:

[[http://i.imgur.com/dpCyOo5.png]]