Coder Social home page Coder Social logo

cl-neo4j's Introduction

cl-neo4j
----------------

Wrapper over neo4j Graph Database API.

cl-neo4j is available under MIT License.

Basic API
--------------

cl-neo4j package has a very thin REST API wrapper that returns alists of neo4j result. So like in neo4j one has to extract the id by oneself. Functions correspond to those available in API, see restapi.lisp for details.

Lispy Wrapper
--------------

cl-neo4j-wrapper has a higher level 'lispy' wrapper.

Tests
----------

Tests should clean up after themselves, but authors hold no warranty over corrupted data - use fresh testing database.

To run tests load cl-neo4j.tests system and run (cl-neo4j.tests:run-all-tests).

debian setup, lisp
------------------

$ sudo apt-get update
 ...
 E: Release file for http://ftp.spline.de/pub/aptosid/debian/dists/sid/InRelease is expired (invalid since 31d 4h 22min 24s). Updates for this repository will not be applied.
$ sudo apt-get -o Acquire::Check-Valid-Until=false update
$ sudo apt-get install cl-quicklisp sbcl-doc sbcl-source slime cl-swank clisp clisp-* gdb
$ sbcl --load /usr/share/cl-quicklisp/quicklisp.lisp
 * (quicklisp-quickstart:install)
$ sbcl --load /usr/share/cl-quicklisp/quicklisp.lisp
 * (quicklisp-quickstart:install)
  ...
   Quicklisp has already been installed. Load #P"/home/mjp/quicklisp/setup.lisp" instead.
  ...
 * (load "/home/mjp/quicklisp/setup.lisp")
 * (ql:add-to-init-file)
 * (ql:quickload "cl-neo4j")
 * (ql:quickload "cl-neo4j.tests")
 * (cl-neo4j.tests:run-all-tests)
  XXXXXXXXXX
   Did 10 checks.
      Pass: 0 ( 0%)
      Skip: 0 ( 0%)
      Fail: 10 (100%)
   Failure Details:
   --------------------------------
   TRAVERSAL-AND-PATHS []: 
        Unexpected Error: #<USOCKET:CONNECTION-REFUSED-ERROR {1006F2C453}>
  Condition USOCKET:CONNECTION-REFUSED-ERROR was signalled...
  ..

# fix babel error after screws up later somehow..
 mjp@uberwald:~/src/cl/cl-neo4j$ sudo mv ~/.cache/common-lisp ~/.cache/common-lisp.O
 mjp@uberwald:~/src/cl/cl-neo4j$ sbcl
  * (ql:quickload "cl-neo4j")
  ...
  [package alexandria.0.dev]........................
  [package babel-encodings].........................
  [package babel]...
  ; file: /home/mjp/quicklisp/dists/quicklisp/software/babel-20130312-git/src/enc-unicode.lisp
  ; in: DEFINE-UTF-16 :UTF-16
  ;     (BABEL-ENCODINGS::DEFINE-UTF-16 :UTF-16)
  ; 
  ; caught ERROR:
  ;   (during macroexpansion of (DEFINE-UTF-16 :UTF-16))
  ;   #:~A-CODE-POINT-COUNTER fell through ETYPECASE expression.
  ;   Wanted one of (STRING SIMPLE-STRING).
  ...
 mjp@uberwald:~/src/cl/cl-neo4j$ sudo apt-get install cl-babel
  ...
  The following NEW packages will be installed:
    cl-babel cl-trivial-features
  0 upgraded, 2 newly installed, 0 to remove and 967 not upgraded.
  ...
 mjp@uberwald:~/src/cl/cl-neo4j$ sbcl
 * (ql:quickload "cl-neo4j")
  To load "cl-neo4j":
    Load 1 ASDF system:
      cl-neo4j
  ; Loading "cl-neo4j"
  ..................................................
  [package babel-encodings].........................
  [package babel]...................................
  [package trivial-garbage].........................
  [package bordeaux-threads]........................
  [package trivial-gray-streams]....................
  [package flexi-streams]...........................
  ..................................................
  ..................................................
  [package cffi-sys]................................
  [package cffi]....................................
  ..................................................
  [package cffi-features]...........................
  [package cl+ssl]..................................
  [package usocket].................................
  [package chunga]..................................
  [package cl-base64]...............................
  [package puri]....................................
  [package drakma]..................................
  [package split-sequence]..........................
  [package anaphora]................................
  [package anaphora-basic]..........................
  [package anaphora-symbol].........................
  [package cl-neo4j]................................
  [package cl-neo4j-wrapper]..........
  ("cl-neo4j")


debian setup, neo4j
-------------------

# follow: http://debian.neo4j.org/
 sudo bash
 wget -O - http://debian.neo4j.org/neotechnology.gpg.key| apt-key add - # Import our signing key
 echo 'deb http://debian.neo4j.org/repo stable/' > /etc/apt/sources.list.d/neo4j.list # Create an Apt sources.list file
 apt-get update
  ...
  E: Release file for http://ftp.spline.de/pub/aptosid/debian/dists/sid/InRelease is expired (invalid since 32d 6h 47min 43s). Updates for this repository will not be applied.
 apt-get -o Acquire::Check-Valid-Until=false update
 apt-get install neo4j

# service root, follow: http://docs.neo4j.org/chunked/stable/rest-api.html
 wget -qO - http://localhost:7474/db/data/
  {
    "extensions" : {
      "CypherPlugin" : {
        "execute_query" : "http://localhost:7474/db/data/ext/CypherPlugin/graphdb/execute_query"
      },
      "GremlinPlugin" : {
        "execute_script" : "http://localhost:7474/db/data/ext/GremlinPlugin/graphdb/execute_script"
      }
    },
    "node" : "http://localhost:7474/db/data/node",
    "reference_node" : "http://localhost:7474/db/data/node/0",
    "node_index" : "http://localhost:7474/db/data/index/node",
    "relationship_index" : "http://localhost:7474/db/data/index/relationship",
    "extensions_info" : "http://localhost:7474/db/data/ext",
    "relationship_types" : "http://localhost:7474/db/data/relationship/types",
    "batch" : "http://localhost:7474/db/data/batch",
    "cypher" : "http://localhost:7474/db/data/cypher",
    "neo4j_version" : "1.8.2"
  }

# add/get/delete/get node, follow: http://docs.neo4j.org/chunked/stable/rest-api-nodes.html
 #create node
   sudo tail -f /var/log/neo4j/console.log /var/log/neo4j/neo4j.0.0.log &
   mjp@uberwald:~/src/cl/cl-neo4j$ wget -qO - --post-data="foo=bar" http://localhost:7474/db/data/node
    {
      "extensions" : {
      },
      "paged_traverse" : "http://localhost:7474/db/data/node/1/paged/traverse/{returnType}{?pageSize,leaseTime}",
      "outgoing_relationships" : "http://localhost:7474/db/data/node/1/relationships/out",
      "traverse" : "http://localhost:7474/db/data/node/1/traverse/{returnType}",
      "all_typed_relationships" : "http://localhost:7474/db/data/node/1/relationships/all/{-list|&|types}",
      "property" : "http://localhost:7474/db/data/node/1/properties/{key}",
      "all_relationships" : "http://localhost:7474/db/data/node/1/relationships/all",
      "self" : "http://localhost:7474/db/data/node/1",
      "properties" : "http://localhost:7474/db/data/node/1/properties",
      "outgoing_typed_relationships" : "http://localhost:7474/db/data/node/1/relationships/out/{-list|&|types}",
      "incoming_relationships" : "http://localhost:7474/db/data/node/1/relationships/in",
      "incoming_typed_relationships" : "http://localhost:7474/db/data/node/1/relationships/in/{-list|&|types}",
      "create_relationship" : "http://localhost:7474/db/data/node/1/relationships",
      "data" : {
        "foo" : "bar"
      }
    }
 #get node
   mjp@uberwald:~/src/cl/cl-neo4j$ wget -qO - http://localhost:7474/db/data/node/1
    {
      "extensions" : {
      },
      "paged_traverse" : "http://localhost:7474/db/data/node/1/paged/traverse/{returnType}{?pageSize,leaseTime}",
      "outgoing_relationships" : "http://localhost:7474/db/data/node/1/relationships/out",
      "traverse" : "http://localhost:7474/db/data/node/1/traverse/{returnType}",
      "all_typed_relationships" : "http://localhost:7474/db/data/node/1/relationships/all/{-list|&|types}",
      "property" : "http://localhost:7474/db/data/node/1/properties/{key}",
      "all_relationships" : "http://localhost:7474/db/data/node/1/relationships/all",
      "self" : "http://localhost:7474/db/data/node/1",
      "properties" : "http://localhost:7474/db/data/node/1/properties",
      "outgoing_typed_relationships" : "http://localhost:7474/db/data/node/1/relationships/out/{-list|&|types}",
      "incoming_relationships" : "http://localhost:7474/db/data/node/1/relationships/in",
      "incoming_typed_relationships" : "http://localhost:7474/db/data/node/1/relationships/in/{-list|&|types}",
      "create_relationship" : "http://localhost:7474/db/data/node/1/relationships",
      "data" : {
        "foo" : "bar"
      }
    }
 #delete node
   mjp@uberwald:~/src/cl/cl-neo4j$ curl -i -H "Accept: application/json" -X DELETE http://localhost:7474/db/data/node/1
    HTTP/1.1 204 No Content
    Access-Control-Allow-Origin: *
    Server: Jetty(6.1.25)
 #get node
   mjp@uberwald:~/src/cl/cl-neo4j$ wget -qO - http://localhost:7474/db/data/node/1

# now tests pass
 mjp@uberwald:~/src/cl/cl-neo4j$ ps -ef |grep neo4j
  neo4j     2566     1  0 Apr20 ?        00:02:25 /usr/bin/java -cp /var/lib/neo4j/l
 mjp@uberwald:~/src/cl/cl-neo4j$ sbcl
 * (ql:quickload "cl-neo4j")
 * (ql:quickload "cl-neo4j.tests")
  ...
  ; Loading "cl-neo4j.tests"
  To load "fiveam":
    Load 1 ASDF system:
      alexandria
    Install 1 Quicklisp release:
      fiveam
  ...
 * (cl-neo4j.tests:run-all-tests)
  ...........................................
   Did 43 checks.
      Pass: 43 (100%)
      Skip: 0 ( 0%)
      Fail: 0 ( 0%)
  NIL


heroku neo4j
------------

cl-neo4j's People

Contributors

freiksenet avatar phelanm avatar kraison avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.