1. Create a Node
1 syntax: CREATE (Node-name:label-name{property1-name:property1-value,... Propertyn-name:propertyn-value})2 such as:3 Create (Genre: Ming Party {name: ' Zhang Mowgli ', skill: ' Nine Yang Canon '})
2. Establish a relationship for two nodes
1 syntax: CREATE (NODE1:LABEL1)-[relationship-name:relationship-label-name]-> (NODE2:LABEL2) 2 such as: 3 Match (P: Wudang), (s: Ming party) where p.name = ' Zhang Trixan ' and s.name = ' Mowgli ' Create (P)-[r: Parent-Child]-> (s) //establish relationship for two nodes 4 m Atch (P1: Emei faction), (P2: Emei faction) where P1.name = ' extermination division too ' and p2.name = ' Zhou Zhijo ' Create (p1)-[r: Apprentice]-> (p2) return R //For two nodes, and return off System diagram
As shown in the following:
3. Find the diagram based on the specified relationship and node
1 syntax: Match r= (Node1:label1)-[relationship-name:relationship-label-name]-> (p2) return R 2 such as: 3 Match r= (P1: Emei faction)-[r: Apprentice]-> (p2) return R //Return to Emei faction with a master-pupil relationship of the node diagram
As shown in the following:
4. Delete a specified relationship of two nodes
1 syntax: MATCH (Node1:label1{property1:value1})-[relationship-name:relationship-label-name]-> (node2:label2{ property2:value2}) Delete R2 such as: Because Songqing book betrayed Wudang, Song and he severed the father-son relationship 3 MATCH (p1: Wudang {name: ' Song Far Bridge '})- [R: Father and Son]-> (p2: Wudang {name: ' songqing book '}) Delete R
After the deletion of the Atlas as shown below, the two people no longer have a parent-child relationship
5. Some of the other basic operations
1 return all nodes in the graphics database 2 match (n) return n; 3 4 Delete all nodes of the graphics database 5 Match (n) detach Delete n
Basic operation of graphical database neo4j