Need private packages and team management tools?Check out npm Teams »

neo4j-loader

0.5.0 • Public • Published

Neo4j Data Loader

A simple Node module to quickly load smalller datasets into Neo4j for analysis in the their browser application.

Dependencies:

  • Async.js
  • Request.js

Installation

npm install neo4j-loader

API

There are only three methods to the API (fromFile, setURL, addToQueue), so it is very easy to use. Basically, you can use it to load data from a JSON file or in the context of a larger script - sending each realtionship to the queue manually.

Loading from a JSON file

var fs = require('fs');
var loader = require("neo4j-loader");
 
var inputFile = 'data/relationships.json';
var dataURL = 'http://localhost:7474/db/data/';
 
loader.fromFile(inputFile, dataURL);

Add Each to Queue Manually

var fs = require('fs');
var loader = require("neo4j-loader");
 
var inputFile = 'data/relationships.json';
var dataURL = 'http://localhost:7474/db/data/';
 
// Make sure you set the URL first.
loader.setURL(dataURL); 
 
fs.readFile(inputFile, 'utf-8', function (err, data) {
  if (err) throw err;
  var relations = JSON.parse(data);
  relations.forEach(function (relation) {
      loader.addToQueue(relation);
  });
});

Keywords

none

Install

npm i neo4j-loader

DownloadsWeekly Downloads

3

Version

0.5.0

License

none

Last publish

Collaborators

  • avatar