Hierarchical database model

Hierarchical database model

A hierarchical database model is a data model in which the data is organized into a tree-like structure. The data are stored as records which is a collection of one or more fields. Each field contains a single value, and the collection of fields in a record defines its type. One type of field is the link, which connects a given record to associated records. Using links, records link to other records, and to other records, forming a tree. An example is a "customer" record that has links to that customer's "orders", which in turn link to "line_items".

The hierarchical database model mandates that each child record has only one parent, whereas each parent record can have zero or more child records. The network model extends the hierarchical by allowing multiple parents and children. In order to retrieve data from these databases, the whole tree needs to be traversed starting from the root node. Both models were well suited to data that was normally stored on tape drives, which had to move the tape from end to end in order to retrieve data.

When the relational database model emerged, one criticism of hierarchical database models was their close dependence on application-specific implementation. This limitation, along with the relational model's ease of use, contributed to the popularity of relational databases, despite their initially lower performance in comparison with the existing network and hierarchical models.[1]

History

The hierarchical structure was developed by IBM in the 1960s and used in early mainframe DBMS. Records' relationships form a treelike model. This structure is simple but inflexible because the relationship is confined to a one-to-many relationship. The IBM Information Management System (IMS) and RDM Mobile are examples of a hierarchical database system with multiple hierarchies over the same data.

فقد نموذج البيانات الهرمي شعبيته مع تحول نموذج كود العلائقي إلى المعيار الفعلي المستخدم في جميع أنظمة إدارة قواعد البيانات الشائعة تقريبًا. نُوقشت لأول مرة في منشور عام 1992 [ 2 ] إمكانية تطبيق نموذج هرمي في قاعدة بيانات علائقية (انظر أيضًا نموذج المجموعة المتداخلة ). عادت مخططات تنظيم البيانات الهرمية للظهور مع ظهور لغة XML في أواخر التسعينيات [ 3 ] (انظر أيضًا قاعدة بيانات XML ). يُستخدم الهيكل الهرمي اليوم بشكل أساسي لتخزين المعلومات الجغرافية وأنظمة الملفات.

لا تزال قواعد البيانات الهرمية مستخدمة على نطاق واسع، لا سيما في التطبيقات التي تتطلب أداءً عاليًا وتوافرًا مستمرًا، مثل الخدمات المصرفية والرعاية الصحية والاتصالات. ومن أكثر قواعد البيانات الهرمية التجارية استخدامًا قاعدة بيانات IMS. [ 4 ] ومن الأمثلة الأخرى على استخدام قواعد البيانات الهرمية سجل نظام التشغيل ويندوز في أنظمة تشغيل مايكروسوفت ويندوز . [ 5 ]

أمثلة على البيانات الهرمية الممثلة كجداول علائقية

يمكن للمؤسسة تخزين معلومات الموظفين في جدول يحتوي على سمات/أعمدة مثل رقم الموظف، والاسم الأول، واسم العائلة، ورقم القسم. توفر المؤسسة لكل موظف أجهزة حاسوب حسب الحاجة، ولكن لا يُسمح باستخدام هذه الأجهزة إلا للموظف المُخصصة له. يمكن للمؤسسة تخزين معلومات أجهزة الحاسوب في جدول منفصل يتضمن الرقم التسلسلي لكل قطعة، ونوعها، والموظف الذي يستخدمها. قد تبدو الجداول كالتالي:

employeeطاولة
رقم الموظفالاسم الأولاسم العائلةرقم القسم
100ساليبيكر10 لتر
101جاكدوغلاس10 لتر
102سارةشولتز20-ب
103ديفيددراخماير20-ب
computerطاولة
الرقم التسلسلييكتبرقم الموظف المستخدم
3009734-4حاسوب100
3-23-283742شاشة100
2-22-723423شاشة100
232342طابعة100

في هذا النموذج، employeeيُمثل جدول البيانات الجزء "الأب" من التسلسل الهرمي، بينما computerيُمثل الجدول الجزء "الفرعي" منه. وعلى عكس هياكل الأشجار الشائعة في خوارزميات برامج الحاسوب، في هذا النموذج، تشير الفروع إلى الآباء. وكما هو موضح، قد يمتلك كل موظف عدة أجهزة حاسوب، ولكن لكل جهاز منها مالك واحد فقط من الموظفين.

ضع في اعتبارك البنية التالية:

رقم الموظفتعيينالتقارير إلى
10مخرج
20مدير أول10
30كاتبة20
40مبرمج20

In this, the "child" is the same type as the "parent". The hierarchy stating EmpNo 10 is boss of 20, and 30 and 40 each report to 20 is represented by the "ReportsTo" column. In Relational database terms, the ReportsTo column is a foreign key referencing the EmpNo column. If the "child" data type were different, it would be in a different table, but there would still be a foreign key referencing the EmpNo column of the employees table.

This simple model is commonly known as the adjacency list model and was introduced by Dr. Edgar F. Codd after initial criticisms surfaced that the relational model could not model hierarchical data. However, the model is only a special case of a general adjacency list for a graph.

See also

References

  1. Silberschatz, Abraham; Korth, Henry F.; Sudarshan, S. Database System Concepts. 4th ed., McGraw-Hill, 2004, p. 11, 21.
  2. Michael J. Kamfonas/Recursive Hierarchies: The Relational Taboo!Archived 2008-11-08 at the Wayback Machine--The Relation Journal, October/November 1992
  3. "Web Application Development". IBM.
  4. IBM Information Management System
  5. "Structure of the Registry - Win32 apps".