Skip to content

binarymason/es-graphdb-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ElasticSearch and Neo4j Demo

Setup

  1. Copy ./app/.env.sample to ./app/.env (required)
  2. Fill in environment variables in ./app/.env if you want google image lookup to work (optional)

Importing data

Download data

bin/download

Start the docker stack

docker-compose up

In another window, start a neo4j shell inside the container

docker exec --interactive --tty neo4j_container bin/cypher-shell

Run this:

CREATE CONSTRAINT ON (n:Movie) ASSERT n.objectId IS UNIQUE;

CREATE CONSTRAINT ON (n:User) ASSERT n.objectId IS UNIQUE;

USING PERIODIC COMMIT 500
LOAD CSV FROM "file:///data/import/ml-100k/u.user" AS line FIELDTERMINATOR '|'
CREATE (:User {objectId: toInt(line[0]), age: toInt(line[1]), gender: line[2], occupation: line[3]});

USING PERIODIC COMMIT 500
LOAD CSV FROM "file:///data/import/ml-100k/u.item" AS line FIELDTERMINATOR '|'
CREATE (:Movie {objectId: toInt(line[0]), title: line[1], date: line[2], imdblink: line[4]});

USING PERIODIC COMMIT 500
LOAD CSV FROM "file:///data/import/ml-100k/u.data" AS line FIELDTERMINATOR '\t'
MATCH (u:User {objectId: toInt(line[1])})
MATCH (p:Movie {objectId: toInt(line[0])})
CREATE UNIQUE (u)-[:LIKES {user_age: u.age, user_gender: u.gender, user_id: u.id, user_occupation: u.occupation, movie_title: p.title, movie_id: p.id, rate: ROUND(toFloat(line[2])), timestamp: line[3]}]->(p);

How to drop db

MATCH (n)
DETACH DELETE n;

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages