Skip to main content

XQuery in the Functional-Logic Language Toy

  • Conference paper
Functional and Constraint Logic Programming (WFLP 2011)

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

Included in the following conference series:

Abstract

This paper presents an encoding of the XML query language XQuery in the functional-logic language \(\mathcal{TOY}\). The encoding is based on the definition of for-let-where-return constructors by means of \(\mathcal{TOY}\) functions, and uses the recently proposed XPath implementation for this language as a basis. XQuery expressions can be executed in \(\mathcal{TOY}\) obtaining sequences of XML elements as answers. Our setting exploits the non-deterministic nature of \(\mathcal{TOY}\) by retrieving the elements of the XML tree once at a time when necessary. We show that one of the advantages of using a rewriting-based language for implementing XQuery is that it can be used for optimizing XQuery expressions by query rewriting. With this aim, XQuery expressions are converted into higher order patterns that can be analyzed and modified by \(\mathcal{TOY}\) functions.

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

Access this chapter

Subscribe and save

Springer+ Basic
$34.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
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Similar content being viewed by others

References

  1. Almendros-Jiménez, J., Caballero, R., García-Ruiz, Y., Sáenz-Pérez, F.: A Declarative Embedding of XQuery in a Functional-Logic Language. Technical Report SIC-04/11, Facultad de Informática, Universidad Complutense de Madrid (2011), http://gpd.sip.ucm.es/rafa/xquery/

  2. Almendros-Jiménez, J.M.: An Encoding of XQuery in Prolog. In: Bellahsène, Z., Hunt, E., Rys, M., Unland, R. (eds.) XSym 2009. LNCS, vol. 5679, pp. 145–155. Springer, Heidelberg (2009)

    Chapter  Google Scholar 

  3. Almendros-Jiménez, J.M., Becerra-Terón, A., Enciso-Baños, F.J.: Querying XML documents in logic programming. Journal of Theory and Practice of Logic Programming 8(3), 323–361 (2008)

    Article  MathSciNet  MATH  Google Scholar 

  4. Atanassow, F., Clarke, D., Jeuring, J.: UUXML: A type-preserving XML schema–haskell data binding. In: Jayaraman, B. (ed.) PADL 2004. LNCS, vol. 3057, pp. 71–85. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  5. Benzaken, V., Castagna, G., Frish, A.: CDuce: an XML-centric general-purpose language. In: Proc. of the ACM SIGPLAN International Conference on Functional Programming, pp. 51–63. ACM Press, New York (2005)

    Google Scholar 

  6. Benzaken, V., Castagna, G., Miachon, C.: A Full Pattern-Based Paradigm for XML Query Processing. In: Hermenegildo, M.V., Cabeza, D. (eds.) PADL 2004. LNCS, vol. 3350, pp. 235–252. Springer, Heidelberg (2005)

    Chapter  Google Scholar 

  7. Boncz, P., Grust, T., van Keulen, M., Manegold, S., Rittinger, J., Teubner, J.: MonetDB/XQuery: a fast XQuery processor powered by a relational engine. In: Proceedings of the 2006 ACM SIGMOD International Conference on Management of Data, pp. 479–490. ACM Press, New York (2006)

    Chapter  Google Scholar 

  8. Boncz, P.A., Grust, T., van Keulen, M., Manegold, S., Rittinger, J., Teubner, J.: Pathfinder: XQuery - The Relational Way. In: Proc. of the International Conference on Very Large Databases, pp. 1322–1325. ACM Press, New York (2005)

    Google Scholar 

  9. Bry, F., Schaffert, S.: The XML Query Language Xcerpt: Design Principles, Examples, and Semantics. In: Chaudhri, A.B., Jeckle, M., Rahm, E., Unland, R. (eds.) NODe-WS 2002. LNCS, vol. 2593, pp. 295–310. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  10. Caballero, R., García-Ruiz, Y., Sáenz-Pérez, F.: Integrating XPath with the Functional-Logic Language Toy. In: Rocha, R., Launchbury, J. (eds.) PADL 2011. LNCS, vol. 6539, pp. 145–159. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  11. Caballero, R., López-Fraguas, F.: A functional-logic perspective on parsing. In: Middeldorp, A. (ed.) FLOPS 1999. LNCS, vol. 1722, pp. 85–99. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  12. Cabeza, D., Hermenegildo, M.: Distributed WWW Programming using (Ciao-)Prolog and the PiLLoW Library. Theory and Practice of Logic Programming 1(3), 251–282 (2001)

    Article  Google Scholar 

  13. Coelho, J., Florido, M.: XCentric: logic programming for XML processing. In: WIDM 2007: Proceedings of the 9th Annual ACM International Workshop on Web Information and Data Management, pp. 1–8. ACM Press, New York (2007)

    Google Scholar 

  14. Fegaras, L.: HXQ: A Compiler from XQuery to Haskell (2010)

    Google Scholar 

  15. Grinev, M., Pleshachkov, P.: Rewriting-based optimization for XQuery transformational queries. In: 9th International Database Engineering and Application Symposium, IDEAS 2005, pp. 163–174. IEEE Computer Society, Los Alamitos (2005)

    Google Scholar 

  16. Guerra, R., Jeuring, J., Swierstra, S.D.: Generic validation in an XPath-Haskell data binding. In: Proceedings Plan-X (2005)

    Google Scholar 

  17. Hanus, M.: Curry: An Integrated Functional Logic Language (2003), http://www.informatik.uni-kiel.de/~mh/curry/ (version 0.8.2 March 28, 2006)

  18. Hanus, M.: Declarative processing of semistructured web data. Technical report 1103, Christian-Albrechts-Universität Kiel (2011)

    Google Scholar 

  19. Hosoya, H., Pierce, B.C.: XDuce: A Statically Typed XML Processing Language. ACM Transactions on Internet Technology 3(2), 117–148 (2003)

    Article  Google Scholar 

  20. Hutton, G., Meijer, E.: Monadic parsing in Haskell. J. Funct. Program. 8(4), 437–444 (1998)

    Article  MATH  Google Scholar 

  21. Koch, C.: On the role of composition in XQuery. In: Proc. WebDB (2005)

    Google Scholar 

  22. Fraguas, F.J.L., Hernández, J.S.: TOY: A Multiparadigm Declarative System. In: Narendran, P., Rusinowitch, M. (eds.) RTA 1999. LNCS, vol. 1631, pp. 244–247. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  23. Marian, A., Simeon, J.: Projecting XML Documents. In: Proc. of International Conference on Very Large Databases, pp. 213–224. Morgan Kaufmann, Burlington (2003)

    Google Scholar 

  24. May, W.: XPath-Logic and XPathLog: A Logic-Programming Style XML Data Manipulation Language. Theory and Practice of Logic Programming 4(3), 239–287 (2004)

    Article  MathSciNet  MATH  Google Scholar 

  25. Olteanu, D., Meuss, H., Furche, T., Bry, F.: XPath: Looking forward. In: Chaudhri, A.B., Unland, R., Djeraba, C., Lindner, W. (eds.) EDBT 2002. LNCS, vol. 2490, pp. 109–127. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  26. Ronen, R., Shmueli, O.: Evaluation of datalog extended with an XPath predicate. In: Proceedings of the 9th Annual ACM International Workshop on Web Information and Data Management, pp. 9–16. ACM, New York (2007)

    Google Scholar 

  27. Schaffert, S., Bry, F.: A Gentle Introduction to Xcerpt, a Rule-based Query and Transformation Language for XML. In: Proc. of International Workshop on Rule Markup Languages for Business Rules on the Semantic Web. CEUR Workshop Proceedings, vol. 60, p. 22 (2002)

    Google Scholar 

  28. Seibel, P.: Practical Common Lisp. Apress (2004)

    Google Scholar 

  29. Seipel, D.: Processing XML-Documents in Prolog. In: Procs. of the Workshop on Logic Programming 2002, p. 15. Technische Universität Dresden, Dresden (2002)

    Google Scholar 

  30. Sulzmann, M., Lu, K.Z.: XHaskell – adding regular expression types to haskell. In: Chitil, O., Horváth, Z., Zsók, V. (eds.) IFL 2007. LNCS, vol. 5083, pp. 75–92. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  31. Thiemann, P.: A typed representation for HTML and XML documents in Haskell. Journal of Functional Programming 12(4&5), 435–468 (2002)

    MathSciNet  MATH  Google Scholar 

  32. W3C. XML Schema 1.1

    Google Scholar 

  33. W3C. Extensible Markup Language, XML (2007)

    Google Scholar 

  34. W3C. XML Path Language (XPath) 2.0 (2007)

    Google Scholar 

  35. W3C. XQuery 1.0: An XML Query Language (2007)

    Google Scholar 

  36. Wallace, M., Runciman, C.: Haskell and XML: Generic combinators or type-based translation? In: Proceedings of the International Conference on Functional Programming, pp. 148–159. ACM Press, New York (1999)

    Google Scholar 

  37. Walmsley, P.: XQuery. O’Reilly Media, Inc., Sebastopol (2007)

    Google Scholar 

  38. Wielemaker, J.: SWI-Prolog SGML/XML Parser, Version 2.0.5. Technical report, Human Computer-Studies (HCS), University of Amsterdam (March 2005)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2011 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Almendros-Jiménez, J.M., Caballero, R., García-Ruiz, Y., Sáenz-Pérez, F. (2011). XQuery in the Functional-Logic Language Toy. In: Kuchen, H. (eds) Functional and Constraint Logic Programming. WFLP 2011. Lecture Notes in Computer Science, vol 6816. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-22531-4_3

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-22531-4_3

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-22530-7

  • Online ISBN: 978-3-642-22531-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics