The \(\theta \)-Join as a Join with \(\theta \)

  • Conference paper
  • First Online:
Relational and Algebraic Methods in Computer Science (RAMiCS 2020)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 12062))

  • 371 Accesses

Abstract

We present an algebra for the classical database operators. Contrary to most approaches we use (inner) join and projection as the basic operators. Theta joins result by representing theta as a database table itself and defining theta-join as a join with that table. The same technique works for selection. With this, (point-free) proofs of the standard optimisation laws become very simple and uniform. The approach also applies to proving join/projection laws for preference queries. Extending the earlier approach of [16], we replace disjointness assumptions on the table types by suitable consistency conditions. Selected results have been machine-verified using the tool.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
EUR 32.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or Ebook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
EUR 29.95
Price includes VAT (France)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
EUR 42.79
Price includes VAT (France)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
EUR 52.74
Price includes VAT (France)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free ship** worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    With this we follow the SQL standard. Note, however, that \(P \!\bowtie \!\theta \!\bowtie \!Q\) is defined even if this disjointness condition does not hold. It is not even necessary to require \(A \ne B\), although having \(A = B\) is not interesting.

  2. 2.

    We use this example only for motivation; strictly speaking an interchange law needs to have the same variables on both sides.

  3. 3.

    Equation (7) is valid for concrete relations. For abstract relations, only \(\subseteq \) holds. This phenomenon is called unsharpness in the literature (an early mention is [18], a further elaboration [1]). The situation is similar with Lemma 8.6.4. The paper [15] constructs an RA that does not satisfy sharpness.

References

  1. Berghammer, R., Haeberer, A., Schmidt, G., Veloso, P.: Comparing two different approaches to products in abstract relation algebra. In: Nivat, M., Rattray, C., Rus, T., Scollo, G. (eds.) AMAST 1993, pp. 167–176. Springer, Heidelberg (1993). https://doi.org/10.1007/978-1-4471-3227-1_16

  2. Berghammer, R., von Karger, B.: Relational semantics of functional programs. In: Brink, C., Kahl, W., Schmidt, G. (eds.) Relational Methods in Computer Science. Advances in Computing Science, pp. 115–130. Springer, Heidelberg (1997). https://doi.org/10.1007/978-3-7091-6510-2_8

  3. Dang, H.-H., Höfner, P., Möller, B.: Algebraic separation logic. J. Logic Algebraic Program. 80(6), 221–247 (2011)

    Article  MathSciNet  Google Scholar 

  4. Dang, H.-H., Möller, B.: Reverse exchange for concurrency and local reasoning. In: Gibbons, J., Nogueira, P. (eds.) MPC 2012. LNCS, vol. 7342, pp. 177–197. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-31113-0_10

    Chapter  Google Scholar 

  5. Desharnais, J., Möller, B., Struth, G.: Modal Kleene algebra and applications – a survey. J. Relational Methods Comput. Sci. 1, 93–131 (2004)

    MATH  Google Scholar 

  6. Desharnais, J., Möller, B., Struth, G.: Kleene algebra with domain. ACM Trans. Comput. Logic 7, 798–833 (2006)

    Article  MathSciNet  Google Scholar 

  7. Haeberer, A., Frias, M., Baum, G., Veloso, P.: Fork algebras. In: Brink, C., Kahl, W., Schmidt, G. (eds.) Relational Methods in Computer Science. Advances in Computing Science, pp. 54–69. Springer, Heidelberg (1997)

    Google Scholar 

  8. Horn, R., Johnson, C.: Topics in Matrix Analysis. Cambridge University Press, Cambridge (1991)

    Google Scholar 

  9. Kahl, W.: CalcCheck: a proof checker for teaching the “logical approach to discrete math”. In: Avigad, J., Mahboubi, A. (eds.) ITP 2018. LNCS, vol. 10895, pp. 324–341. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-94821-8_19

    Chapter  Google Scholar 

  10. Kahl, W.: CalcCheck—A proof-checker for Gries and Schneider’s Logical Approach to Discrete Math. http://calccheck.mcmaster.ca/

  11. Kanellakis, P.: Elements of relational database theory. In: van Leeuwen, J. (ed.) Handbook of Theoretical Computer Science. Volume B: Formal Models and Semantics, pp. 1073–1156. Elsevier (1990)

    Google Scholar 

  12. Kießling, W.: Preference queries with SV-semantics. In: International Conference on Management of Data (COMAD 2005), pp. 15–26 (2005)

    Google Scholar 

  13. Kießling, W., Endres, M., Wenzel, F.: The preference SQL system – an overview. Bull. Tech. Committee Data Eng. 34(2), 11–18 (2011). http://www.markusendres.de/preferencesql/

  14. Kießling, W., Hafenrichter, B.: Algebraic optimization of relational preference queries. Technical report No. 2003–01. University of Augsburg, Institute of Computer Science, February 2003

    Google Scholar 

  15. Maddux, R.: On the derivation of identities involving projection functions. In: Csirmaz, L., Gabbay, D., de Rijke, M. (eds.) Logic Colloquium ’92. Studies in Logic, Languages, and Information, pp. 143–163. CSLI Publications (1995)

    Google Scholar 

  16. Möller, B., Roocks, P.: An algebra of database preferences. J. Logical Algebraic Methods Program. 84(3), 456–481 (2015)

    Article  MathSciNet  Google Scholar 

  17. Schmidt, G., Ströhlein, T.: Relations and Graphs: Discrete Mathematics for Computer Scientists. EATCS Monographs on Theoretical Computer Science. Springer, Heidelberg (1993). https://doi.org/10.1007/978-3-642-77968-8

  18. Zierer, H.: Programmierung mit Funktionsobjekten: Konstruktive Erzeugung semantischer Bereiche und Anwendung auf die partielle Auswertung. Institut für Informatik, Technische Universität München. Report TUM-I8803, February 1988

    Google Scholar 

Download references

Acknowledgement

Helpful comments were provided by Patrick Roocks, Andreas Zelend and the anonymous referees.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Bernhard Möller .

Editor information

Editors and Affiliations

14 Appendix

14 Appendix

For types \(T_P, T_Q\) we use the notion of a direct product of \(D_P\) and \(D_Q\) (e.g. [17]). This is a pair \((\rho _P, \rho _Q)\) of relations with \(\rho _P \subseteq (D_P \times D_Q) \times D_P\) and \(\rho _Q \subseteq (D_P \times D_Q) \times D_Q\) such that

Using this concept the parallel product can be represented as

(5)

The following properties of direct products are used in the main proofFootnote 3:

(6)
(7)

Proof of  Lemma 12.5. The proof consists in showing (see Lemma 10.3.3). We do this by showing the stronger property , from which the original claim follows by and isotony of \(\mathbin {;}\).

Since “joinable” is defined with \(\mathbin {\#}\) and the formula to prove uses , we have to make a connection between the two:

(8)

This is analogous to the conversion of a relation to a vector explained in [17], which would give . The inverse transformation is . Both equations are easily verified. Using restriction (Lemma 2.1.7) and Boolean algebra, the second one can be simplified to . Then by Definition 12.4 and the definition of diamond (Definition 6.1) P is joinable with Q iff

(9)

Now we calculate as follows.

figure t

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Desharnais, J., Möller, B. (2020). The \(\theta \)-Join as a Join with \(\theta \). In: Fahrenberg, U., Jipsen, P., Winter, M. (eds) Relational and Algebraic Methods in Computer Science. RAMiCS 2020. Lecture Notes in Computer Science(), vol 12062. Springer, Cham. https://doi.org/10.1007/978-3-030-43520-2_4

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-43520-2_4

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-43519-6

  • Online ISBN: 978-3-030-43520-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics

Navigation