Initial commit
This commit is contained in:
69
skills/ontological-documentation/examples/INDEX.md
Normal file
69
skills/ontological-documentation/examples/INDEX.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# Ontological Documentation Examples
|
||||
|
||||
Real-world examples of creating ontological documentation for Grey Haven systems.
|
||||
|
||||
## Available Examples
|
||||
|
||||
1. **[TanStack Start Ontology](tanstack-start-example.md)** - Frontend codebase analysis
|
||||
- Extracting concepts from Drizzle schemas
|
||||
- Mapping React component hierarchies
|
||||
- Documenting multi-tenant patterns
|
||||
- Visualizing route structure
|
||||
|
||||
2. **[FastAPI Ontology](fastapi-example.md)** - Backend codebase analysis
|
||||
- SQLModel entity relationships
|
||||
- Repository pattern documentation
|
||||
- Service layer mapping
|
||||
- API endpoint hierarchy
|
||||
|
||||
3. **[Multi-Tenant System Architecture](multi-tenant-ontology.md)** - Complete system documentation
|
||||
- Tenant isolation patterns
|
||||
- RLS policies visualization
|
||||
- Database schema relationships
|
||||
- Authentication flow
|
||||
|
||||
4. **[Domain Model Extraction](domain-model-extraction.md)** - Business concept mapping
|
||||
- Identifying domain entities
|
||||
- Relationship mapping
|
||||
- Business rule documentation
|
||||
- Semantic relationships
|
||||
|
||||
## Recommended Path
|
||||
|
||||
**For new projects:**
|
||||
1. Start with [domain-model-extraction.md](domain-model-extraction.md)
|
||||
2. Document frontend with [tanstack-start-example.md](tanstack-start-example.md)
|
||||
3. Document backend with [fastapi-example.md](fastapi-example.md)
|
||||
4. Complete system view with [multi-tenant-ontology.md](multi-tenant-ontology.md)
|
||||
|
||||
**For existing systems:**
|
||||
1. Run extraction scripts on codebase
|
||||
2. Follow [domain-model-extraction.md](domain-model-extraction.md) to identify concepts
|
||||
3. Use templates to document findings
|
||||
|
||||
## Quick Reference
|
||||
|
||||
### Frontend Ontology
|
||||
- See [tanstack-start-example.md](tanstack-start-example.md)
|
||||
- Use `scripts/extract_concepts.py` for automation
|
||||
|
||||
### Backend Ontology
|
||||
- See [fastapi-example.md](fastapi-example.md)
|
||||
- Focus on repository and service patterns
|
||||
|
||||
### Visualization
|
||||
- See [multi-tenant-ontology.md](multi-tenant-ontology.md)
|
||||
- Use `scripts/generate_ontology_diagram.py`
|
||||
|
||||
## Related Materials
|
||||
|
||||
- **[Concept Extraction Guide](../reference/concept_extraction_guide.md)** - How to extract concepts
|
||||
- **[Ontology Patterns](../reference/ontology_patterns.md)** - Common patterns
|
||||
- **[Templates](../templates/)** - Ready-to-use ontology templates
|
||||
- **[Scripts](../scripts/)** - Automation scripts
|
||||
|
||||
---
|
||||
|
||||
**Total Examples**: 4 comprehensive guides
|
||||
**Coverage**: TanStack Start, FastAPI, Multi-tenant, Domain modeling
|
||||
**Last Updated**: 2025-11-09
|
||||
@@ -0,0 +1,98 @@
|
||||
# E-Commerce Domain Ontology Example
|
||||
|
||||
## Overview
|
||||
This example demonstrates an ontological documentation approach for a typical e-commerce system.
|
||||
|
||||
## Core Concepts
|
||||
|
||||
### Primary Entities
|
||||
```
|
||||
E-Commerce Domain
|
||||
├── Customer Management
|
||||
│ ├── Customer
|
||||
│ ├── CustomerProfile
|
||||
│ └── Address
|
||||
├── Product Management
|
||||
│ ├── Product
|
||||
│ ├── Category
|
||||
│ └── ProductVariant
|
||||
├── Order Management
|
||||
│ ├── Order
|
||||
│ ├── OrderLine
|
||||
│ └── OrderStatus
|
||||
└── Payment Management
|
||||
├── Payment
|
||||
├── PaymentMethod
|
||||
└── PaymentStatus
|
||||
```
|
||||
|
||||
### Key Relationships
|
||||
|
||||
#### Customer Relationships
|
||||
- **Customer** has-a **CustomerProfile**
|
||||
- **Customer** has-many **Address**
|
||||
- **Customer** places-many **Order**
|
||||
- **Customer** has-many **Payment**
|
||||
|
||||
#### Product Relationships
|
||||
- **Product** belongs-to **Category**
|
||||
- **Product** has-many **ProductVariant**
|
||||
- **ProductVariant** appears-in **OrderLine**
|
||||
|
||||
#### Order Relationships
|
||||
- **Order** contains-many **OrderLine**
|
||||
- **Order** has-a **OrderStatus**
|
||||
- **Order** has-a **Payment**
|
||||
- **OrderLine** references-a **ProductVariant**
|
||||
|
||||
## Business Rules
|
||||
|
||||
### Customer Rules
|
||||
- Customer must have at least one address
|
||||
- Customer profile must include valid email
|
||||
- Customer can have multiple shipping addresses
|
||||
|
||||
### Order Rules
|
||||
- Order must have at least one order line
|
||||
- Order total must equal sum of order line totals
|
||||
- Order status progression is immutable
|
||||
|
||||
### Payment Rules
|
||||
- Payment amount must match order total
|
||||
- Payment method must be valid for customer
|
||||
- Payment status affects order fulfillment
|
||||
|
||||
## Implementation Examples
|
||||
|
||||
### Order Entity Example
|
||||
```python
|
||||
class Order:
|
||||
def __init__(self, customer: Customer):
|
||||
self.customer = customer
|
||||
self.order_lines: List[OrderLine] = []
|
||||
self.status = OrderStatus.PENDING
|
||||
self.created_at = datetime.now()
|
||||
|
||||
def add_product(self, product: ProductVariant, quantity: int):
|
||||
# Add business logic for adding products
|
||||
pass
|
||||
|
||||
def calculate_total(self) -> Money:
|
||||
# Calculate order total
|
||||
pass
|
||||
```
|
||||
|
||||
### Relationship Example
|
||||
```python
|
||||
# Order -> Customer relationship
|
||||
class Order:
|
||||
def __init__(self, customer: Customer):
|
||||
self.customer_id = customer.id # Reference relationship
|
||||
self.customer = customer # Object relationship
|
||||
```
|
||||
|
||||
## Documentation Links
|
||||
- [Customer Documentation](customer-concept.md)
|
||||
- [Product Documentation](product-concept.md)
|
||||
- [Order Documentation](order-concept.md)
|
||||
- [Payment Documentation](payment-concept.md)
|
||||
Reference in New Issue
Block a user