Graph-based nosql Database: neo4j

Source: Internet
Author: User
Tags neo4j

What is neo4j?

1. A high-performance graph relational model database 2. A nosql database 3. multiple types of support Programming Language 4. How can I delete nodes related to a node in neo4j, which is good at processing model data with multiple relationships? 1. Find all links of the target node 2. Start a transaction, delete the Start Node or end node3. traverse all the nodes found and delete the relevant relationship4. then delete the node itself and submit a transaction.
 1   Public   Static   Void Deleterelativenode (node N ){
2 Traversaldescription TD = traversal. Description (). Relationships (types. Relative, direction. Both)
3 . Evaluator (evaluators. excludestartposition ());
4 Traverser T = TD. Traverse (N );
5 For (Node TN: T. nodes ()){
6 Iterable <relationship> relationships = tn. getrelationships ();
7 For (Relationship R: Relationships ){
8 If (R. getstartnode (). Equals (n) | r. getendnode (). Equals (N )){
9 R. Delete ();
10 }
11 }
12 If (! Tn. hasrelationship ()){
13 Tn. Delete ();
14 }
15 }
16 }

A condition for deleting a node in neo4j is that the node does not have any relationship.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.