Graph-Oriented Databases : Introduction with Neo4J
{
"identity": 18,
"labels": [
"Person"
],
"properties": {
"name": "Tom Cruise",
"born": 1962
}
}
{
"identity": 49,
"start": 18,
"end": 39,
"type": "ACTED_IN",
"properties": {
"roles": [
"Jerry Maguire"
]
}}
version: '3.5'
services:
# ...
neo4j:
image: neo4j:4.1
restart: unless-stopped
ports:
- 10474:7474
- 10687:7687
volumes:
- ./neo4j/conf:/conf
- ./neo4j/data:/data
- ./neo4j/import:/import
- ./neo4j/logs:/logs
- ./neo4j/plugins:/plugins
environment:
- NEO4J_dbms_memory_pagecache_size=1G
- NEO4J_dbms.memory.heap.initial_size=1G
- NEO4J_dbms_memory_heap_max__size=1G
firewall-cmd --add-port=10474/tcp --permanent
firewall-cmd --add-port=10687/tcp --permanent
firewall-cmd --reload
docker-compose up -d neo4j
open this url in your browser :
http://<your-host>:10474/browserExample: create movie & actor nodes and relationship
CREATE (TheMatrix:Movie {title:'The Matrix', released:1999, tagline:'Welcome to the Real World'})
CREATE (Keanu:Person {name:'Keanu Reeves', born:1964})
CREATE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrix)
CREATE (TheMatrix:Movie {title:'The Matrix', released:1999, tagline:'Welcome to the Real World'})
{title:'The Matrix'...}
document, and a label (:Movie
)Example: search nodes with MATCH
& RETURN
MATCH (m:Movie {title:'The Matrix'})
RETURN m
following the previous examples, input the following actors as nodes in the graph, and declare their relationships
{name:'Carrie-Anne Moss', born:1967}
{name:'Laurence Fishburne', born:1961}
{name:'Hugo Weaving', born:1960}
declare that they all have acted in "The Matrix" Movie