Data Modeling - Generic Data Model

> (Data|State) Management and Processing > Data Modeling (Relational Database, Code, Graph, Text)

1 - About

You can represent any object in a database using just four tables. It's well known as the generic data model.

Good for the flexibility but not good for the database performance and for the simplicity of the SQL statement.

3 - Data Model

CREATE TABLE objects ( oid int primary key, name VARCHAR2(255) );
CREATE TABLE attributes 
( attrId int primary key, attrName VARCHAR2(255), 
datatype VARCHAR2(25) );
CREATE TABLE object_Attributes 
( oid int, attrId int, VALUE VARCHAR2(4000), 
primary key(oid,attrId) );
CREATE TABLE Links ( oid1 int, oid2 int, 
primary key (oid1, oid2) );

4 - Documentation / Reference