Hostname: page-component-77c89778f8-vpsfw Total loading time: 0 Render date: 2024-07-17T13:53:33.811Z Has data issue: false hasContentIssue false

Querying XML documents in logic programming*

Published online by Cambridge University Press:  01 May 2008

J. M. ALMENDROS-JIMÉNEZ
Affiliation:
Dpto. de Lenguajes y Computación, Universidad de Almería (e-mail: jalmen@ual.es, abecerra@ual.es, fjenciso@ual.es)
A. BECERRA-TERÓN
Affiliation:
Dpto. de Lenguajes y Computación, Universidad de Almería (e-mail: jalmen@ual.es, abecerra@ual.es, fjenciso@ual.es)
F. J. ENCISO-BAÑOS
Affiliation:
Dpto. de Lenguajes y Computación, Universidad de Almería (e-mail: jalmen@ual.es, abecerra@ual.es, fjenciso@ual.es)

Abstract

Extensible Markup Language (XML) is a simple, very flexible text format derived from SGML. Originally designed to meet the challenges of large-scale electronic publishing, XML is also playing an increasingly important role in the exchange of a wide variety of data on the Web and elsewhere. XPath language is the result of an effort to provide address parts of an XML document. In support of this primary purpose, it becomes in a query language against an XML document. In this paper we present a proposal for the implementation of the XPath language in logic programming. With this aim we will describe the representation of XML documents by means of a logic program. Rules and facts can be used for representing the document schema and the XML document itself. In particular, we will present how to index XML documents in logic programs: rules are supposed to be stored in main memory, however facts are stored in secondary memory by using two kind of indexes: one for each XML tag, and other for each group of terminal items. In addition, we will study how to query by means of the XPath language against a logic program representing an XML document. It evolves the specialization of the logic program with regard to the XPath expression. Finally, we will also explain how to combine the indexing and the top-down evaluation of the logic program.

Type
Regular Papers
Copyright
Copyright © Cambridge University Press 2008

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

References

Abiteboul, S., Buneman, P. and Suciu, D. 2000. Data on the Web: From Relations to Semistructured Data and XML. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA.Google Scholar
Almendros-Jiménez, J. M., Becerra-Terón, A. and Enciso-Baños, F. J. 2006. Magic sets for the XPath language. Journal of Universal Computer Science 12, 11, 16511678.Google Scholar
Almendros-Jiménez, J. M., Becerra-Terón, A. and Enciso-Baños, F. J. 2007. Integrating XQuery and logic programming. In Proceedings of the Workshop on Logic Programming, University of Würzburg, Würzburg, Germany, 12 pages.Google Scholar
Apt, K. R. 1990. Logic programming. In Handbook of Theoretical Computer Science, Vol. B: Formal Models and Semantics, van Leewen, J., Ed. MIT Press, Massachusetts Institute of Technology, USA, Chapter 10, 493574.Google Scholar
Atanassow, F., Clarke, D. and Jeuring, J. 2004. UUXML: A type-preserving XML schema haskell data binding. In Proc. of Practical Aspects of Declarative Languages. LNCS 3057. Heidelberg, Germany, 71–85.Google Scholar
Bailey, J., Bry, F., Furche, T. and Schaffert, S. 2005. Web and semantic web query languages: A survey. In Proc. of Reasoning Web, First International Summer School, LNCS 3564. Heidelberg, Germany, 35–133.Google Scholar
Baumgartner, R., Flesca, S. and Gottlob, G. 2001. The elog web extraction language. In Proc. of International Conference on Logic for Programming, Artificial Intelligence, and Reasoning, LNCS 2250. Heidelberg, Germany, 548–560.Google Scholar
Benzaken, V., Castagna, G. and Frish, A. 2005. CDuce: An XML-centric general-purpose language. In Proc. of the ACM SIGPLAN International Conference on Functional Programming. ACM Press, New York, USA, 51–63.Google Scholar
Berners-Lee, T., Hendler, J. and Lassila, O. 2001. The semantic web – A new form of Web content that is meaningful to computers will unleash a revolution of new possibilities. Scientic American May, 36 pages.Google Scholar
Boley, H. 2000a. Relationships between logic programming and RDF. In Proc. of Advances in Artificial Intelligence, LNCS 2112. Heidelberg, Germany, 201–218.Google Scholar
Boley, H. 2000b. Relationships between logic programming and XML. In Proc. of the Workshop on Logic Programming, GMD Report 90. Würzburg, Germany, 19–34.Google Scholar
Boley, H. 2001. The rule markup language: RDF-XML data model, XML schema hierarchy, and XSL transformations. In Proc. of International Conference on Applications of Prolog. Prolog Association of Japan, Tokyo, Japan, 124–139.Google Scholar
Boncz, P. A., Grust, T., van Keulen, M., Manegold, S., Rittinger, J. and Teubner, J. 2005. Pathfinder: XQuery - the relational way. In Proc. of the International Conference on Very Large Databases. ACM Press, New York, USA, 1322–1325.Google Scholar
Borgida, A. 1996. On the relative expressiveness of description logics and predicate logics. Artificial Intelligence 82, 1-2, 353367.Google Scholar
Bry, F. and Schaffert, S. 2002a. The XML query language Xcerpt: Design principles, examples, and semantics. In Proc. of Web, Web-Services, and Database Systems, LNCS 2593. Heidelberg, Germany, 295–310.Google Scholar
Bry, F. and Schaffert, S. 2002b. Towards a declarative query and transformation language for XML and semistructured data: Simulation unification. In Proc. of International Conference on Logic Programming, LNCS 2401. Heidelberg, Germany, 255–270.Google Scholar
Cabeza, D. and Hermenegildo, M. 2001. Distributed WWW Programming using (Ciao-) prolog and the PiLLoW library. Theory and Practice of Logic Programming 1, 3, 251282.Google Scholar
Chamberlin, D. 2002. XQuery: An XML query language. IBM Systems Journal 41, 4, 597615.Google Scholar
Chamberlin, D., Draper, D., Fernández, M., Kay, M., Robie, J., Rys, M., Simeon, J., Tivy, J. and Wadler, P. 2004. XQuery from the experts. Addison Wesley, Boston, USA.Google Scholar
Coelho, J. and Florido, M. 2003. Type-based XML processing in logic programming. In Proc. of the International Symposium on Practical Aspects of Declarative Languages, LNCS 2562. Heidelberg, Germany, 273–285.Google Scholar
Coelho, J. and Florido, M. 2004. CLP(Flex): Constraint logic programming applied to XML processing. In Proceedings of the CoopIS/DOA/ODBASE, LNCS 3291. Heidelberg, Germany, 1098–1112.Google Scholar
Decker, S., Melnik, S., Harmelen, F. V., Fensel, D., Klein, M. C. A., Broekstra, J., Erdmann, M. and Horrocks, I. 2000. The Semantic Web: The Roles of XML and RDF. IEEE Internet Computing 4, 5, 6374.Google Scholar
Fernández, M. and Simeon, J. 2003. Growing XQuery. In Proc. of the Object-Oriented Programming, European Conference, LNCS 2743. Heidelberg, Germany, 405–430.Google Scholar
Fernández, M., Simeon, J. and Wadler, P. 2000. An algebra for XML query. In Proc. of Foundation of Software Technology and Theoretical Computer Science, LNCS 1974. Heidelberg, Germany, 11–45.Google Scholar
Grosof, B. N., Horrocks, I., Volz, R. and Decker, S. 2003. Description logic programs: Combining logic programs with description logic. In Proc. of the International Conference on World Wide Web. ACM Press, USA, 48–57.Google Scholar
Horrocks, I. and Patel-Schneider, P. F. 2004. A Proposal for an OWL rules language. In Proc. of International Conference on World Wide Web. ACM Press, New York, USA, 723–731.Google Scholar
Hosoya, H. and Pierce, B. C. 2003. XDuce: A statically typed XML processing language. ACM Transactions on Internet Technology 3, 2, 117148.Google Scholar
Marian, A. and Simeon, J. 2003. Projecting XML documents. In Proc. of International Conference on Very Large Databases. Morgan Kaufmann, Burlington, USA, 213–224.Google Scholar
May, W. 2004. XPath-Logic and XPathLog: A logic-programming style XML data manipulation language. Theory and Practice of Logic Programming 4, 3, 239287.Google Scholar
O'Neil, P., O'Neil, E., Pal, S., Cseri, I., Schaller, G. and Westbury, N. 2004. OrdPaths: Insert-friendly XML node labels. In Proc. of the ACM SIGMOD Conference. ACM Press, New York, USA, 903–908.Google Scholar
Rémy, D. 2002. Applied Semantics: Advanced Lectures, LNCS 2395. Heidelberg, Germany. Chapter Using, Understanding, and Unraveling the OCaml Language. From Practice to Theory and Vice Versa, 115–137.Google Scholar
Schaffert, S. and Bry, F. 2002. 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 60, Aachen, Germany, 22 pages.Google Scholar
Seipel, D. 2002. Processing XML-documents in Prolog. In Procs. of the Workshop on Logic Programming 2002. Technische Universität Dresden, Dresden, Germany, 15 pages.Google Scholar
Simeon, J. and Wadler, P. 2003. The essence of XML. In Proc. of SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM Press, New York, USA, 1–13.Google Scholar
Tatarinov, I., Viglas, S. D., Beyer, K., Shanmugasundaram, J., Shekita, E. and Zhang, C. 2002. Storing and querying ordered XML using a relational database system. In Proc. of the ACM SIGMOD Conference. ACM Press, New York, USA, 204–215.Google Scholar
Thiemann, P. 2002. A typed representation for HTML and XML documents in Haskell. Journal of Functional Programming 12, 4&5, 435468.Google Scholar
W3C. 2001. XML Schema 1.0. Tech. rep., www.w3.org.Google Scholar
W3C. 2004a. OWL Ontology Web Language. Tech. rep., www.w3.org.Google Scholar
W3C. 2004b. Resource Description Framework (RDF). Tech. rep., www.w3.org.Google Scholar
W3C. 2007a. Extensible Markup Language (XML). Tech. rep., www.w3c.org.Google Scholar
W3C. 2007b. XML Path Language (XPath) 2.0. Tech. rep., www.w3.org.Google Scholar
W3C. 2007c. XML Query Working Group and XSL Working Group, XQuery 1.0: An XML Query Language. Tech. rep., www.w3.org.Google Scholar
Wadler, P. 2002. XQuery: A typed functional language for querying XML. In Advanced Functional Programming, International School, LNCS 2638. Heidelberg, Germany, 188–212.Google Scholar
Wallace, M. and Runciman, C. 1999. Haskell and XML: Generic combinators or type-based translation? In Proceedings of the International Conference on Functional Programming. ACM Press, New York, USA, 148–159.Google Scholar
Wielemaker, J. 2005. SWI-Prolog SGML/XML Parser, Version 2.0.5. Tech. rep., Human Computer-Studies (HCS), University of Amsterdam. March.Google Scholar
Wolz, R. 2004. Web Ontology Reasoning with Logic Databases. Ph.D. thesis, Universität Fridericiana zu Karlsruhe.Google Scholar