-
Notifications
You must be signed in to change notification settings - Fork 1
Home
gitcloneashish edited this page Jan 31, 2014
·
2 revisions
Neo4j adapter is a simple javascript library which provides easy and intuitive API to interact with Neo4j graph db. It is available in client side javascript and nodejs flavors.
To use it on client side:
- Simply include the javascript library, neo4jadapter.js, in your html page.
<script src="neo4jadapter.js" type="text/javascript"></script>
To use it in your node project:
- Copy the neo4j folder in node_modules folder, and include neo4j
var neo4j = require('neo4j').neo4j
var gurl = 'http://localhost:7474';
neo4j.node(1).adapter().load(gurl).done(function(node){
// access node here
});
var gurl = 'http://localhost:7474';
neo4j.node(1, {del: true}).adapter().load(gurl).done(function(node){
});
var gurl = 'http://localhost:7474';
neo4j.node(1).rels().adapter().load(gurl).done(function(ret){
// access all node relationships
});
var gurl = 'http://localhost:7474';
neo4j.node(1).rels(100).adapter().load(gurl).done(function(ret){
// access all node relationship with id 100
});
var gurl = 'http://localhost:7474';
neo4j.node(1).rels("KNOWS").adapter().load(gurl).done(function(ret){
// access node relationships of type "KNOWS"
});
var gurl = 'http://localhost:7474';
neo4j.node(1).rels("KNOWS", { dir: "in" }).adapter().load(gurl).done(function(ret){
// access node relationships of type "KNOWS" as incoming relationship
});
var gurl = 'http://localhost:7474';
neo4j.node(1).rels("KNOWS", { dir: "out" }).adapter().load(gurl).done(function(ret){
// access node relationships of type "KNOWS" as outgoing relationship
});
var gurl = 'http://localhost:7474';
neo4j.node(1).rels("KNOWS", { dir: 'all', del: true }).adapter().load(gurl).done(function(ret){
});
var gurl = 'http://localhost:7474';
neo4j.rels("KNOWS", { dir: 'all' }).adapter().load(gurl).done(function(ret){
});
var gurl = 'http://localhost:7474';
neo4j.node(1).props().adapter().load(gurl).done(function(ret){
// access all node properties
});
neo4j.node(1).props("foo").adapter().load(gurl).done(function(ret){
// access node property with name 'foo'
});