skip to main content
10.1145/2500365.2500586acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

A practical theory of language-integrated query

Authors Info & Claims
Published:25 September 2013Publication History

ABSTRACT

Language-integrated query is receiving renewed attention, in part because of its support through Microsoft's LINQ framework. We present a practical theory of language-integrated query based on quotation and normalisation of quoted terms. Our technique supports join queries, abstraction over values and predicates, composition of queries, dynamic generation of queries, and queries with nested intermediate data. Higher-order features prove useful even for constructing first-order queries. We prove a theorem characterising when a host query is guaranteed to generate a single SQL query. We present experimental results confirming our technique works, even in situations where Microsoft's LINQ framework either fails to produce an SQL query or, in one case, produces an avalanche of SQL queries.

Skip Supplemental Material Section

Supplemental Material

References

  1. M. P. Atkinson and O. P. Buneman. Types and persistence in database programming languages. ACM Comput. Surv., 19 (2): 105--170, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. E. Axelsson and J. Svenningsson. Combining deep and shallow embedding for EDSL. In TFP, 2012.Google ScholarGoogle Scholar
  3. E. Axelsson, K. Claessen, M. Sheeran, J. Svenningsson, D. Engdal, and A. Persson. The design and implementation of Feldspar--an embedded language for digital signal processing. In J. Hage and M. T. Morazán, editors, IFL, volume 6647 of LNCS, pages 121--136. Springer, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. B. Beckman. Why LINQ matters: cloud composability guaranteed. Commun. ACM, 55 (4): 38--44, Apr. 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. G. M. Bierman, E. Meijer, and M. Torgersen. Lost in translation: formalizing proposed extensions to C\#. In OOPSLA, pages 479--498. ACM, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. M. Budiu, J. Galenson, and G. D. Plotkin. The compiler forest. In ESOP, number 7792 in LNCS, pages 21--40. Springer-Verlag, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. P. Buneman, L. Libkin, D. Suciu, V. Tannen, and L. Wong. Comprehension syntax. SIGMOD Record, 23: 87--96, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. J. Cheney and R. Hinze. First-class phantom types. Computer and Information Science Technical Report TR2003--1901, Cornell University, 2003.Google ScholarGoogle Scholar
  9. J. Cheney, S. Lindley, and P. Wadler. A practical theory of language-integrated query (code supplement), 2012. http://homepages.inf.ed.ac.uk/jcheney/linq. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. A. J. Chlipala. Ur: statically-typed metaprogramming with type-level record computation. In PLDI, pages 122--133. ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. W. Choi, B. Aktemur, K. Yi, and M. Tatsuta. Static analysis of multi-staged programs via unstaging translation. In POPL, pages 81--92. ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. E. Cooper. The script-writer's dream: How to write great SQL in your own language, and be sure it will succeed. In DBPL, number 5708 in LNCS, pages 36--51. Springer-Verlag, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. E. Cooper, S. Lindley, P. Wadler, and J. Yallop. Links: web programming without tiers. In FMCO, volume 4709 of LNCS, pages 266--296, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. G. Copeland and D. Maier. Making Smalltalk a database system. SIGMOD Rec., 14 (2): 316--325, 1984. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. R. Davies and F. Pfenning. A modal analysis of staged computation. J. ACM, 48 (3): 555--604, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. O. Eini. The pain of implementing LINQ providers. Commun. ACM, 54 (8): 55--61, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. G. Giorgidze, T. Grust, T. Schreiber, and J. Weijers. Haskell boards the Ferry - database-supported program execution for Haskell. In IFL, number 6647 in LNCS, pages 1--18. Springer-Verlag, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. T. Goldschmidt, R. Reussner, and J. Winzen. A case study evaluation of maintainability and performance of persistency techniques. In ICSE, pages 401--410. ACM, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. T. Grust, M. van Keulen, and J. Teubner. Accelerating XPath evaluation in any RDBMS. ACM Trans. Database Syst., 29: 91--131, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. T. Grust, M. Mayr, J. Rittinger, and T. Schreiber. Ferry: Database-supported program execution. In SIGMOD, pages 1063--1066. ACM, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. T. Grust, J. Rittinger, and T. Schreiber. Avalanche-safe LINQ compilation. PVLDB, 3 (1): 162--172, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. F. Henglein and K. F. Larsen. Generic multiset programming with discrimination-based joins and symbolic cartesian products. Higher-Order and Symbolic Computation, 23 (3): 337--370, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. S. Lindley and J. Cheney. Row-based effect types for database integration. In TLDI, pages 91--102. ACM, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. G. Mainland. Explicitly heterogeneous metaprogramming with MetaHaskell. In P. Thiemann and R. B. Findler, editors, ICFP, pages 311--322. ACM, 2012. ISBN 978-1-4503-1054-3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. G. Mainland and G. Morrisett. Nikola: embedding compiled GPU functions in haskell. In J. Gibbons, editor, Haskell Symposium, pages 67--78. ACM, 2010. ISBN 978-1-4503-0252-4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. E. Meijer. The world according to LINQ. Commun. ACM, 54 (10): 45--51, Oct. 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. E. Meijer, B. Beckman, and G. M. Bierman. LINQ: reconciling object, relations and XML in the .NET framework. In SIGMOD, page 706. ACM, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Microsoft. Query expressions (F\# 3.0 documentation), 2013. http://msdn.microsoft.com/en-us/library/vstudio/hh225374.aspx, accessed March 18, 2013.Google ScholarGoogle Scholar
  29. A. Ohori and K. Ueno. Making Standard ML a practical database programming language. In ICFP, pages 307--319. ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. }petricek-dynamic-flinqT. Petricek. Building LINQ queries at runtime in (F\#), 2007. http://tomasp.net/blog/dynamic-flinq.aspx.Google ScholarGoogle Scholar
  31. }petricek-dynamic-linqT. Petricek. Building LINQ queries at runtime in (C\#), 2007. http://tomasp.net/blog/dynamic-linq-queries.aspx.Google ScholarGoogle Scholar
  32. T. Petricek and D. Syme. Syntax Matters: Writing abstract computations in F\#. Pre-proceedings of TFP, 2012. http://www.cl.cam.ac.uk/asciitildetp322/drafts/notations.pdf.Google ScholarGoogle Scholar
  33. D. Prawitz. Natural Deduction: A Proof-Theoretical Study. Almqvist and Wiksell, Stockholm, 1965.Google ScholarGoogle Scholar
  34. M. Rhiger. Staged computation with staged lexical scope. In ESOP, number 7211 in LNCS, pages 559--578. Springer-Verlag, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. T. Rompf and M. Odersky. Lightweight modular staging: a pragmatic approach to runtime code generation and compiled dsls. Commun. ACM, 55 (6): 121--130, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. D. Syme. Leveraging .NET meta-programming components from F\#: integrated queries and interoperable heterogeneous execution. In ML Workshop, pages 43--54. ACM, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. D. Syme, A. Granicz, and A. Cisternino. Expert F\# 3.0. Apress, 2012. ISBN 978-1-4302-4650-3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. W. Taha and T. Sheard. MetaML and multi-stage programming with explicit annotations. Theor. Comput. Sci., 248 (1-2): 211--242, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. P. Trinder. Comprehensions, a query notation for DBPLs. In Proceedings of 3rd International Workshop on Database Programming Languages, pages 49--62. Morgan Kaufmann, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. P. Trinder and P. Wadler. Improving list comprehension database queries. In TENCON '89., 1989.Google ScholarGoogle ScholarCross RefCross Ref
  41. A. Ulrich. A Ferry-based query backend for the Links programming language. Master's thesis, University of Tübingen, 2011.Google ScholarGoogle Scholar
  42. J. Van den Bussche, S. Vansummeren, and G. Vossen. Towards practical meta-querying. Inf. Syst., 30 (4): 317--332, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. L. Wong. Normal forms and conservative extension properties for query languages over collection types. J. Comput. Syst. Sci., 52 (3): 495--505, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A practical theory of language-integrated query

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in
      • Published in

        cover image ACM Conferences
        ICFP '13: Proceedings of the 18th ACM SIGPLAN international conference on Functional programming
        September 2013
        484 pages
        ISBN:9781450323260
        DOI:10.1145/2500365

        Copyright © 2013 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 25 September 2013

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article

        Acceptance Rates

        ICFP '13 Paper Acceptance Rate40of133submissions,30%Overall Acceptance Rate333of1,064submissions,31%

        Upcoming Conference

        ICFP '24

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader