Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brian-gates/neo4j-stream-deserializer
Transforms neo4j responses to an easier-to-use format.
https://github.com/brian-gates/neo4j-stream-deserializer
Last synced: 28 days ago
JSON representation
Transforms neo4j responses to an easier-to-use format.
- Host: GitHub
- URL: https://github.com/brian-gates/neo4j-stream-deserializer
- Owner: brian-gates
- Created: 2014-01-29T22:48:16.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-02-13T19:41:40.000Z (almost 11 years ago)
- Last Synced: 2024-11-15T22:22:35.149Z (2 months ago)
- Language: JavaScript
- Size: 164 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# neo4j-stream-deserializer [![Build Status](https://travis-ci.org/brian-gates/neo4j-stream-deserializer.png?branch=master)](https://travis-ci.org/brian-gates/neo4j-stream-deserializer) [![devDependency Status](https://david-dm.org/brian-gates/neo4j-stream-deserializer.png?theme=shields.io)](https://david-dm.org/brian-gates/neo4j-stream-deserializer.png#info=devDependencies)
Project no longer maintained since [cypher-stream](https://github.com/brian-gates/cypher-stream) now depends on [oboe.js](https://github.com/jimhigson/oboe.js) instead.
Streams neo4j responses as formatted objects.
A typical neo4j response:
```
{"columns":["n"],"data":[[{"extensions":{},"paged_traverse":"http://localhost:7474/db/data/node/4307/paged/traverse/{returnType}{?pageSize,leaseTime}","labels":"http://localhost:7474/db/data/node/4307/labels","outgoing_relationships":"http://localhost:7474/db/data/node/4307/relationships/out","traverse":"http://localhost:7474/db/data/node/4307/traverse/{returnType}","all_typed_relationships":"http://localhost:7474/db/data/node/4307/relationships/all/{-list|&|types}","property":"http://localhost:7474/db/data/node/4307/properties/{key}","all_relationships":"http://localhost:7474/db/data/node/4307/relationships/all","self":"http://localhost:7474/db/data/node/4307","properties":"http://localhost:7474/db/data/node/4307/properties","outgoing_typed_relationships":"http://localhost:7474/db/data/node/4307/relationships/out/{-list|&|types}","incoming_relationships":"http://localhost:7474/db/data/node/4307/relationships/in","incoming_typed_relationships":"http://localhost:7474/db/data/node/4307/relationships/in/{-list|&|types}","create_relationship":"http://localhost:7474/db/data/node/4307/relationships","data":{"test":true,"uuid":"27d1b700-88aa-11e3-9992-d7608d571cea"}}],[{"extensions":{},"paged_traverse":"http://localhost:7474/db/data/node/4308/paged/traverse/{returnType}{?pageSize,leaseTime}","labels":"http://localhost:7474/db/data/node/4308/labels","outgoing_relationships":"http://localhost:7474/db/data/node/4308/relationships/out","traverse":"http://localhost:7474/db/data/node/4308/traverse/{returnType}","all_typed_relationships":"http://localhost:7474/db/data/node/4308/relationships/all/{-list|&|types}","property":"http://localhost:7474/db/data/node/4308/properties/{key}","all_relationships":"http://localhost:7474/db/data/node/4308/relationships/all","self":"http://localhost:7474/db/data/node/4308","properties":"http://localhost:7474/db/data/node/4308/properties","outgoing_typed_relationships":"http://localhost:7474/db/data/node/4308/relationships/out/{-list|&|types}","incoming_relationships":"http://localhost:7474/db/data/node/4308/relationships/in","incoming_typed_relationships":"http://localhost:7474/db/data/node/4308/relationships/in/{-list|&|types}","create_relationship":"http://localhost:7474/db/data/node/4308/relationships","data":{"test":true,"uuid":"2ed844b0-88aa-11e3-9992-d7608d571cea"}}],[{"extensions":{},"paged_traverse":"http://localhost:7474/db/data/node/4309/paged/traverse/{returnType}{?pageSize,leaseTime}","labels":"http://localhost:7474/db/data/node/4309/labels","outgoing_relationships":"http://localhost:7474/db/data/node/4309/relationships/out","traverse":"http://localhost:7474/db/data/node/4309/traverse/{returnType}","all_typed_relationships":"http://localhost:7474/db/data/node/4309/relationships/all/{-list|&|types}","property":"http://localhost:7474/db/data/node/4309/properties/{key}","all_relationships":"http://localhost:7474/db/data/node/4309/relationships/all","self":"http://localhost:7474/db/data/node/4309","properties":"http://localhost:7474/db/data/node/4309/properties","outgoing_typed_relationships":"http://localhost:7474/db/data/node/4309/relationships/out/{-list|&|types}","incoming_relationships":"http://localhost:7474/db/data/node/4309/relationships/in","incoming_typed_relationships":"http://localhost:7474/db/data/node/4309/relationships/in/{-list|&|types}","create_relationship":"http://localhost:7474/db/data/node/4309/relationships","data":{"test":true,"uuid":"36204830-88aa-11e3-9992-d7608d571cea"}}],[{"extensions":{},"paged_traverse":"http://localhost:7474/db/data/node/4310/paged/traverse/{returnType}{?pageSize,leaseTime}","labels":"http://localhost:7474/db/data/node/4310/labels","outgoing_relationships":"http://localhost:7474/db/data/node/4310/relationships/out","traverse":"http://localhost:7474/db/data/node/4310/traverse/{returnType}","all_typed_relationships":"http://localhost:7474/db/data/node/4310/relationships/all/{-list|&|types}","property":"http://localhost:7474/db/data/node/4310/properties/{key}","all_relationships":"http://localhost:7474/db/data/node/4310/relationships/all","self":"http://localhost:7474/db/data/node/4310","properties":"http://localhost:7474/db/data/node/4310/properties","outgoing_typed_relationships":"http://localhost:7474/db/data/node/4310/relationships/out/{-list|&|types}","incoming_relationships":"http://localhost:7474/db/data/node/4310/relationships/in","incoming_typed_relationships":"http://localhost:7474/db/data/node/4310/relationships/in/{-list|&|types}","create_relationship":"http://localhost:7474/db/data/node/4310/relationships","data":{"test":true,"uuid":"3c4bdf30-88aa-11e3-9992-d7608d571cea"}}],[{"extensions":{},"paged_traverse":"http://localhost:7474/db/data/node/4311/paged/traverse/{returnType}{?pageSize,leaseTime}","labels":"http://localhost:7474/db/data/node/4311/labels","outgoing_relationships":"http://localhost:7474/db/data/node/4311/relationships/out","traverse":"http://localhost:7474/db/data/node/4311/traverse/{returnType}","all_typed_relationships":"http://localhost:7474/db/data/node/4311/relationships/all/{-list|&|types}","property":"http://localhost:7474/db/data/node/4311/properties/{key}","all_relationships":"http://localhost:7474/db/data/node/4311/relationships/all","self":"http://localhost:7474/db/data/node/4311","properties":"http://localhost:7474/db/data/node/4311/properties","outgoing_typed_relationships":"http://localhost:7474/db/data/node/4311/relationships/out/{-list|&|types}","incoming_relationships":"http://localhost:7474/db/data/node/4311/relationships/in","incoming_typed_relationships":"http://localhost:7474/db/data/node/4311/relationships/in/{-list|&|types}","create_relationship":"http://localhost:7474/db/data/node/4311/relationships","data":{"test":true,"uuid":"43245800-88aa-11e3-9992-d7608d571cea"}}],[{"extensions":{},"paged_traverse":"http://localhost:7474/db/data/node/4312/paged/traverse/{returnType}{?pageSize,leaseTime}","labels":"http://localhost:7474/db/data/node/4312/labels","outgoing_relationships":"http://localhost:7474/db/data/node/4312/relationships/out","traverse":"http://localhost:7474/db/data/node/4312/traverse/{returnType}","all_typed_relationships":"http://localhost:7474/db/data/node/4312/relationships/all/{-list|&|types}","property":"http://localhost:7474/db/data/node/4312/properties/{key}","all_relationships":"http://localhost:7474/db/data/node/4312/relationships/all","self":"http://localhost:7474/db/data/node/4312","properties":"http://localhost:7474/db/data/node/4312/properties","outgoing_typed_relationships":"http://localhost:7474/db/data/node/4312/relationships/out/{-list|&|types}","incoming_relationships":"http://localhost:7474/db/data/node/4312/relationships/in","incoming_typed_relationships":"http://localhost:7474/db/data/node/4312/relationships/in/{-list|&|types}","create_relationship":"http://localhost:7474/db/data/node/4312/relationships","data":{"test":true,"uuid":"4a41c910-88aa-11e3-9992-d7608d571cea"}}],[{"extensions":{},"paged_traverse":"http://localhost:7474/db/data/node/4313/paged/traverse/{returnType}{?pageSize,leaseTime}","labels":"http://localhost:7474/db/data/node/4313/labels","outgoing_relationships":"http://localhost:7474/db/data/node/4313/relationships/out","traverse":"http://localhost:7474/db/data/node/4313/traverse/{returnType}","all_typed_relationships":"http://localhost:7474/db/data/node/4313/relationships/all/{-list|&|types}","property":"http://localhost:7474/db/data/node/4313/properties/{key}","all_relationships":"http://localhost:7474/db/data/node/4313/relationships/all","self":"http://localhost:7474/db/data/node/4313","properties":"http://localhost:7474/db/data/node/4313/properties","outgoing_typed_relationships":"http://localhost:7474/db/data/node/4313/relationships/out/{-list|&|types}","incoming_relationships":"http://localhost:7474/db/data/node/4313/relationships/in","incoming_typed_relationships":"http://localhost:7474/db/data/node/4313/relationships/in/{-list|&|types}","create_relationship":"http://localhost:7474/db/data/node/4313/relationships","data":{"test":true,"uuid":"50743de0-88aa-11e3-9992-d7608d571cea"}}],[{"extensions":{},"paged_traverse":"http://localhost:7474/db/data/node/4314/paged/traverse/{returnType}{?pageSize,leaseTime}","labels":"http://localhost:7474/db/data/node/4314/labels","outgoing_relationships":"http://localhost:7474/db/data/node/4314/relationships/out","traverse":"http://localhost:7474/db/data/node/4314/traverse/{returnType}","all_typed_relationships":"http://localhost:7474/db/data/node/4314/relationships/all/{-list|&|types}","property":"http://localhost:7474/db/data/node/4314/properties/{key}","all_relationships":"http://localhost:7474/db/data/node/4314/relationships/all","self":"http://localhost:7474/db/data/node/4314","properties":"http://localhost:7474/db/data/node/4314/properties","outgoing_typed_relationships":"http://localhost:7474/db/data/node/4314/relationships/out/{-list|&|types}","incoming_relationships":"http://localhost:7474/db/data/node/4314/relationships/in","incoming_typed_relationships":"http://localhost:7474/db/data/node/4314/relationships/in/{-list|&|types}","create_relationship":"http://localhost:7474/db/data/node/4314/relationships","data":{"test":true,"uuid":"56d7fbe0-88aa-11e3-9992-d7608d571cea"}}],[{"extensions":{},"paged_traverse":"http://localhost:7474/db/data/node/4315/paged/traverse/{returnType}{?pageSize,leaseTime}","labels":"http://localhost:7474/db/data/node/4315/labels","outgoing_relationships":"http://localhost:7474/db/data/node/4315/relationships/out","traverse":"http://localhost:7474/db/data/node/4315/traverse/{returnType}","all_typed_relationships":"http://localhost:7474/db/data/node/4315/relationships/all/{-list|&|types}","property":"http://localhost:7474/db/data/node/4315/properties/{key}","all_relationships":"http://localhost:7474/db/data/node/4315/relationships/all","self":"http://localhost:7474/db/data/node/4315","properties":"http://localhost:7474/db/data/node/4315/properties","outgoing_typed_relationships":"http://localhost:7474/db/data/node/4315/relationships/out/{-list|&|types}","incoming_relationships":"http://localhost:7474/db/data/node/4315/relationships/in","incoming_typed_relationships":"http://localhost:7474/db/data/node/4315/relationships/in/{-list|&|types}","create_relationship":"http://localhost:7474/db/data/node/4315/relationships","data":{"test":true,"uuid":"5df3bf40-88aa-11e3-9992-d7608d571cea"}}],[{"extensions":{},"paged_traverse":"http://localhost:7474/db/data/node/4316/paged/traverse/{returnType}{?pageSize,leaseTime}","labels":"http://localhost:7474/db/data/node/4316/labels","outgoing_relationships":"http://localhost:7474/db/data/node/4316/relationships/out","traverse":"http://localhost:7474/db/data/node/4316/traverse/{returnType}","all_typed_relationships":"http://localhost:7474/db/data/node/4316/relationships/all/{-list|&|types}","property":"http://localhost:7474/db/data/node/4316/properties/{key}","all_relationships":"http://localhost:7474/db/data/node/4316/relationships/all","self":"http://localhost:7474/db/data/node/4316","properties":"http://localhost:7474/db/data/node/4316/properties","outgoing_typed_relationships":"http://localhost:7474/db/data/node/4316/relationships/out/{-list|&|types}","incoming_relationships":"http://localhost:7474/db/data/node/4316/relationships/in","incoming_typed_relationships":"http://localhost:7474/db/data/node/4316/relationships/in/{-list|&|types}","create_relationship":"http://localhost:7474/db/data/node/4316/relationships","data":{"test":true,"uuid":"64217920-88aa-11e3-9992-d7608d571cea"}}]]}
```# Parsing a cypher request
``` js
var Neo4jStreamDeserializer = require('neo4j-stream-deserializer');
var request = require('request');request.post({
url : 'http://localhost:7474/db/data/cypher',
form : { query: 'match (n:User) return n' },
headers : { "X-Stream": true, "Accept": "application/json" }
})
.pipe(new Neo4jStreamDeserializer())
.on('data', function (result){
console.log(result.user);
})
.on('end', function() {
console.log('all done');
})
;```
# Reading from a file
``` js
var should = require("should");
var Neo4jStreamDeserializer = require('../index');
var fs = require('fs');describe('Neo4j deserializer', function () {
it('should be able to parse a file', function (done) {
var results = 0;
fs
.createReadStream('./test/mock/neo4j_response.json')
.pipe(new Neo4jStreamDeserializer())
.on('data', function (result){
results++;
result.n.test.should.be.ok;
})
.on('end', function() {
results.should.eql(10);
done();
})
;
});
});```