What the Heck is a Relation? From Tables to Cartesian Products to Logic
relational-algebradatabaseslogicset-theorysqlprolog
Abstraction: Unifying relational databases, logic, and set theory through the relation abstraction
Key points:
- A relation has four equivalent definitions: subset of a Cartesian product, a table, a generalization of a function, and a predicate function assigning truth-values to k-tuples
- Rows = tuples/individuals/points; columns = dimensions; column types = domains — all the same mathematical objects
- Functions are relations but not vice versa: functions impose a "vertical line test" (one output per input); relations have no privileged output dimension (illustrated via Prolog's plus/3 vs functional plus)
- Closed World Assumption (SQL/Prolog): absence of a fact means false; Open World Assumption (Semantic Web/RDF triples): absence means unknown — a fundamental design divide
- Relational algebra and relational calculus are provably equivalent (Codd 1972); relational calculus is a modified predicate calculus
- Apache Hive and Pig implement relational semantics on Hadoop/MapReduce while retaining SQL-like DSL character
Connections: Apache Hive · Hadoop · Relational Algebra · Database Theory · Logic Programming
Source: http://merrigrove.blogspot.in/2013/12/what-heck-is-relation-from-tables-to.html?m=1