The Theory and Practice of Coupling Formal Concept Analysis to Relational
Total Page:16
File Type:pdf, Size:1020Kb
The theory and practice of coupling formal concept analysis to relational The theory and practice of coupling formal databases concept analysis to relational databases Background Theory Database y Scaling Jens K¨otters Peter W. Eklund Conjunctive Queries ySchool of Information Technology, Deakin University, Geelong, Australia SQL Interpretation Navigation FCA4AI 2018 Summary Stockholm, 13 July 2018 References The theory and practice of coupling formal concept analysis to relational databases Background Theory Database Background Theory Scaling Conjunctive Queries SQL Interpretation Navigation Summary References FCA + Database Theory The theory and practice of coupling formal concept analysis to relational Previous work [Koe13] relates FCA with database theory. A databases table of analogies: Background Theory Standard FCA FCA + Database Theory Database Formal context Relational Structure [Koe13], Scaling Power context family [Koe16] Conjunctive Queries Set of Objects Table SQL Interpretation Set of Attributes Conjunctive query Navigation Concept lattice Conjunctive-query lattice Summary References Lattices of n-ary concepts The theory and practice of coupling formal concept analysis to relational databases The conjunctive-query lattice can be decomposed into sublattices L[fx1;:::; xng] of n-ary concepts described by Background variables x1;:::; xn. All sublattices of n-ary concepts are Theory isomorphic (irrespective of variable names), so we can speak of Database Scaling the lattice of n-ary concepts. The extents are n-ary relations. Conjunctive Queries The lattice C[fx1;:::; xng] contains the concepts of SQL Interpretation L[fx1;:::; xng] where intents correspond to connected graphs. Navigation Summary References The theory and practice of coupling formal concept analysis to relational databases Background Theory Database Database Scaling Scaling Conjunctive Queries SQL Interpretation Navigation Summary References Example: Literature Database The theory and practice Book of coupling formal title author publication date concept Alice in Wonderland 1 1865-11-26 analysis to To the Lighthouse 2 1927-05-05 relational databases The Hitchhiker's Guide to the Galaxy 3 1979-10-12 Trigger Warning 4 2015-02-03 Harry Potter and the Deathly Hallows 5 2007-07-21 The Casual Vacancy 5 2012-09-27 Background Theory The Shining 6 1977-01-28 Doctor Sleep 6 2013-09-24 Database The Da Vinci Code 7 2003-03-18 Scaling Inferno 7 2013-03-14 Conjunctive Queries Author SQL id first name last name nationality date of birth Interpretation 1 Lewis Carroll British 1832-01-27 Navigation 2 Virginia Woolf British 1882-01-25 3 Douglas Adams British 1952-03-11 Summary 4 Neil Gaiman British 1960-11-10 References 5 J. K. Rowling British 1965-07-31 6 Stephen King American 1947-09-21 7 Dan Brown American 1964-06-22 Conceptual scaling of a many-valued context (1) The theory and practice of coupling Author table Centuries scale formal concept id first name last name nationality date of birth Centuries analysis to 1 Lewis Carroll British 1832-01-27 19C 20C 21C 1832-01-27 × relational 2 Virginia Woolf British 1882-01-25 databases 1865-11-26 × 3 Douglas Adams British 1952-03-11 1882-01-25 × 4 Neil Gaiman British 1960-11-10 1927-05-05 × 5 J. K. Rowling British 1965-07-31 1947-09-21 × Background 6 Stephen King American 1947-09-21 Theory 1952-03-11 × 7 Dan Brown American 1964-06-22 1960-11-10 × Database Scaling 1964-06-22 × DOB context 1965-07-31 × Conjunctive 1977-01-28 × Queries DOB 1979-10-12 × SQL 19C 20C 21C 2003-03-18 × Interpretation Lewis Carroll × 2007-07-21 × Virginia Woolf × 2012-09-27 × Navigation Douglas Adams × 2013-03-14 × Summary Neil Gaiman × 2013-09-24 × J. K. Rowling × 2015-02-03 × References Stephen King × Dan Brown × Conceptual scaling of a many-valued context (2) The theory and practice Author table Nationalities scale of coupling formal id first name last name nationality date of birth concept 1 Lewis Carroll British 1832-01-27 analysis to 2 Virginia Woolf British 1882-01-25 Nationalities relational 3 Douglas Adams British 1952-03-11 British American French Russian databases 4 Neil Gaiman British 1960-11-10 British × 5 J. K. Rowling British 1965-07-31 American × 6 Stephen King American 1947-09-21 French × Background 7 Dan Brown American 1964-06-22 Theory Russian × Database Scaling Nationality context Conjunctive We say that the Na- Queries nat tionalities scale is bound SQL Interpretation British American French Russian to the nationality col- Lewis Carroll × Navigation Virginia Woolf × umn (and the Centuries Summary Douglas Adams × Neil Gaiman × scale was bound to the References J. K. Rowling × date of birth column). Stephen King × Dan Brown × Conceptual scaling of a many-valued context (3) The theory and practice Author table of coupling id first name last name nationality date of birth formal concept 1 Lewis Carroll British 1832-01-27 analysis to 2 Virginia Woolf British 1882-01-25 relational 3 Douglas Adams British 1952-03-11 databases 4 Neil Gaiman British 1960-11-10 5 J. K. Rowling British 1965-07-31 6 Stephen King American 1947-09-21 Background 7 Dan Brown American 1964-06-22 Theory We consider the Database Derived context subcontexts ob- Scaling tained from the Conjunctive scales as facets Queries Authors SQL Interpretation DOB:19C DOB:20C DOB:21C nat:British nat:American nat:French nat:Russian Lewis Carroll × × Navigation Virginia Woolf × × Summary Douglas Adams × × Neil Gaiman × × References J. K. Rowling × × Stephen King × × Dan Brown × × Higher-arity scales: Foreign keys The theory Book and practice of coupling title author publication date formal Author table Alice in Wonderland 1 1865-11-26 concept To the Lighthouse 2 1927-05-05 id first name last name nationality date of birth analysis to The Hitchhiker's Guide to the Galaxy 3 1979-10-12 1 Lewis Carroll British 1832-01-27 relational Trigger Warning 4 2015-02-03 2 Virginia Woolf British 1882-01-25 databases Harry Potter and the Deathly Hallows 5 2007-07-21 3 Douglas Adams British 1952-03-11 The Casual Vacancy 5 2012-09-27 4 Neil Gaiman British 1960-11-10 The Shining 6 1977-01-28 5 J. K. Rowling British 1965-07-31 Doctor Sleep 6 2013-09-24 Background 6 Stephen King American 1947-09-21 The Da Vinci Code 7 2003-03-18 Theory 7 Dan Brown American 1964-06-22 Inferno 7 2013-03-14 Database Scaling Binary context "wrote" Conjunctive Queries Equality scale wrote The first parame- = SQL Equality (1,1) × id=author ter of the Equality Interpretation (Lewis Carroll,Alice in Wonderland) × (1,2) (Virginia Woolf,To the Lighthouse) × Navigation (1,3) scale is bound to (Douglas Adams,Hitchhiker's Guide) × (2,1) (Neil Gaiman,Trigger Warning) × Summary (2,2) × Author.id, the second (J.K. Rowling,Harry Potter 7) × (2,3) (J.K. Rowling,The Casual Vacancy) × References (3,1) parameter is bound (Stephen King,The Shining) × (3,2) (Stephen King,Doctor Sleep) × to Book.author. (3,3) × (Dan Brown,The Da Vinci Code) × ... (Dan Brown,Inferno) × Higher-arity scales: Measuring distance The theory and practice Distance scales can be used to measure spatial distance of coupling formal between objects or the time span between events. concept analysis to To measure at what age an author wrote a particular book, we relational databases instead use the foreign key condition as a domain expression (which defines the object set of a derived context) and use a Background distance scale (not the one below !!) on top of this. Theory Database Binary context "wrote" Scaling Distance scale 50 40 Conjunctive =0 ≤1 ≤2 30 ≤ ≤ Queries Distance wrote ≤ (1,1) × × × wrote age age age SQL (1,2) × × (Lewis Carroll, Alice in Wonderland) × × × Interpretation (1,3) × (Virginia Woolf, To the Lighthouse) × × (Douglas Adams, Hitchhiker's Guide) × × × × Navigation (2,1) × × (Neil Gaiman, Trigger Warning) × (2,2) × × × Summary (J. K. Rowling, Harry Potter 7) × × (2,3) × × (J. K. Rowling, The Casual Vacancy) × × References (3,1) × (Stephen King, The Shining) × × × × (3,2) × × (Stephen King, Doctor Sleep) × (3,3) × × × (Dan Brown, The Da Vinci Code) × × × (Dan Brown, Inferno) × × Power Context Family The theory and practice of coupling formal The contexts for each facet can be assembled in a power concept analysis to context family. relational databases 0 1 30 50 40 Background sort: Author sort: Book ≤ ≤ ≤ Theory Lewis Carroll × nationality: GB nationality: USA DOB: 19C DOB: 20C DOB: 21C pubdate: 19C pubdate: 20C pubdate: 21C 2 Virginia Woolf × Lewis Carroll × × Database Douglas Adams × Virginia Woolf × × Douglas Adams × × wrote: wrote wrote: age wrote: age wrote: age Scaling Neil Gaiman × J. K. Rowling × Neil Gaiman × × (Lewis Carroll, Alice in Wonderland) × × × Stephen King × J. K. Rowling × × (Virginia Woolf, To the Lighthouse) × × Conjunctive Dan Brown × Stephen King × × (Douglas Adams, Hitchhiker's Guide) × × × × Queries Alice in Wonderland × Dan Brown × × (Neil Gaiman, Trigger Warning) × To the Lighthouse × Alice in Wonderland × (J. K. Rowling, Harry Potter 7) × × SQL Hitchhiker's Guide × To the Lighthouse × (J. K. Rowling, The Casual Vacancy) × × Hitchhiker's Guide × Interpretation Harry Potter 7 × (Stephen King, The Shining) × × × × The Casual Vacancy × Harry Potter 7 × (Stephen King, Doctor Sleep) × Trigger Warning × The Casual Vacancy × (Dan Brown, The Da Vinci Code) × × × Navigation The Shining × Trigger Warning × (Dan Brown, Inferno) × × Doctor Sleep × The Shining × Summary The Da Vinci Code × Doctor Sleep × Inferno × The Da Vinci Code × References Inferno × The theory and practice of coupling formal concept analysis to relational databases