Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Neo4j adapter for fortune #119

Open
craigedmunds opened this issue Mar 6, 2015 · 5 comments
Open

Neo4j adapter for fortune #119

craigedmunds opened this issue Mar 6, 2015 · 5 comments

Comments

@craigedmunds
Copy link

Neo4j as a data store can open up a number of options for us in terms of analysing our data. This could be as a primary data store, or as a secondary store synced from a different adapter, e.g MongoDB.

As a first pass we should prototype an adapter to insert into and read from a neo4j instance.

Should we use an npm es package? Which one? Or the raw HTTP interface?
Is there a bulk insert API?
How should we do updates?

@avrono
Copy link

avrono commented Mar 6, 2015

I think the most powerful way of interacting with Neo4J is using the Cypher query language http://neo4j.com/docs/2.0/cypher-refcard/?mkt_tok=3RkMMJWWfF9wsRogu6%2FAZKXonjHpfsX94%2B0uWKG%2FlMI%2F0ER3fOvrPUfGjI4ESMZlI%2BSLDwEYGJlv6SgFTbfGMadv1LgNXRQ%3D

There are a number of Node.js modules available http://neo4j.com/developer/javascript/ .

The most usable, I have found to be is https://github.com/philippkueng/node-neo4j

An update is slightly complex in Neo4J and basically can be achieved the same way as an insert. The MERGE keyword (explained here http://graphaware.com/neo4j/2014/07/31/cypher-merge-explained.html) is the function I have used in the past, basically it checks to see if the node exists, if not it inserts or updates it. Without using the MERGE it can be tricky to ensure that nodes and their relationships are unique (which is not always a requirement in graph databases) .

Neo4J does provide a Rest API

Ex: GET /db/data/node/0

MIght return something like:

{
"extensions": {},
"labels": "http://localhost:7474/db/data/node/0/labels",
"outgoing_relationships": "http://localhost:7474/db/data/node/0/relationships/out",
"all_typed_relationships": "http://localhost:7474/db/data/node/0/relationships/all/{-list|&|types}",
"traverse": "http://localhost:7474/db/data/node/0/traverse/{returnType}",
"self": "http://localhost:7474/db/data/node/0",
"property": "http://localhost:7474/db/data/node/0/properties/{key}",
"outgoing_typed_relationships": "http://localhost:7474/db/data/node/0/relationships/out/{-list|&|types}",
"properties": "http://localhost:7474/db/data/node/0/properties",
"incoming_relationships": "http://localhost:7474/db/data/node/0/relationships/in",
"create_relationship": "http://localhost:7474/db/data/node/0/relationships",
"paged_traverse": "http://localhost:7474/db/data/node/0/paged/traverse/{returnType}{?pageSize,leaseTime}",
"all_relationships": "http://localhost:7474/db/data/node/0/relationships/all",
"incoming_typed_relationships": "http://localhost:7474/db/data/node/0/relationships/in/{-list|&|types}",
"metadata": {
"id": 0,
"labels": [
"Project"
]
},
"data": {
"project_name": "pml ",
"account_name": "test"
}
}

@avrono
Copy link

avrono commented Mar 9, 2015

I have started the technical specification , feel free to comment

NOTE: This is not a generic adaptor, as a first pass we will create an initial class to handle a particular data model.

https://docs.google.com/document/d/1BgC1oD0gv9FqYl7qhL5C54Eh4USiCt3K4jxc-PKRnRM/edit?usp=sharing

@avrono
Copy link

avrono commented Mar 11, 2015

Fork for this task https://github.com/avrono/fortune.git - ignore first spec - will create a generic adapter for Neo4J

@avrono
Copy link

avrono commented Mar 11, 2015

@avrono
Copy link

avrono commented Mar 11, 2015

can possibly use the Rest API directly http://neo4j.com/docs/stable/rest-api.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants