Analysis: Conceptual Data Modeling التحليل: النمذجة المفاهيمية للبيانات (Conceptual Data Modeling)

Defining the "What". Structuring organizational data using ERDs and Class Diagrams, independent of any database technology. تحديد "الماهية" (What). هيكلة البيانات التنظيمية باستخدام مخططات الـ ERD والـ Class Diagrams، بشكل مستقل عن أي تقنية لقواعد البيانات.

Entity-Relationship (ERD) ERD Class Diagrams Class Diagrams Cardinality Cardinality Aggregation Aggregation Business Rules قواعد العمل (Business Rules)

The Modeling Process عملية النمذجة (The Modeling Process)

Conceptual data modeling captures the overall structure of organizational data. It is independent of any Database Management System (DBMS). تجسد النمذجة المفاهيمية للبيانات الهيكل العام للبيانات التنظيمية. وهي مستقلة عن أي نظام إدارة قواعد بيانات (DBMS).

Top-Down Approach نهج Top-Down

Derives the data model from an intimate understanding of the business nature. يشتق نموذج البيانات من فهم عميق لطبيعة العمل.
"What are the subjects of the business?" "ما هي موضوعات العمل؟"

Bottom-Up Approach نهج Bottom-Up

Derives the data model by reviewing specific business documents (forms, reports). يشتق نموذج البيانات من خلال مراجعة مستندات عمل محددة (نماذج، تقارير).
"What data appears on this Invoice?" "ما هي البيانات التي تظهر في هذه الفاتورة؟"

Entity-Relationship Modeling نمذجة الكيان والعلاقة (Entity-Relationship)

Entities الكيانات (Entities)

A person, place, object, event, or concept about which the organization wishes to maintain data. شخص، مكان، شيء، حدث، أو مفهوم ترغب المنظمة في حفظ بيانات عنه.

  • Entity Type: Collection of entities (e.g., Employee). Entity Type: مجموعة من الكيانات (مثل: الموظف).
  • Entity Instance: Single occurrence (e.g., John Doe). Entity Instance: مثيل واحد (مثل: أحمد).

Attributes الخصائص (Attributes)

Properties or characteristics of an entity (e.g., Name, Address). خصائص أو سمات الكيان (مثل: الاسم، العنوان).

  • Candidate Key: Uniquely identifies an instance (e.g., ID). Candidate Key: يحدد المثيل بشكل فريد (مثل: الرقم التعريفي).
  • Multivalued: Takes >1 value (e.g., Skill). {Curly Brackets}. Multivalued: يأخذ أكثر من قيمة (مثل: المهارة). {أقواس معقوفة}.

Relationships العلاقات (Relationships)

An association between the instances of one or more entity types. ارتباط بين مثيلات نوع كيان واحد أو أكثر.

  • Degree: Number of entity types involved (Unary, Binary, Ternary). Degree (الدرجة): عدد أنواع الكيانات المشاركة (أحادية، ثنائية، ثلاثية).
  • Cardinality: Constraint on number of instances (1:1, 1:M, M:N). Cardinality (التعددية): قيد على عدد المثيلات (1:1, 1:M, M:N).

Associative Entity الكيان الرابط (Associative Entity)

An entity type that associates the instances of one or more entity types and contains attributes that are peculiar to the relationship between those entity instances. Often used to resolve Many-to-Many (M:N) relationships. نوع كيان يربط بين مثيلات نوع كيان واحد أو أكثر ويحتوي على خصائص خاصة بالعلاقة بين تلك المثيلات. غالباً ما يستخدم لحل علاقات Many-to-Many (M:N).

UML Class Diagrams مخططات الفئات (UML Class Diagrams)

Object Modeling نمذجة الكائنات (Object Modeling)

Static Structure Static Structure

Shows the static structure of an object-oriented model: classes, their internal structure, and the relationships between them. يظهر الهيكل الثابت لنموذج كائني التوجه: الفئات (Classes)، هيكلها الداخلي، والعلاقات بينها.

ClassName
- attribute1: type
- attribute2: type
+ operation1(params): return
+ operation2()
Association Association
Named relationship علاقة مسماة
Generalization Generalization
Inheritance (Is-a) الوراثة (Is-a)
Aggregation Aggregation
Part-of (Shared) جزء من (مشترك)
Composition Composition
Part-of (Exclusive) جزء من (حصري)

Advanced Relationships علاقات متقدمة

Generalization Generalization (التعميم)

Abstracting common features (attributes/operations) into a Superclass and defining specific features in Subclasses. تجريد الميزات المشتركة (الخصائص/العمليات) في Superclass وتعريف الميزات المحددة في Subclasses.

Vehicle $\leftarrow$ Car, Truck, Bike

Aggregation vs. Composition Aggregation vs. Composition

  • Aggregation (Hollow Diamond): Aggregation (معين مفرغ): Weak "Part-of". Parts can exist independently. (e.g., Computer has a Monitor). "جزء من" ضعيف. الأجزاء يمكن أن توجد بشكل مستقل. (مثال: الحاسوب لديه شاشة).
  • Composition (Solid Diamond): Composition (معين ممتلئ): Strong "Part-of". Parts live and die with the whole. (e.g., Building has Rooms). "جزء من" قوي. الأجزاء تحيا وتموت مع الكل. (مثال: المبنى لديه غرف).

The Exam Vault The Exam Vault (خزنة الاختبارات)

Professor's Secrets & Trap Avoidance أسرار البروفيسور وتجنب الفخاخ

TRAP: Cardinality vs Degree TRAP: Cardinality vs Degree

Degree: The number of entity types that participate in a relationship (Unary, Binary, Ternary).
Cardinality: The number of instances of entity B that can be associated with entity A (One, Many).
Don't confuse "Binary Relationship" (Degree 2) with "One-to-Many" (Cardinality).
Degree: عدد أنواع الكيانات المشاركة في العلاقة.
Cardinality: عدد المثيلات المرتبطة.
لا تخلط بين "علاقة ثنائية" (Degree 2) و "One-to-Many" (Cardinality).

TRAP: The M:N Solution TRAP: The M:N Solution

"How do you implement a Many-to-Many relationship in a database?"
You CANNOT do it directly. You must create an Associative Entity (junction table) to break it into two 1:M relationships.
"كيف تنفذ علاقة Many-to-Many في قاعدة البيانات؟"
لا يمكنك فعل ذلك مباشرة. يجب إنشاء Associative Entity لتقسيمها إلى علاقتين 1:M.

SECRET: Attribute Types SECRET: Attribute Types

Pay attention to attribute notation.
Underlined = Primary/Identifier Key.
{Curly Brackets} = Multivalued Attribute.
(Parentheses) = Composite Attribute.
انتبه لتدوين الخصائص.
تحته خط = Primary Key.
{أقواس معقوفة} = Multivalued.
(أقواس) = Composite.

KEY CONCEPT: The Diamond Rule KEY CONCEPT: The Diamond Rule

In UML Class Diagrams:
Solid Diamond (Composition): If the University is destroyed, the Departments are destroyed.
Hollow Diamond (Aggregation): If the Computer is destroyed, the Mouse/Keyboard can be reused elsewhere.
في الـ Class Diagrams:
Solid Diamond (Composition): إذا دُمرت الجامعة، تُدمر الأقسام.
Hollow Diamond (Aggregation): إذا دُمر الحاسوب، يمكن إعادة استخدام الفأرة/لوحة المفاتيح.