Based on
neo4j:4.2.0
-
Build the image and start the
neo4j
containerexport TAG=`date +"%Y%m%d%H%M"` export PW= #insert password here export NEO4J_AUTH=neo4j/$PW docker build --no-cache --build-arg NEO4J_AUTH -t hanryu/tracker:$TAG . rm -R $(pwd)/data/{databases,dbms,transactions} docker run -p7474:7474 -p7687:7687 -v $(pwd)/import:/import -v $(pwd)/data:/data \ -e NEO4J_AUTH=$NEO4J_AUTH --user=$(id -u):$(id -g) hanryu/tracker:$TAG & unset NEO4J_AUTH
Run
ctrl + C
ordocker stop $(docker ps | grep hanryu | cut -d" " -f1)
to stop the container.If you've previously created the database i.e. in
$(pwd)/data
, remember to remove the subdirectories when changing passwords. The database will otherwise expect the password you used the first time you set it up.
-
Start the
neo4j
containerexport PW= #insert password here docker run -p7474:7474 -p7687:7687 -v $(pwd)/data:/import -e NEO4J_AUTH=neo4j/$PW neo4j
-
Go to http://localhost:7474/browser/ on your favourite browser
-
Load data and display (see cypher script)
LOAD CSV WITH HEADERS FROM 'file:///Cast.csv' AS row UNWIND split(row.Role, ' / ') AS name MERGE (role:Role {title: row.Title , role: name , actor: row.Actor }) WITH role, row MATCH (title:Title {title: row.Title}) MATCH (actor:Actor {actor: row.Actor}) // Create relationships between actors, roles and titles MERGE (actor)-[:AS]->(role) MERGE (role)-[:IN]->(title) ON CREATE SET role.Role = row.Role; // Display MATCH p = ()-[]-()-[]-() RETURN p LIMIT 750 // up to 6 deg of separation match p=(:Actor {Actor: 'Park Hyung-sik'})-[*1..6]-(:Title) return p