Integrating XPath with the Functional-Logic Language Toy

  • Rafael Caballero
  • Yolanda García-Ruiz
  • Fernando Sáenz-Pérez
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6539)


This paper presents a programming framework for incorporating XPath queries into the functional-logic language \(\mathcal{TOY}\). The proposal exploits the language characteristics, including non-determinism, logic variables, and higher-order functions and patterns. Our setting covers a wide range of standard XPath axes and tests. In particular reverse axes are implemented thanks to the double nature of XPath queries, which are both higher-order functions and data terms in our setting. The combination of these two different worlds, the functional-logic paradigm and the XML query language XPath, is very enriching for both of them. From the point of view of functional-logic programming, the language is now able to deal with XML documents in a very simple way. From the point of view of XPath, our approach presents several nice properties as the generation of XML test-cases for XPath queries, which can be useful for finding bugs in erroneous queries.


Functional-Logic Programming Non-Deterministic Functions XPath Queries Higher-Order Patterns 


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.
    Caballero, R., García-Ruiz, Y., Sáenz-Pérez, F.: Integrating XPath with the Functional-Logic Language Toy (Extended Version). Technical Report SIP-05/10, Facultad de Informática, Universidad Complutense de Madrid (2010),
  3. 3.
    Caballero, R., López-Fraguas, F.J.: A functional-logic perspective on parsing. In: Middeldorp, A. (ed.) FLOPS 1999. LNCS, vol. 1722, pp. 85–99. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  4. 4.
    Guerra, R., Jeuring, J., Swierstra, S.D.: Generic validation in an XPath-Haskell data binding. In: Proceedings Plan-X (2005)Google Scholar
  5. 5.
    Hanus, M.: Curry: An Integrated Functional Logic Language (version 0.8.2) (March 28, 2006), (2003)
  6. 6.
    Huet, G.: The zipper. J. Funct. Program. 7(5), 549–554 (1997)MathSciNetCrossRefzbMATHGoogle Scholar
  7. 7.
    Hutton, G., Meijer, E.: Monadic parsing in Haskell. J. Funct. Program. 8(4), 437–444 (1998)CrossRefzbMATHGoogle Scholar
  8. 8.
    López-Fraguas, F.J., 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)CrossRefGoogle Scholar
  9. 9.
    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
  10. 10.
    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)CrossRefGoogle Scholar
  11. 11.
    W3C. XML Schema 1.1Google Scholar
  12. 12.
    W3C. Extensible Markup Language, XML (2007)Google Scholar
  13. 13.
    W3C. XML Path Language (XPath) 2.0 (2007)Google Scholar
  14. 14.
    W3C. XQuery 1.0: An XML Query Language (2007)Google Scholar
  15. 15.
    Walmsley, P.: XQuery. O’Reilly Media, Inc., Sebastopol (2007)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Rafael Caballero
    • 1
  • Yolanda García-Ruiz
    • 1
  • Fernando Sáenz-Pérez
    • 2
  1. 1.Departamento de Sistemas Informáticos y ComputaciónUniversidad Complutense de MadridSpain
  2. 2.Departamento de Ingeniería del Software e Inteligencia ArtificialUniversidad Complutense de MadridSpain

Personalised recommendations