Goal
Find a perfect, flexible schema for storing many different types of objects with a wide variety of links between them in a relational database.
Problem
EAV is a workaround to the normal confinements of a RDBMS.
If you were to normalize an EAV schema, it would be ugly.
Idea
If EAV was normalized, it would be ugly.
Does the fact that we traditionally maintain these schema by hand limit their complexity and power?
But if it was maintained and queried programmatically, what would it matter?
Graphs
If you have n
different entities in n
different tables, why not let your code generate n(n+1)/2
link tables and the queries between them? Would this not result in a true graph in a normalized schema?
In a highly interlinked database, there will always be exponentially more edges than vertices. Why not focus on creating proper, normalized verticles (n
entity tables) and let our code maintain the edges (n^x
link tables)?
Conclusion
Can a system normalize EAV and maintain the resulting complex schema?
Can complex graphs be stored in (and remain true to) relational databases?
I'm sure this has been done before, but I've never seen it. What am I missing?
Example problem
Storing printed works and their bibliographic data
- Many properties which might be not just strings but whole objects.
- In the library world, there is no simple (and relational) schema which can store data "losslessly" without extremely complex schemas.
- Many different types of associations and associated objects
- And their relevant properties (which can vary wildly).
- And their many relationships, of different types, amongst themselves.
Questions
"What problem are you trying to solve?"
-Piet
I'm looking for a normalized solution to EAV, graphs, and polymorphic relationships in a relational database system.
"I would hate to be the guy who has to understand or maintain it after it's gone into production."
-Andrew
This "traditional maintenance" is the exact thing I'm saying we should be automating. Isn't it largely grunt work?