Neo4j is a true graph database. Really, a property graph, but it's better than hacking graph data into other databases.
Note: This places the data in ~/someProject/data. If you want it somewhere else, you'll have to change this command.
docker run \
--publish=7474:7474 --publish=7687:7687 \
--volume=$HOME/someProject/data:/data \
--name someProject-neo4j \
neo4j
NOTE: This also disables auth!!!
docker run \
--publish=7474:7474 --publish=7687:7687 \
-e NEO4J_AUTH=none \
--volume=$PWD/hobbygraph/data:/data \
--volume=$PWD/plugins:/plugins \
--name hobbygraph-neo4j \
-e NEO4J_apoc_export_file_enabled=true \
-e NEO4J_apoc_import_file_enabled=true \
-e NEO4J_apoc_import_file_use__neo4j__config=true \
neo4j
version: '2'
services:
hobbygraph:
image: neo4j
ports:
- 7474:7474
- 7687:7687
volumes:
- ./hobbygraph-data:/data
- ./plugins:/plugins
restart: unless-stopped
environment:
- NEO4J_apoc_export_file_enabled=true
- NEO4J_apoc_import_file_enabled=true
- NEO4J_apoc_import_file_use__neo4j__config=true
- NEO4J_AUTH=none
First, you need to install APOC into the Docker container by mounting a plugins/ volume into the neo4j docker container as described here:
OR maybe you could actually make your own Docker image that just downloads the file into the Docker image on it's own...?
Remember, cypherFormat can be create, updateAll, addStructure, or updateStructure. They are defined here:
docker exec -it hobbygraph-neo4j bash
cypher-shell
CALL apoc.export.cypher.all("/data/hobby-graph.cypher", {format : "cypher-shell", cypherFormat: "create"});
Use this URL to access the Neo4j developer interface: (http://0.0.0.0:7474/browser/)[http://0.0.0.0:7474/browser/]
By default, the username and password is: neo4j, neo4j and you'll be asked to change your password when you first log in.
After you've logged in, you should probably go through the Neo4j documentation a bit. When you start understanding the point, the following scripts should help you start building graphs.
Add Node:
CREATE (:Project {name:"Decode YS1 Packets"})
Add Edge between two nodes:
MATCH (start:Project {name:"LayerOne 2018 Demo Party Entry"})
MATCH (end:Equipment {name:"1UP badge"})
CREATE (start)-[r:HARDWARE]->(end)
RETURN r
Find node using internal id:
MATCH (s)
WHERE ID(s) = 126
RETURN s
Find, Detach, and Delete a connected node based on internal id:
MATCH (s)
WHERE ID(s) = 60
DETACH
DELETE s