Company
Date Published
Author
Neo4j
Word count
1310
Language
English
Hacker News points
None

Summary

The Neo4j graph database is suitable for modeling hierarchical data, such as categories and products. It stores data as nodes and relationships between them, with key-value properties on both nodes. The Neo4j Python language bindings are used to interact with the database. A common Entity-Relationship Diagram can be applied to model categories and products. The data model consists of entities (categories, products, attribute types) and relationships (between categories and attribute types). The graph structure lends itself well to indexing. Subreference nodes are created to connect multiple entry points to the graph. These nodes are lazily created when requested. Attribute definitions are modeled as relationships between a category and an attribute type node. A traverser is used to fetch all attribute definitions which apply to a product. The Neo4j database can be used to store hierarchical data, such as categories and products, in a more efficient and scalable way than traditional relational databases.