Unified theory of intelligent databases