An object-oriented model
In the object-oriented model, when presenting data, it is possible to identify individual records of the database. Between records of a database and functions of their processing interrelations are established by means of the mechanisms similar to corresponding means in the object-oriented programming languages.
The standardized object-oriented model is described in the recommendations of the ODMG-93 standard (Object Database Management Group). The recommendations of ODMG-93 have not been fully implemented yet. To illustrate key ideas, consider a somewhat simplified model of an object-oriented database.
The structure of the object-oriented database (for example, Versant Object Database, Object Store, etc.) can be represented graphically in the form of a tree whose nodes are objects. Properties of objects are described by some standard type (for example, string - string) or a type, designed by the user (defined as class).
The value of a string property is a string of characters. The value of a class property is an object that is an instance of the corresponding class. Each object - an instance of the class is considered the child of the object, in which it is defined as a property. An object - an instance of a class belongs to its class and has one parent. Generic relations in the database form a coherent hierarchy of objects.
The logical structure of an object-oriented database looks like a hierarchical database structure. The main difference between them is the methods of manipulating data.
To perform actions on the data in the considered database model, logical operations are applied, enhanced by object-oriented mechanisms of encapsulation, inheritance, and polymorphism.
Operations that are similar to SQL commands can be used (for example, to create a database).
Creating and modifying the database is accompanied by the automatic generation and subsequent correction of indexes (index tables) containing information for quick data retrieval.
Let's briefly consider the concepts of encapsulation, inheritance, and polymorphism applied to an object-oriented database model.
Encapsulation limits the scope of the property name to the outside of the object in which it is defined.
Inheritance, by contrast, extends the scope of the property to all descendants of the object.
Polymorphism in object-oriented programming languages means the ability of the same program code to work with different types of data. In other words, it means the admissibility in objects of different types to have methods (procedures or functions) with the same names. During execution of the object program, the same methods operate with different objects, depending on the type of the argument. The search in the object-oriented database is to find out the similarities between the object specified by the user and the objects stored in the database. A user-defined object called a target object (the object property is of the goal type), in general, can be a subset of the entire hierarchy of objects stored in the database. The target object, as well as the result of the query execution, can be stored in the database itself.
The main advantage of the object-oriented data model in comparison with the relational one is the ability to display information about complex relationships of objects. An object-oriented data model allows you to identify a single database entry and determine the processing functions of the database.
Disadvantages of the object-oriented model are high conceptual complexity, inconvenience of data processing and low speed of query execution.
Initially, DBMSs were used primarily to solve financial and economic problems. In this case, regardless of the representation model, the following basic data types were used in databases:
• numeric. Examples of data values: 0.43; 328; 2E + 5;
• Character (alphanumeric). Examples of data values: Friday & quot ;, string & quot ;, programmer & quot ;;
• dates specified using the special type "Date or as normal character data. Examples of data values: 1.12.97, 23/2/1999.
In different DBMS these types could differ insignificantly from each other by name, range of values and type of representation. Subsequently, new areas of application began to appear specialized data processing systems, for example, geoinformation, video image processing, etc. In this regard, developers began to introduce new types of data into traditional DBMS. Among the relatively new types of data are the following:
• temporary and date-time, designed to store information about the time and (or) date. Examples of data values: 31.01.85 (date), 9:10:03 (time), 6.03.1960 12:00 (date and time);
• character-length variables designed to store long-length text information, such as a document;
• Binary, designed for storing graphic objects, audio and video information, spatial, chronological and other special information. For example, in MS Access, this type is the data type OLE Object Field & quot ;, which allows you to store graphical data in BMP (Bitmap) format in the database and automatically display them when working with the database;
• hyperlinks, which are used to store links to various resources (nodes, files, documents, etc.) that are outside the database, for example, on the Internet, intranet or on the hard disk of the computer.
In modern DBMS with different data models, all of the listed data types can be used.