neo4j

Understanding relationships ..

neo4j

Neo4j is a leading graph database management system designed to store, manage, and query highly connected data.

Unlike traditional relational databases that organize data in tables, Neo4j structures data as a graph of nodes, relationships, and properties.

Neo4j stores data in a property graph model where relationships are first-class citizens.

This approach makes traversing connections between data points extremely efficient - a significant advantage over relational databases that require expensive join operations.

Cypher Query Language

Neo4j uses Cypher, a declarative query language specifically designed for working with graph data.

Cypher syntax is visually intuitive, using ASCII art to represent patterns:

MATCH (person:Person)-[:LIVES_IN]->(city:City {name: "London"})
RETURN person.name
Retail Knowledge Graph
Link to neo4j Developers Guide

x

x

neo4j

  1. Create the Neo4j directories.

cd
mkdir -p Neo4j/neo4j_db/{data,logs,import,plugins}
  1. Create a docker-compose.yml file.

cd
cd Neo4j
nano docker-compose.yml
services:
  neo4j:
    container_name: neo4j
    image: neo4j:latest
    ports:
      - 7474:7474
      - 7687:7687
    environment:
      - NEO4J_AUTH=neo4j/${NEO4J_PASSWORD}
      - NEO4J_apoc_export_file_enabled=true
      - NEO4J_apoc_import_file_enabled=true
      - NEO4J_apoc_import_file_use__neo4j__config=true
      - NEO4J_PLUGINS=["apoc", "graph-data-science"]
    volumes:
      - ./neo4j_db/data:/data
      - ./neo4j_db/logs:/logs
      - ./neo4j_db/import:/var/lib/neo4j/import
      - ./neo4j_db/plugins:/plugins
  • APOC (Awesome Procedures on Cypher) -

  • Graph Data Science plugins -

  1. Create a file called docker-compose.override.yml.

services:
  neo4j:
    environment:
      - NEO4J_server_memory_heap_initial__size=6G
      - NEO4J_server_memory_heap_max__size=6G

This enables you to commit parameters in the configuration you would like to change, but not the values of those parameters. This in turn avoids overriding different memory limit values from different machines - WSL is assigned 50% of total mem and 25% of the 50% to SWAP.

  1. Again, you can create a .env.example and gitignoring .env

cd
cd Neo4j
nano .env
NEO4J_PASSWORD=<your password>
  1. Onnce everything is in place.

cd
cd Neo4j
docker-compose up -d
Deploy neo4j
  1. Log into Neo4j:

Link to neo4j

Username: neo4j

Password: password

Try out the new browser
New Browser Preview

x

x

x

Last updated