|
560 | 560 | " ↓ ↓\n", |
561 | 561 | " AuthorBook\n", |
562 | 562 | "```\n", |
563 | | - "\n", |
564 | | - "In code:\n", |
565 | | - "```python\n", |
566 | | - "@schema\n", |
567 | | - "class Author(dj.Manual):\n", |
568 | | - " definition = \"\"\"\n", |
569 | | - " author_id : int\n", |
570 | | - " ---\n", |
571 | | - " name : varchar(100)\n", |
572 | | - " \"\"\"\n", |
573 | | - "\n", |
574 | | - "@schema\n", |
575 | | - "class Book(dj.Manual):\n", |
576 | | - " definition = \"\"\"\n", |
577 | | - " isbn : varchar(13)\n", |
578 | | - " ---\n", |
579 | | - " title : varchar(200)\n", |
580 | | - " \"\"\"\n", |
581 | | - "\n", |
582 | | - "@schema\n", |
583 | | - "class AuthorBook(dj.Manual):\n", |
584 | | - " definition = \"\"\"\n", |
585 | | - " -> Author\n", |
586 | | - " -> Book\n", |
587 | | - " ---\n", |
588 | | - " author_order : tinyint\n", |
589 | | - " \"\"\"\n", |
590 | | - "```\n", |
591 | | - "\n", |
592 | | - "**Features**:\n", |
593 | | - "- No special notation for association table—looks like any other table\n", |
594 | | - "- Thin solid lines indicate foreign keys are in primary key (cascading identity)\n", |
595 | | - "- Top-to-bottom layout shows you can populate Author and Book first, then AuthorBook\n", |
596 | | - "- Underlined names show Author and Book are independent dimensions\n", |
597 | | - "\n", |
598 | | - "### Key Observations\n", |
599 | | - "\n", |
600 | | - "1. **Cyclic vs. Acyclic**:\n", |
601 | | - " - Traditional notations allow: `Employee ←→ Department ←→ Manager ←→ Employee` (cycle)\n", |
602 | | - " - DataJoint requires: `Employee` → `Department` → `DepartmentManager` (acyclic)\n", |
603 | | - "\n", |
604 | | - "2. **Information Density**:\n", |
605 | | - " - Crow's Foot shows more detail (nullable, optional)\n", |
606 | | - " - DataJoint emphasizes structure and flow\n", |
607 | | - " - Both require hovering/inspection for complete details\n", |
608 | | - "\n", |
609 | | - "3. **Semantic Meaning**:\n", |
610 | | - " - Traditional: Focus on cardinality (how many)\n", |
611 | | - " - DataJoint: Focus on identity cascade (how entities relate conceptually)\n", |
612 | | - "\n", |
613 | | - "4. **Reading Strategy**:\n", |
614 | | - " - Crow's Foot: Examine each endpoint's symbols\n", |
615 | | - " - DataJoint: Follow the line styles and direction\n", |
616 | | - "\n", |
617 | | - "### When Each Notation Excels\n", |
618 | | - "\n", |
619 | | - "**Use Chen's ER when**:\n", |
620 | | - "- Doing initial conceptual modeling\n", |
621 | | - "- Working with business stakeholders\n", |
622 | | - "- Need to explicitly name relationships\n", |
623 | | - "- Database implementation is secondary\n", |
624 | | - "\n", |
625 | | - "**Use Crow's Foot when**:\n", |
626 | | - "- Documenting existing databases\n", |
627 | | - "- Cardinality and optionality are critical\n", |
628 | | - "- Working with DBAs familiar with this standard\n", |
629 | | - "- Need to show all relationship details\n", |
630 | | - "\n", |
631 | | - "**Use DataJoint when**:\n", |
632 | | - "- Designing scientific workflows\n", |
633 | | - "- Primary key cascade matters for your queries\n", |
634 | | - "- Working with hierarchical or time-series data\n", |
635 | | - "- The DAG structure matches your domain (no cycles)\n", |
636 | | - "- You want diagrams to be executable (code generates diagrams)" |
| 563 | + "\n" |
637 | 564 | ] |
638 | 565 | }, |
639 | 566 | { |
|
0 commit comments