A Declarative Embedding of XQuery in a Functional-Logic Language

  • Jesús M. Almendros-Jiménez
  • Rafael Caballero
  • Yolanda García-Ruiz
  • Fernando Sáenz-Pérez
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7225)


This paper addresses the problem of integrating a fragment of XQuery, a language for querying XML documents, into the functional-logic language \(\mathcal{TOY}\). The queries are evaluated by an interpreter, and the declarative nature of the proposal allows us to prove correctness and completeness with respect to the semantics of the subset of XQuery considered. The different fragments of XML that can be produced by XQuery expressions are obtained using the non-deterministic features of functional-logic languages. As an application of this proposal we show how the typical generate and test techniques of logic languages can be used for generating test-cases for XQuery expressions.


Operational Semantic Logic Language XPath Expression Strict Equality Declarative Nature 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    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)CrossRefGoogle Scholar
  2. 2.
    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),
  3. 3.
    Baader, F., Nipkow, T.: Term Rewriting and All That. Cambridge University Press (1999)Google Scholar
  4. 4.
    Benedikt, M., Koch, C.: From XQuery to relational logics. ACM Trans. Database Syst. 34, 25:1–25:48 (2009)CrossRefGoogle Scholar
  5. 5.
    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)CrossRefGoogle Scholar
  6. 6.
    Fegaras, L.: Propagating updates through XML views using lineage tracing. In: IEEE 26th International Conference on Data Engineering (ICDE), pp. 309–320 (March 2010)Google Scholar
  7. 7.
    González-Moreno, J., Hortalá-González, M., López-Fraguas, F., Rodríguez-Artalejo, M.: A Rewriting Logic for Declarative Programming. In: Riis Nielson, H. (ed.) ESOP 1996. LNCS, vol. 1058, pp. 156–172. Springer, Heidelberg (1996)CrossRefGoogle Scholar
  8. 8.
    Hanus, M.: Curry: An Integrated Functional Logic Language (version 0.8.2 March 28, 2006) (2003),
  9. 9.
    Hanus, M.: Declarative processing of semistructured web data. Technical report 1103, Christian-Albrechts-Universität Kiel (2011)Google Scholar
  10. 10.
    Hanus, M., Steiner, F.: Controlling Search in Declarative Programs. In: Palamidessi, C., Meinke, K., Glaser, H. (eds.) ALP 1998 and PLILP 1998. LNCS, vol. 1490, pp. 374–390. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  11. 11.
    Fraguas, F.J.L., Hernández, J.S.: \(\mathcal{TOY}\): A Multiparadigm Declarative System. In: Narendran, P., Rusinowitch, M. (eds.) RTA 1999. LNCS, vol. 1631, pp. 244–247. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  12. 12.
    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)CrossRefGoogle Scholar
  13. 13.
    Seipel, D., Baumeister, J., Hopfner, M.: Declaratively Querying and Visualizing Knowledge Bases in Xml. In: Seipel, D., Hanus, M., Geske, U., Bartenstein, O. (eds.) INAP/WLP 2004. LNCS (LNAI), vol. 3392, pp. 16–31. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  14. 14.
    Shapiro, E.: Algorithmic Program Debugging. ACM Distiguished Dissertation. MIT Press (1982)Google Scholar
  15. 15.
    W3C. Extensible Markup Language (XML) (2007)Google Scholar
  16. 16.
    W3C. XML Path Language (XPath) 2.0 (2007)Google Scholar
  17. 17.
    W3C. XML Query Use Cases (2007),
  18. 18.
    W3C. XQuery 1.0: An XML Query Language (2007)Google Scholar
  19. 19.
    W3C. XQuery 1.0 and XPath 2.0 Formal Semantics, 2nd edn. (2010),
  20. 20.
    Walmsley, P.: XQuery. O’Reilly Media, Inc. (2007)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Jesús M. Almendros-Jiménez
    • 1
  • Rafael Caballero
    • 2
  • Yolanda García-Ruiz
    • 2
  • Fernando Sáenz-Pérez
    • 3
  1. 1.Dpto. Lenguajes y ComputaciónUniversidad de AlmeríaSpain
  2. 2.Dpto. de Sistemas Informáticos y ComputaciónUCMSpain
  3. 3.Dpto. de Ingeniería del Software e Inteligencia ArtificialUCMSpain

Personalised recommendations