Skip to main content

Design Datalog Templates for Synthesizing Bidirectional Programs from Tabular Examples

  • Conference paper
  • First Online:
Logic-Based Program Synthesis and Transformation (LOPSTR 2023)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 14330))

  • 167 Accesses

Abstract

In the database community, many synthesizers have been proposed to synthesize unidirectional programs (queries) from tabular examples, but it remains as a challenge to synthesize bidirectional programs (view update strategies) from examples over tables that have internal functional dependencies. In this work, we propose a systematic method to synthesize bidirectional programs from examples with functional dependencies using ProSynth. By forward propagation of functional dependencies from the source through intermediate relations to the view via a set of atomic forward programs, we show how to design Datalog templates encoding the well-behaved view update strategies with minimal effects as well as the constraints and effects imposed by the specified functional dependencies, to guide the synthesis of atomic backward programs which could be combined into a complete backward program. We have fully implemented our proposed approach in a tool called SynthBP, which is capable of automatically synthesizing bidirectional programs for 31 out of 32 practical benchmarks.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Abiteboul, S., Hull, R., Vianu, V.: Foundations of Databases. Addison Wesley, Boston (1995)

    Google Scholar 

  2. Albarghouthi, A., Koutris, P., Naik, M., Smith, C.: Constraint-based synthesis of datalog programs. In: Beck, J.C. (ed.) CP 2017. LNCS, vol. 10416, pp. 689–706. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-66158-2_44

    Chapter  Google Scholar 

  3. Bohannon, A., Foster, J.N., Pierce, B.C., Pilkiewicz, A., Schmitt, A.: Boomerang: resourceful lenses string data. SIGPLAN Not. 43(1), 407–419 (2008)

    Article  MATH  Google Scholar 

  4. Bohannon, A., Pierce, B.C., Vaughan, J.A.: Relational lenses: a language for updatable views. In: Proceedings of the Twenty-Fifth ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, PODS 2006, pp. 338–347. Association for Computing Machinery, New York, NY, USA (2006)

    Google Scholar 

  5. Ceri, S., Gottlob, G., Tanca, L.: What you always wanted to know about datalog (and never dared to ask). IEEE Trans. on Knowl. Data Eng. 1(1), 146–166 (1989)

    Google Scholar 

  6. Cheng, L.: SqlSol: an accurate SQL query synthesizer. In: Ait-Ameur, Y., Qin, S. (eds.) ICFEM 2019. LNCS, vol. 11852, pp. 104–120. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-32409-4_7

    Chapter  Google Scholar 

  7. Czarnecki, K., Foster, J.N., Hu, Z., Lämmel, R., Schürr, A., Terwilliger, J.F.: Bidirectional transformations: a cross-discipline perspective. In: Paige, R.F. (ed.) ICMT 2009. LNCS, vol. 5563, pp. 260–283. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-02408-5_19

    Chapter  Google Scholar 

  8. Feng, Y., Martins, R., Van Geffen, J., Dillig, I., Chaudhuri, S.: Component-based synthesis of table consolidation and transformation tasks from examples. In: Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2017, pp. 422–436. Association for Computing Machinery, New York, NY, USA (2017)

    Google Scholar 

  9. Foster, J.N., Greenwald, M.B., Moore, J.T., Pierce, B.C., Schmitt, A.: Combinators for bidirectional tree transformations: a linguistic approach to the view-update problem. ACM Trans. Program. Lang. Syst. 29(3), 17-es (2007)

    Google Scholar 

  10. Gupta, A., Mumick, I.S., Subrahmanian, V.S.: Maintaining views incrementally. In: Proceedings of the 1993 ACM SIGMOD International Conference on Management of Data, SIGMOD 1993, pp. 157–166. Association for Computing Machinery, New York, NY, USA (1993)

    Google Scholar 

  11. Horn, R., Perera, R., Cheney, J.: Incremental relational lenses. Proc. ACM Program. Lang. 2(ICFP) (2018)

    Google Scholar 

  12. Jordan, H., Scholz, B., Subotic, P.: Soufflé: On synthesis of program analyzers. In: CAV (2016)

    Google Scholar 

  13. Keller, A.M.: Algorithms for translating view updates to database updates for views involving selections, projections, and joins. In: Proceedings of the Fourth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems, PODS 1985, pp. 154–163. Association for Computing Machinery, New York, NY, USA (1985)

    Google Scholar 

  14. Keller, A.M.: Choosing a view update translator by dialog at view definition time. In: Proceedings of the 12th International Conference on Very Large Data Bases, VLDB 1986, p. 467–474. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA (1986)

    Google Scholar 

  15. Larson, J.A., Sheth, A.P.: Updating relational views using knowledge at view definition and view update time. Inf. Syst. 16(2), 145–168 (1991)

    Google Scholar 

  16. Le, V., Gulwani, S.: Flashextract: a framework for data extraction by examples. In: Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2014, pp. 542–553. Association for Computing Machinery, New York, NY, USA (2014)

    Google Scholar 

  17. Maina, S., Miltner, A., Fisher, K., Pierce, B.C., Walker, D., Zdancewic, S.: Synthesizing quotient lenses. Proc. ACM Program. Lang. 2(ICFP) (2018)

    Google Scholar 

  18. Matsuda, K., Wang, M.: HOBiT: programming lenses without using lens combinators. In: Ahmed, A. (ed.) ESOP 2018. LNCS, vol. 10801, pp. 31–59. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-89884-1_2

    Chapter  Google Scholar 

  19. Mendelson, J., Naik, A., Raghothaman, M., Naik, M.: Gensynth: Synthesizing datalog programs without language bias. Proc. AAAI Conf. Artif. Intell. 35(7), 6444–6453 (2021)

    Google Scholar 

  20. Miltner, A., Fisher, K., Pierce, B.C., Walker, D., Zdancewic, S.: Synthesizing bijective lenses. Proc. ACM Program. Lang. 2(POPL), 1–30 (2017)

    Google Scholar 

  21. Miltner, A., Maina, S., Fisher, K., Pierce, B.C., Walker, D., Zdancewic, S.: Synthesizing symmetric lenses. Proc. ACM Program. Lang. 3(ICFP), 1–28 (2019)

    Google Scholar 

  22. Papenbrock, T., et al.: Functional dependency discovery: an experimental evaluation of seven algorithms. Proc. VLDB Endow. 8(10), 1082–1093 (2015)

    Article  Google Scholar 

  23. Raghothaman, M., Mendelson, J., Zhao, D., Naik, M., Scholz, B.: Provenance-guided synthesis of datalog programs. Proc. ACM Program. Lang. 4(POPL), 1–27 (2019)

    Google Scholar 

  24. Shen, Y., Chakrabarti, K., Chaudhuri, S., Ding, B., Novik, L.: Discovering queries based on example tuples. In: Proceedings of the 2014 ACM SIGMOD International Conference on Management of Data, SIGMOD 2014, pp. 493–504. Association for Computing Machinery, New York, NY, USA (2014)

    Google Scholar 

  25. Si, X., Lee, W., Zhang, R., Albarghouthi, A., Koutris, P., Naik, M.: Syntax-guided synthesis of datalog programs. In: Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, ESEC/FSE 2018, pp. 515–527. Association for Computing Machinery, New York, NY, USA (2018)

    Google Scholar 

  26. Solar-Lezama, A., Tancau, L., Bodik, R., Seshia, S., Saraswat, V.: Combinatorial sketching for finite programs. SIGARCH Comput. Archit. News 34(5), 404–415 (2006)

    Google Scholar 

  27. Srivastava, S., Gulwani, S., Foster, J.S.: Template-based program verification and program synthesis. Int. J. Softw. Tools Technol. Transfer 15(5), 497–518 (2012). https://doi.org/10.1007/s10009-012-0223-4

    Article  Google Scholar 

  28. Takenouchi, K., Ishio, T., Okada, J., Sakata, Y.: PatSQL: efficient synthesis of SQL queries from example tables with quick inference of projected columns. Proc. VLDB Endow. 14(11), 1937–1949 (2021)

    Google Scholar 

  29. Tran, V.D., Kato, H., Hu, Z.: Programmable view update strategies on relations. Proc. VLDB Endow. 13(5), 726–739 (2020)

    Google Scholar 

  30. Tsushima, K., Trong, B.N., Glück, R., Hu, Z.: An efficient composition of bidirectional programs by memoization and lazy update. In: Nakano, K., Sagonas, K. (eds.) FLOPS 2020. LNCS, vol. 12073, pp. 159–178. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-59025-3_10

    Chapter  MATH  Google Scholar 

  31. Wang, C., Cheung, A., Bodik, R.: Synthesizing highly expressive SQL queries from input-output examples. SIGPLAN Not. 52(6), 452–466 (2017)

    Article  Google Scholar 

  32. Wang, Y., Shah, R., Criswell, A., Pan, R., Dillig, I.: Data migration using datalog program synthesis. Proc. VLDB Endow. 13(7), 1006–1019 (2020)

    Article  Google Scholar 

  33. Yaghmazadeh, N., Wang, X., Dillig, I.: Automated migration of hierarchical data to relational tables using programming-by-example. Proc. VLDB Endow. 11(5), 580–593 (2018)

    Article  Google Scholar 

  34. Yamaguchi, M., Matsuda, K., David, C., Wang, M.: Synbit: synthesizing bidirectional programs using unidirectional sketches. Proc. ACM Program. Lang. 5(OOPSLA), 1–31 (2021)

    Google Scholar 

  35. Zhang, S., Sun, Y.: Automatically synthesizing SQL queries from input-output examples. In: 2013 28th IEEE/ACM International Conference on Automated Software Engineering (ASE), pp. 224–234 (2013)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Bach Nguyen Trong .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Trong, B.N., Tsushima, K., Hu, Z. (2023). Design Datalog Templates for Synthesizing Bidirectional Programs from Tabular Examples. In: Glück, R., Kafle, B. (eds) Logic-Based Program Synthesis and Transformation. LOPSTR 2023. Lecture Notes in Computer Science, vol 14330. Springer, Cham. https://doi.org/10.1007/978-3-031-45784-5_2

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-45784-5_2

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-45783-8

  • Online ISBN: 978-3-031-45784-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics