Know How Guide and Hands on Guide for AWS
ssh -i ~/.ssh/${KEY_NAME}.pem ubuntu@${PublicDnsName}
sudo -i -u neo4j
# To have Bolt accept non-local connections, uncomment this line for /etc/neo4j/neo4j.conf
dbms.connector.bolt.address=0.0.0.0:7687
dbms.connector.bolt.tls_level=OPTIONAL
sudo systemctl restart neo4j
sudo systemctl stop neo4j
sudo systemctl start neo4j
psql
postgres=# CREATE DATABASE northwind;
CREATE DATABASE
psql -d northwind < /tmp/northwind.postgre.sql
# Exporting the Data to CSV
psql -d northwind
COPY (SELECT * FROM customers) TO '/tmp/customers.csv' WITH CSV header;
COPY (SELECT * FROM suppliers) TO '/tmp/suppliers.csv' WITH CSV header;
COPY (SELECT * FROM products) TO '/tmp/products.csv' WITH CSV header;
COPY (SELECT * FROM employees) TO '/tmp/employees.csv' WITH CSV header;
COPY (SELECT * FROM categories) TO '/tmp/categories.csv' WITH CSV header;
COPY (SELECT * FROM orders LEFT OUTER JOIN order_details ON order_details."OrderID" = orders."OrderID") TO '/tmp/orders.csv' WITH CSV header;
https://neo4j.com/developer/manage-multiple-databases/
# first login
cypher-shell -a ${neo4j_ip} -u neo4j -p neo4j
Change your password to ${instance-id}
cypher-shell -a ${neo4j_ip} -u neo4j -p ${instance-id}
:use system
neo4j@system> SHOW DATABASES;
neo4j@system> CREATE DATABASE movieGraph;
https://community.neo4j.com/t/create-multiple-databases-in-community-version/5025
Creat a folder named like 'xxx.db' (just a blank folder) in root\data\databases.
From Neo4j root folder open 'conf' folder and open neo4j.conf file in Notepad. Update this line: dbms.active_database = xxx.db and 'Save'.
Restart and launch Neo4j. Now you will see a blank database in your 'xxx.db' folder. You are ready to play with your new database. This will be the current active database.
You can switch between databases by editing neo4j.conf file and restarting Neo4j.
# Put the import dataset and scripts under directory /var/lib/neo4j/import
sudo -i -u neo4j
mv *.csv /var/lib/neo4j/import
exit
cypher-shell -a ${neo4j_ip} -u neo4j -p ${instance-id} < import_csv.cypher
cypher-shell -a ${neo4j_ip} -u neo4j -p ${instance-id}
neo4j@neo4j> MATCH (p:Product {productName:"Chocolade"}) return p;
neo4j@neo4j> MATCH (p:Product),(c:Category)
WHERE p.categoryID = c.categoryID
CREATE (p)-[:PART_OF]->(c)
neo4j@neo4j> MATCH (p:Product),(s:Supplier)
WHERE p.supplierID = s.supplierID
CREATE (s)-[:SUPPLIES]->(p)
neo4j@neo4j> MATCH (choc:Product {productName:'Chocolade'})<-[:PRODUCT]-(:Order)<-[:SOLD]-(employee),
(employee)-[:SOLD]->(o2)-[:PRODUCT]->(other:Product)
RETURN employee.employeeID, other.productName, count(distinct o2) as count
ORDER BY count DESC
LIMIT 5;
neo4j@neo4j> MATCH path = (e:Employee)<-[:REPORTS_TO]-(sub)
RETURN e.employeeID AS manager, sub.employeeID AS employee;
neo4j@neo4j> MATCH path = (e:Employee)<-[:REPORTS_TO*]-(sub)
WITH e, sub, [person in NODES(path) | person.employeeID][1..-1] AS path
RETURN e.employeeID AS manager, sub.employeeID AS employee, CASE WHEN LENGTH(path) = 0 THEN "Direct Report" ELSE path END AS via
ORDER BY LENGTH(path);
neo4j@neo4j> MATCH (e:Employee)
OPTIONAL MATCH (e)<-[:REPORTS_TO*0..]-(sub)-[:SOLD]->(order)
RETURN e.employeeID, [x IN COLLECT(DISTINCT sub.employeeID) WHERE x <> e.employeeID] AS reports, COUNT(distinct order) AS totalOrders
ORDER BY totalOrders DESC;
neo4j@neo4j> MATCH (mgr:Employee {EmployeeID:5})
MATCH (emp:Employee {EmployeeID:3})-[rel:REPORTS_TO]->()
DELETE rel
CREATE (emp)-[:REPORTS_TO]->(mgr)
RETURN *;
https://neo4j.com/developer/example-data/