web interface Basic Operations
-
create Create a node
create (node-name: label- name {property-name: property-value})
node eg create a single label, the node has four attributes
Eg node to create multiple labels, the node has a property
We continue to add some nodes to facilitate the following actions
eg when creating a node at the same time set an association
eg create an association to an existing node (Neo4j CQL CREATE command supports only the direction of the relationship)
After eg return a node, you can view the nodes associated with him according to the association options node relationship information
eg when creating a node can only attribute required of a good design, but does not fill a specific value is set to NULL, use IS NULL late to find this node and set the desired value
- match lookup relationship, or find nodes
-
return operation display information obtained
eg show all nodes
eg to find a specific one node specific information
eg finding information a node of class
eg find a class of node points in accordance with the label
eg find nodes based on point properties
egMatch combined with the intermediate processing results
eg node for multiple tabs, you can specify the label to find
-
Delete delete- or delete nodes associated with
eg such as we build some relationship between students and found that clutter intend to delete just added Relations
eg found Friends of the relationship between Sylvia and set Nile node problem, delete re-add relationship
eg remove duplicate node
Appropriate to add some other relationship
-
Add or delete attributes (the SET, the Remove)
EG added a tagline
eg add a property
eg remove a property
Detach delete and delete: the former delete nodes and relationships, which just delete nodeseg delete tagline
-
tagline
Tagline: Some feature node can not
Property: attribute may be a node may be associated attributes
Label: label, a node classification - Filter according to defined conditions where
-
Sort by the Order
EG by name in descending order
-
Union
EG can see two queries before and after the Union needs to have the same column name
eg statistics teacher student id
-
Limit
EG limit display two nodes (according <id> ascending order of display)
Where <id> is automatically numbered, and we can use it to node query by looking up or operation
eg for <id> node 1 = query
-
Skip Skip several nodes
egskip 3 skips the first three nodes
-
Merge operation
EG Merge for node does not exist, the effect similar to create
eg for existing points, only to find his role, and will not add nodes
-
In operation
eg meet the selection criteria a given interval
-
Fonts and display settings
You can choose the color size, caption section can choose to display the title
-
String Functions
-
Aggregation function (similar to SQL, a statement in the return clause)
the maximum and minimum self node id eg
The number of piano eg hobby (statistics for specific attributes)
eglabel for the number of students (statistics for a particular label)
-
Relations function
we first establish a small module, to facilitate subsequent operations
eg to find the beginning of a relationship
The same can also be found eg end
eg when relations with specific attributes, we can find a specific relationship by limiting the attributes end and beginning
eg while relations can query id, type, and some properties
With a schema can look at the current situation index and constraint
-
Index
eg create an index
eg see the index
eg delete indexes
Index role: query optimization process -
unique constraints
eg create a unique constraint, attempt to insert a violation data, an error is detected
For the third-party software Neo4j
- Apoc: Awesome Procedures on Cypher (encapsulates some complex cypher write function)
- Open source visual component library :( can be adjusted) according to their characteristics of the project
D3.js: a JavaScript library based data processing document, can be achieved by operating data visualization HTML, SVG, CSS. We can introduce the page Neo4j end of JavaScript js library of API calls Neo4j to get the data, and then according to the organization D3.js API JSON data, and then render.
vis.js, Sigma.js, Vivagraph.js, yWorks - Visualization scheme :( package easier to use, fully encapsulated, availability)
Gephi, Keylines, Linkurio.us, Tom Sawyer FIG visualized
(Neo4j Browser) - Neoclipse: help to better adjust, create, display database Neo4j
a graph database utility designed to help you view and modify Neo4j databases when it comes to various properties and relationships, as well as to create new nodes and relationships.
Figure database instance modeled on practice (fraud)
- Background: First-Party- Bank-Fraud Fraud real name / First Party Fraud
nature: practical invent himself or herself or another person's identity, forged identity fraud, bank fraud specific to the first party to include credit card fraud, credit fraud, fraud overdrafts, unsecured credit fraud, etc., to defraud money from the bank through credit cards, loans and other tools, but a big problem there is no willingness to repay, which is facing the banks.
Fraud ring normal modes of operation:
a group of two or more people or a fraud ring composed of two, they share some of the information a legitimate contact, and then create multiple identities synthesized by different combinations of information. Fraud ring to use these identities to open accounts, normally used for some time, because the bank account of the lawful detected increased credit limit. Suddenly one day, everyone maximize the use of the credit line and then disappeared, leading to debt can not be recovered.
Why use a database diagram:
Graphs are the Designed to Express relatednessthey CAN Uncover Patterns 'apologetic' to the catch by Traditional Database.
Operational drawing database: entity set different stages of analysis test - Simulation step
- 3 contacts and create three accounts
- Create an address to associate to a three contact address
- Create two telephone numbers, associating the three contacts for both phone numbers
- Create two SSN (community security account), were associated with three contacts
- Three each account or apply for a credit card without a mortgage
-
An entity associated analysis: Find contact information shared by multiple legitimate account holders, and calculate the potential financial risks
Below are the results achieved, the specific code attached to the end of the
Then analyzed for a number of entities associated with the model
-
Analysis shared by multiple legitimate contact information of the account holder
-
Calculation of possible financial risks
create
(accountOwner1:AccountOwner{FirstName:"Sylvia",LastName:"Song",UniqueID:"SylviaSong"}),
(accountOwner2:AccountOwner{FirstName:"Angle",LastName:"Hao",UniqueID:"AngleHao"}),
(accountOwner3:AccountOwner{FirstName:"Jacky",LastName:"Song",UniqueID:"JackySong"}),
(address1:Address{Street:"123 NW1st Street",City:"Beijing"}),
(accountOwner1)-[:HAS_ADDRESS]->(address1),
(accountOwner2)-[:HAS_ADDRESS]->(address1),
(accountOwner3)-[:HAS_ADDRESS]->(address1),
(phoneNumber1:PhoneNumber{PhoneNumber:"111-111-11111"}),
(phoneNumber2:PhoneNumber{PhoneNumber:"222-222-22222"})
<-[:HAS_PHONENUMBER]-(accountOwner3),
(accountOwner1)-[:HAS_PHONENUMBER]->(phoneNumber1),
(accountOwner2)-[:HAS_PHONENUMBER]->(phoneNumber1),
(SSN1:SSN{SSN:"241-23-1234"}),
(accountOwner2)-[:HAS_SSN]->(SSN1),
(accountOwner3)-[:HAS_SSN]->(SSN1),
(SSN2:SSN{SSN:"241-23-5678"}),
(accountOwner1)-[:HAS_SSN]->(SSN2),
(creditCard1:CreditCard{AccountNumber:"1234567890123456",
Limit:5000,
Balance:1442.23,
ExpirarionDate:"01-20",
SecurityCode:"123"})<-[:HAS_CREDITCARD]-(accountOwner1),
(creditCard2:CreditCard{AccountNumber:"1234567890123456",
Limit:4000,
Balance:2345.56,
ExpirarionDate:"02-20",
SecurityCode:"456"})<-[:HAS_CREDITCARD]-(accountOwner2),
(bankAccount1:BankAccount{AccountNumber:"2345678901234567",
Balance:7054.43})<-[:HAS_BANKACCOUNT]-(accountOwner1),
(bankAccount2:BankAccount{AccountNumber:"3456789012345678",
Balance:4231.12})<-[:HAS_BANKACCOUNT]-(accountOwner2),
(bankAccount3:BankAccount{AccountNumber:"4567890123456789",
Balance:12345.45})<-[:HAS_BANKACCOUNT]-(accountOwner3),
(unsecuredLoan1:UnsecuredLoan{AccountNumber:"4567890123456789-0",
Balance:9045.53,
APR:.0541,
LoanAmount:12000.00})<-[:HAS_UNSECUREDLOAN]-(accountOwner2),
(unsecuredLoan2:UnsecuredLoan{AccountNumber:"5678901234567890-0",
Balance:16341.95,
APR:.0341,
LoanAmount:22000.00})<-[:HAS_UNSECUREDLOAN]-(accountOwner3)
Reproduced in: https: //www.jianshu.com/p/9e3c4892ab3e