Hello everyone!
In today's post, we'll discuss the data modeling and schema design for our Golang project, which focuses on analyzing a marketplace's purchase data. This analytical application will help us understand the relationships between sellers, products, and customers, as well as feedback provided by customers on their purchases. The marketplace operates in various locations, including countries and states.
Let's dive into the details of the data schema:
Node types:
Location: Represents a country or a state.
Seller: Contains attributes such as name, locations where the seller offers products, and feedback scores.
Product: Includes attributes like ID, price, and a relationship to its seller.
Customer: Has attributes like ID, location, and represents clients who ordered products and optionally provided feedback on their purchases.
Relationships:
Seller to Location: A many-to-many relationship, indicating the locations where a seller offers their products.
Product to Seller: A many-to-one relationship, connecting each product to its respective seller.
Customer to Product: A many-to-many relationship, representing the products purchased by customers.
Customer to Product (Feedback): A many-to-many relationship, where customers can provide feedback on the products they purchased.
With these node types and relationships in place, we can efficiently model our analytical application about marketplace purchases in a graph database. In the following posts, we'll explore different graph databases and evaluate how well they can handle our data model, in terms of installation, code samples, and performance.
Stay tuned for our next post, where we'll dive into EdgeDB and explore its potential for our Golang project. See you there!
```
classDiagram
Location "1" -- "many" Seller : Offers Products In
Seller "1" -- "many" Product : Sells
Customer "many" -- "many" Product : Purchased
Customer "many" -- "many" Product : Gave Feedback On
class Location {
+ID: Integer
+Name: String
}
class Seller {
+ID: Integer
+Name: String
+FeedbackScore: Float
}
class Product {
+ID: Integer
+Price: Float
}
class Customer {
+ID: Integer
+Location: String
}
Purchased --|> Customer
Purchased --|> Product
class Purchased {
+Count: Integer
}
GaveFeedbackOn --|> Customer
GaveFeedbackOn --|> Product
class GaveFeedbackOn {
+Score: Float
}
```
Copy the code above and paste it into the Mermaid Live Editor (https://mermaid-js.github.io/mermaid-live-editor/) or any other Mermaid-compatible diagramming tool to generate the updated schema diagram
#golang #graph #data_modeling #schema_design #edgedb #neo4j #dgraph
#edgedb #golang #graph #schema_design #data_modeling #neo4j #dgraph