L
L
LEKAPb2016-04-14 00:30:22
PostgreSQL
LEKAPb, 2016-04-14 00:30:22

How to store abstract data models in relational databases?

Good time of the day!
Interested in the issue of creating and storing abstract mutable data models in relational databases.
You need the ability to create extensible and inherited models in the database, with the ability to edit and extend. For example:
1. We create a base model - Animal .
2.Add the property "Name"
3.Create a model heir to the CAT that inherits the basic properties of the model Animal + has additional properties (of different types, double,binary,etc) and possibly links to other instances of other models.
4.Now it is necessary to recreate the description of the final model at the database level in order to create an instance of the data model with the ability to store properties in the database.
In fact, the object database is just not very clear how to transfer all this to the OOP relational database and store instance data.
Perhaps there are some standards or frameworks that allow you to do this?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
Lertmind, 2016-04-14
@Lertmind

It's called an ORM .

D
Dmitry, 2016-04-14
@DimonSmart

There is a classic anti-pattern, EAV Entity Attribute Value
www.sql.ru/forum/1110351/esli-nuzhna-gibkaya-shema...
From an academic point of view, a very interesting storage principle.
BUT there is a lot of BUT
On Habré there was a very detailed article with details of working with EAV databases. On Habré there was still in the Google cache: https://webcache.googleusercontent.com/search?q=ca...
I will supplement the answer with a very good and simply obligatory reading article with a rather detailed and good description of the theory of building EAV structures. (By the way, the word EAV is not used in the article itself) OOP in RDBMS

V
vovik0134, 2016-04-21
@vovik0134

You can try to use table inheritance.
But at first glance, this solution does not seem simple, although it allows you to use the object approach.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question