Skip to content

neo4j

setup


install

#sudo apt remove -y neo4j
#sudo rm -rf /usr/share/neo4j
sudo apt update -y
sudo apt install -y neo4j
start db
sudo neo4j start
sudo neo4j status
#-> wa want to see this 'Neo4j is running at pid ...'
login to web UI
firefox localhost:7474
# Login as neo4j with pass: neo4j
# New password <- neo4jneo4j

neo4j desktop


  • https://neo4j.com/deployment-center/?desktop-gdb

cypher


create new node group

CREATE (n:Group {objectid:'9bc58e05-b7c9-48e1-82f2-3c7b59edc052', name: 'POLICY-CUSTOM', displayname:'Policy-custom', tenantid:'3ad13ed5-8b3b-4b90-b526-6bd36b1341f4'});
create new node computer
CREATE (n:Computer {objectid:'5b084d4d-559b-475a-9f69-429120080fc1', name: 'ENVIRONMENT-00000001', displayname:'Environment-00000001', tenantid:'3ad13ed5-8b3b-4b90-b526-6bd36b1341f4'});
CREATE (n:Computer {objectid:'e8948bec-c2b4-42d6-82b9-767f1052c120', name: 'ENVIRONMENT-00000002', displayname:'Environment-00000002', tenantid:'3ad13ed5-8b3b-4b90-b526-6bd36b1341f4'});
CREATE (n:Computer {objectid:'3f5d4a3a-1b20-496f-a08b-88d9c39bdf83', name: 'ENVIRONMENT-00000003', displayname:'Environment-00000003', tenantid:'3ad13ed5-8b3b-4b90-b526-6bd36b1341f4'});
search node type Group by name
MATCH (p:Group {name: 'POLICY-CUSTOM'}) RETURN p;
search node type Computer by name
MATCH (p:Computer {name: 'ENVIRONMENT-00000001'}) RETURN p;
create relationship
MATCH (a:AZGroup {displayname: 'DTAPM_AppFwAdmin_U'}), (b:Group {name: 'POLICY-CUSTOM'}) CREATE (a)-[r:Owns]->(b);

MATCH (a:Group {name: 'POLICY-CUSTOM'}), (b:Computer {name: 'ENVIRONMENT-00000001'}) CREATE (a)-[r:Owns]->(b);
MATCH (a:Group {name: 'POLICY-CUSTOM'}), (b:Computer {name: 'ENVIRONMENT-00000002'}) CREATE (a)-[r:Owns]->(b);
MATCH (a:Group {name: 'POLICY-CUSTOM'}), (b:Computer {name: 'ENVIRONMENT-00000003'}) CREATE (a)-[r:Owns]->(b);
delete node
MATCH (p:Group {name: 'POLICY-CUSTOM'}) DELETE p
MATCH (p:Computer {name: 'ENVIRONMENT-00000001'}) DELETE p
MATCH (p:Computer {name: 'ENVIRONMENT-00000002'}) DELETE p
MATCH (p:Computer {name: 'ENVIRONMENT-00000003'}) DELETE p
delte relationship
MATCH (n:Group {name: 'POLICY-CUSTOM'})-[r:MemberOf]->() DELETE r