All Projects → veliovgroup → Ostrio Neo4jdriver

veliovgroup / Ostrio Neo4jdriver

Licence: bsd-3-clause
Most advanced and efficient Neo4j REST API Driver, with support of https and GrapheneDB

Programming Languages

coffeescript
4710 projects

Projects that are alternatives of or similar to Ostrio Neo4jdriver

Meteor-logger
🧾 Meteor isomorphic logger. Store application logs in File (FS), MongoDB, or print in Console
Stars: ✭ 51 (-7.27%)
Mutual labels:  meteor, meteor-package, driver
meteor-presence
👥 Meteor package to help track users' presence
Stars: ✭ 88 (+60%)
Mutual labels:  meteor, meteor-package
Meteor Files
🚀 Upload files via DDP or HTTP to ☄️ Meteor server FS, AWS, GridFS, DropBox or Google Drive. Fast, secure and robust.
Stars: ✭ 1,033 (+1778.18%)
Mutual labels:  meteor, meteor-package
spiderable-middleware
🤖 Prerendering for JavaScript powered websites. Great solution for PWAs (Progressive Web Apps), SPAs (Single Page Applications), and other websites based on top of front-end JavaScript frameworks
Stars: ✭ 29 (-47.27%)
Mutual labels:  meteor, meteor-package
Autocms
AutoCms is a simple solution for your Meteor.js app
Stars: ✭ 34 (-38.18%)
Mutual labels:  meteor, meteor-package
meteor-flow-router-map
Meteor package for Flow Router
Stars: ✭ 15 (-72.73%)
Mutual labels:  meteor, meteor-package
awesome-blaze
🔥A curated list of awesome things related to Blaze
Stars: ✭ 29 (-47.27%)
Mutual labels:  meteor, meteor-package
meteor-packages
Client for Meteor Package Server API
Stars: ✭ 14 (-74.55%)
Mutual labels:  meteor, meteor-package
Meteor Easy Search
Easy-to-use search for Meteor with Blaze Components
Stars: ✭ 438 (+696.36%)
Mutual labels:  meteor, meteor-package
Blaze
🔥 Meteor Blaze is a powerful library for creating live-updating user interfaces
Stars: ✭ 474 (+761.82%)
Mutual labels:  meteor, meteor-package
Meteor Collection Helpers
⚙️ Meteor package that allows you to define helpers on your collections
Stars: ✭ 504 (+816.36%)
Mutual labels:  meteor, meteor-package
Mongol Meteor Explore Minimongo Devtools
In-App MongoDB Editor for Meteor (Meteor DevTools)
Stars: ✭ 846 (+1438.18%)
Mutual labels:  meteor, meteor-package
meteor-server-autorun
Server-side Tracker.autorun
Stars: ✭ 36 (-34.55%)
Mutual labels:  meteor, meteor-package
svelte-meteor-data
Reactively track Meteor data inside Svelte components
Stars: ✭ 14 (-74.55%)
Mutual labels:  meteor, meteor-package
meteor-control-mergebox
Control mergebox of publish endpoints
Stars: ✭ 28 (-49.09%)
Mutual labels:  meteor, meteor-package
meteor-spacebars-tohtml
Meteor package to ease rendering spacebars to html
Stars: ✭ 35 (-36.36%)
Mutual labels:  meteor, meteor-package
Meteor-flow-router-title
Change document.title on the fly within flow-router
Stars: ✭ 23 (-58.18%)
Mutual labels:  meteor, meteor-package
flow-router
🚦 Carefully extended flow-router for Meteor
Stars: ✭ 191 (+247.27%)
Mutual labels:  meteor, meteor-package
Meteor Blaze Components
Reusable components for Blaze
Stars: ✭ 361 (+556.36%)
Mutual labels:  meteor, meteor-package
Vue Meteor
🌠 Vue first-class integration in Meteor
Stars: ✭ 893 (+1523.64%)
Mutual labels:  meteor, meteor-package

Join the chat at https://gitter.im/VeliovGroup/ostrio-neo4jdriver

Most advanced, well documented and efficient REST client for Neo4j database, with 100% tests coverage. Fibers and Meteor.js allows to give a new level experience to developers, no more callback-hell and blocking operations. Speed and low resources consumption is top priority of neo4j-fiber package.

Neo4j Driver

About

Install to meteor

meteor add ostrio:neo4jdriver

Import

import { Neo4jDB } from 'meteor/ostrio:neo4jdriver';
// Full list of available classes (for reference):
// import {Neo4jCursor, Neo4jRelationship, Neo4jNode, Neo4jData, Neo4jEndpoint, Neo4jTransaction, Neo4jDB} from 'meteor/ostrio:neo4jdriver';

Demo Apps

API

Please see full API with examples in neo4j-fiber wiki

Basic Usage

import { Neo4jDB } from 'meteor/ostrio:neo4jdriver';

const db = new Neo4jDB('http://localhost:7474', {
  username: 'neo4j',
  password: '1234'
});

// Create some data:
const cities = {};
cities['Zürich'] = db.nodes({
  title: 'Zürich',
  lat: 47.27,
  long: 8.31
}).label(['City']);

cities['Tokyo'] = db.nodes({
  title: 'Tokyo',
  lat: 35.40,
  long: 139.45
}).label(['City']);

cities['Athens'] = db.nodes({
  title: 'Athens',
  lat: 37.58,
  long: 23.43
}).label(['City']);

cities['Cape Town'] = db.nodes({
  title: 'Cape Town',
  lat: 33.55,
  long: 18.22
}).label(['City']);


// Add relationship between cities
// At this example we set distance
cities['Zürich'].to(cities['Tokyo'], "DISTANCE", {m: 9576670, km: 9576.67, mi: 5950.67});
cities['Tokyo'].to(cities['Zürich'], "DISTANCE", {m: 9576670, km: 9576.67, mi: 5950.67});

// Create route 1 (Zürich -> Athens -> Cape Town -> Tokyo)
cities['Zürich'].to(cities['Athens'], "ROUTE", {m: 1617270, km: 1617.27, mi: 1004.93, price: 50});
cities['Athens'].to(cities['Cape Town'], "ROUTE", {m: 8015080, km: 8015.08, mi: 4980.34, price: 500});
cities['Cape Town'].to(cities['Tokyo'], "ROUTE", {m: 9505550, km: 9505.55, mi: 5906.48, price: 850});

// Create route 2 (Zürich -> Cape Town -> Tokyo)
cities['Zürich'].to(cities['Cape Town'], "ROUTE", {m: 1617270, km: 1617.27, mi: 1004.93, price: 550});
cities['Cape Town'].to(cities['Tokyo'], "ROUTE", {m: 9576670, km: 9576.67, mi: 5950.67, price: 850});

// Create route 3 (Zürich -> Athens -> Tokyo)
cities['Zürich'].to(cities['Athens'], "ROUTE", {m: 1617270, km: 1617.27, mi: 1004.93, price: 50});
cities['Athens'].to(cities['Tokyo'], "ROUTE", {m: 9576670, km: 9576.67, mi: 5950.67, price: 850});

// Get Shortest Route (in km) between two Cities:
const shortest  = cities['Zürich'].path(cities['Tokyo'], "ROUTE", {cost_property: 'km', algorithm: 'dijkstra'})[0];
let shortestStr = 'Shortest from Zürich to Tokyo, via: ';
shortest.nodes.forEach((id) => {
  shortestStr += db.nodes(id).property('title') + ', ';
});

shortestStr += '| Distance: ' + shortest.weight + ' km';
console.info(shortestStr); // <-- Shortest from Zürich to Tokyo, via: Zürich, Cape Town, Tokyo, | Distance: 11122.82 km

// Get Cheapest Route (in notional currency) between two Cities:
const cheapest  = cities['Zürich'].path(cities['Tokyo'], "ROUTE", {cost_property: 'price', algorithm: 'dijkstra'})[0];
let cheapestStr = 'Cheapest from Zürich to Tokyo, via: ';
cheapest.nodes.forEach((id) => {
  cheapestStr += db.nodes(id).property('title') + ', ';
});

cheapestStr += '| Price: ' + cheapest.weight + ' nc';
console.info(cheapestStr); // <-- Cheapest from Zürich to Tokyo, via: Zürich, Athens, Tokyo, | Price: 900 nc


// Create data via cypher query (as alternative to examples above)
const cursor = db.query('CREATE (n:City {props}) RETURN n', {
  props {
    title: 'Ottawa',
    lat: 45.24,
    long: 75.43
  }
});

console.log(cursor.fetch());
// Returns array of nodes:
// [{
//   n: {
//     long: 75.43,
//     lat: 45.24,
//     title: "Ottawa",
//     id: 8421,
//     labels": ["City"],
//     metadata: {
//       id: 8421,
//       labels": ["City"]
//     }
//   }
// }]

// Iterate through results as plain objects:
cursor.forEach((node) => {
  console.log(node)
  // Returns node as Object:
  // {
  //   n: {
  //     long: -75.683333,
  //     lat: 45.416667,
  //     title: "Ottawa",
  //     id: 8421,
  //     labels": ["City"],
  //     metadata: {
  //       id: 8421,
  //       labels": ["City"]
  //     }
  //   }
  // }
});

// Iterate through cursor as `Neo4jNode` instances:
cursor.each((node) => {
  console.log(node.n.get());
  // {
  //   long: -75.683333,
  //   lat: 45.416667,
  //   title: "Ottawa",
  //   id: 8421,
  //   labels": ["City"],
  //   metadata: {
  //     id: 8421,
  //     labels": ["City"]
  //   }
  // }
});

Testing & Dev usage

Local usage

To use the ostrio-neo4jdriver in a project and benefit from updates to the driver as they are released, you can keep your project and the driver in separate directories, and create a symlink between them.

# Stop meteor if it is running
$ cd /directory/of/your/project
# If you don't have a Meteor project yet, create a new one:
$ meteor create MyProject
$ cd MyProject
# Create `packages` directory inside project's dir
$ mkdir packages
$ cd packages
# Clone this repository to a local `packages` directory
$ git clone --bare https://github.com/VeliovGroup/ostrio-neo4jdriver.git
# If you need dev branch, switch into it
$ git checkout dev
# Go back into project's directory
$ cd ../
$ meteor add ostrio:neo4jdriver
# Do not forget to run Neo4j database, before start work with package

From now any changes in ostrio:neo4jdriver package folder will cause your project application to rebuild.

To run tests:

Before running tests - make sure it's blank Neo4j database with no records!

# Go to local package folder
$ cd packages/ostrio-neo4jdriver
# Edit line 10 of `tests.coffee` to set connection to your Neo4j database
# Default is: 'http://localhost:7474', {username: 'neo4j', password: '1234'}
# Do not forget to run Neo4j database
# Make sure database has no records
$ meteor test-packages ./
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].