Advertisement

Springer Nature is making SARS-CoV-2 and COVID-19 research free. View research | View latest news | Sign up for updates

An interactive SQL relational interface for querying main-memory data structures

Abstract

Query formalisms and facilities have received significant attention in the past decades resulting in the development of query languages with varying characteristics; many of them resemble sql. Query facilities typically ship as part of database management systems or, sometimes, bundled with programming languages. For applications written in imperative programming languages, database management systems impose an expensive model transformation. In-memory data structures can represent sophisticated relationships in a manner that is efficient in terms of storage and processing overhead, but most general purpose programming languages lack an interpreter and/or an expressive query language for manipulating interactive queries. Issuing interactive ad-hoc queries on program data structures is tough. This work presents a method and an implementation for representing an application’s arbitrary imperative programming data model as a queryable relational one. The Pico COllections Query Library (pico ql) uses a domain specific language to define a relational representation of application data structures and an sql interface implementation. Queries are issued interactively and are type safe. We demonstrate our relational representation for objects and the library’s usefulness on three large c++ projects. pico ql enhances query expressiveness and boosts productivity compared to querying via traditional programming constructs.

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

Fig. 1
Fig. 2
Fig. 3
Fig. 4

Notes

  1. 1.

    http://www.linqpad.net/.

  2. 2.

    https://github.com/mfragkoulis/PiCO_QL/blob/master/doc/bnf.txt.

  3. 3.

    The initial letter of the Greek word \(\beta \acute{\alpha }\sigma \eta \) which means base.

  4. 4.

    http://qt-project.org/.

  5. 5.

    https://github.com/mfragkoulis/PiCO_QL/tree/master/examples/CScout.

  6. 6.

    https://github.com/mfragkoulis/PiCO_QL/tree/master/examples/QLandKarte.

  7. 7.

    https://github.com/mfragkoulis/PiCO_QL/tree/master/examples/Stellarium.

References

  1. 1.

    Agrawal R, Gehani NH (1989) ODE (Object Database and Environment): the language and the data model. SIGMOD Rec 18(2):36–45. doi:10.1145/66926.66930

  2. 2.

    Basili VR, Caldiera G, Rombach HD (1994) The goal question metric approach. In: Encyclopedia of software engineering, vol 1, Wiley, New York, pp 528–532

  3. 3.

    Bauer C, King G (2006) Java Persistence with Hibernate, revised edn. Manning Publications, Greenwich, CT, USA

  4. 4.

    Bierman G, Wren A (2005) First-class relationships in an object-oriented language. In: Proceedings of the 19th European conference on object-oriented programming. Springer, Berlin, ECOOP’05, pp 262–286. doi:10.1007/11531142_12

  5. 5.

    Cattell RGG, Barry DK (eds) (2000) The object data standard: ODMG 3.0. Morgan Kaufmann Publishers Inc., San Francisco

  6. 6.

    Colby LS (1989) A recursive algebra and query optimization for nested relations. SIGMOD Rec 18(2):273–283. doi:10.1145/66926.66952

  7. 7.

    Fragkoulis M, Spinellis D, Louridas P, Bilas A (2014) Relational access to unix kernel data structures. In: Proceedings of the ninth European conference on computer systems. ACM, New York, NY, USA, EuroSys ’14, pp 12:1–12:14. doi:10.1145/2592798.2592802

  8. 8.

    Hawkins P, Aiken A, Fisher K, Rinard M, Sagiv M (2011) Data representation synthesis. In: Proceedings of the 32nd ACM SIGPLAN conference on programming language design and implementation. ACM, New York, NY, USA, PLDI ’11, pp 38–49. doi:10.1145/1993498.1993504

  9. 9.

    Keith M, Schincariol M (2009) Pro JPA 2: mastering the java persistence API, 1st edn. Apress, Berkely

  10. 10.

    Kifer M, Kim W, Sagiv Y (1992) Querying object-oriented databases. SIGMOD Rec 21(2):393–402. doi:10.1145/141484.130342

  11. 11.

    Lamb C, Landis G, Orenstein J, Weinreb D (1991) The ObjectStore database system. Commun ACM 34(10):50–63. doi:10.1145/125223.125244

  12. 12.

    Lampoudi S, Beazley DM (2002) SWILL: A simple embedded web server library. In: Demetriou CG (ed) Proceedings of the FREENIX track: 2002 USENIX annual technical conference, June 10–15, 2002. Monterey, California, USA, USENIX, pp 19–27

  13. 13.

    Lehman TJ, Carey MJ (1986) Query processing in main memory database management systems. In: Proceedings of the 1986 ACM SIGMOD international conference on management of data. ACM, New York, NY, USA, SIGMOD ’86, pp 239–250. doi:10.1145/16894.16878

  14. 14.

    Maier D (1990) Advances in database programming languages. In: Bancilhon F, Buneman P (eds) Papers from DBPL-1, ACM Press, New York, NY, USA, chap representing database programs as objects, pp 377–386. doi:10.1145/101620.101642

  15. 15.

    Maier D, Stein J, Otis A, Purdy A (1986) Development of an object-oriented DBMS. SIGPLAN Not 21(11):472–482. doi:10.1145/960112.28746

  16. 16.

    Meijer E (2011) The world according to LINQ. Commun ACM 54(10):45–51. doi:10.1145/2001269.2001285

  17. 17.

    Meijer E, Beckman B, Bierman G (2006) LINQ: Reconciling object, relations and XML in the.NET framework. In: Proceedings of the 2006 ACM SIGMOD international conference on management of data. ACM, New York, NY, USA, SIGMOD ’06, pp 706–706. doi:10.1145/1142473.1142552

  18. 18.

    Melnik S, Gubarev A, Long JJ, Romer G, Shivakumar S, Tolton M, Vassilakis T (2010) Dremel: interactive analysis of web-scale datasets. Proc VLDB Endow 3(1–2):330–339

  19. 19.

    Melnik S, Adya A, Bernstein PA (2007) Compiling mappings to bridge applications and databases. In: Proceedings of the 2007 ACM SIGMOD international conference on management of data. ACM, New York, NY, USA, SIGMOD ’07, pp 461–472. doi:10.1145/1247480.1247532

  20. 20.

    Owens M (2006) The definitive guide to SQLite (definitive guide). Apress, Berkely, CA, USA

  21. 21.

    Reichenbach C, Immerman N, Smaragdakis Y, Aftandilian EE, Guyer SZ (2010) What can the GC compute efficiently?: A language for heap assertions at GC time. In: Proceedings of the ACM international conference on object oriented programming systems languages and applications. ACM, New York, NY, USA, OOPSLA ’10, pp 256–269. doi:10.1145/1869459.1869482

  22. 22.

    Reichenbach C, Smaragdakis Y, Immerman N (2012) PQL: a purely-declarative java extension for parallel programming. In: Proceedings of the 26th European conference on object-oriented programming. Springer, Berlin, ECOOP’12, pp 53–78. doi:10.1007/978-3-642-31057-7_4

  23. 23.

    Rumbaugh J (1987) Relations as semantic constructs in an object-oriented language. In: Conference proceedings on object-oriented programming systems, languages and applications. ACM, New York, NY, USA, OOPSLA ’87, pp 466–481. doi:10.1145/38765.38850

  24. 24.

    Spiewak D, Zhao T (2010) ScalaQL: language-integrated database queries for scala. In: Proceedings of the second international conference on software language engineering, Springer, Berlin, SLE ’09, pp 154–163. doi:10.1007/978-3-642-12107-4_12

  25. 25.

    Spinellis D (2010) CScout: a refactoring browser for C. Sci Comput Program 75(4):216–231. doi:10.1016/j.scico.2009.09.003

  26. 26.

    The SQLite team (2013) The virtual table mechanism of SQLite. http://www.sqlite.org/vtab.html. Accessed April 2015

  27. 27.

    Thomas S, Fischer P (1986) Nested relational structures. In: PC Kanellakis (ed) Advances in computing research III, The theory of databases, pp 269–307

  28. 28.

    Willis D, Pearce DJ, Noble J (2006) Efficient object querying for Java. In: Proceedings of the 20th European conference on object-oriented programming, Springer, Berlin, ECOOP ’06, pp 28–49. doi:10.1007/11785477_3

Download references

Acknowledgments

The authors would like to thank Georgios Gousios, Damianos Chatziantoniou, and Yannis Smaragdakis for their comments on earlier drafts of this paper. This work was funded by Foundation Propondis.

Author information

Correspondence to Marios Fragkoulis.

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Fragkoulis, M., Spinellis, D. & Louridas, P. An interactive SQL relational interface for querying main-memory data structures. Computing 97, 1141–1164 (2015). https://doi.org/10.1007/s00607-015-0452-y

Download citation

Keywords

  • sql
  • Interactive
  • Query
  • Main-memory
  • Object

Mathematics Subject Classification

  • 68N15