User Defined Indexing

  • David Vaz
  • Vítor Santos Costa
  • Michel Ferreira
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5649)


Logic programming provides an ideal framework for tackling complex data, such as the multi-dimensional vector-based data used to represent spatial databases. Unfortunately, the usefulness of logic programming systems if often hampered by the fact that most of these systems have to rely on a single unification-based mechanism as the only way to search in the database. While unification can usually take effective advantage of hash-based indexing, it is often the case that queries over more complex and structured data, such as the vectorial terms stored in spatial databases, cannot.

We propose a new extension to Prolog indexing: User Defined Indexing (UDI). In this mechanism, the programmer may add extra information to Prolog indices so that only interesting fragments of the database will be selected. UDI provides a general extension of indexing, and can be used for both instantiated and constrained variables. As a test case, we demonstrate how UDI can be combined with a constraint system to provide an elegant and efficient mechanism to generate and execute range queries and spatial queries. Experimental evaluation shows that this mechanism can achieve orders of magnitude speedups on non-trivial datasets.


Logic Program Logic Programming Hash Table Range Query Spatial Database 
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.
    Warren, D.H.D.: Implementing Prolog - Compiling Predicate Logic Programs. Technical Report 39 and 40, Department of Artificial Intelligence, University of Edinburgh (1977)Google Scholar
  2. 2.
    Warren, D.H.D.: An Abstract Prolog Instruction Set. Technical Note 309, SRI International (1983)Google Scholar
  3. 3.
    Hermenegildo, M., Bueno, F., Puebla, G.: The CIAO multi-dialect compiler and system: An experimentation workbench for future (C) LP systems. In: Parallelism and Implementation of Logic and Constraint Logic Programming (1999)Google Scholar
  4. 4.
    Puebla, G., Stuckey, P.: Optimization of logic programs with dynamic scheduling. In: Logic Programming: Proceedings of the Fourteenth International Conference on Logic Programming, MIT Press, Cambridge (1997)Google Scholar
  5. 5.
    Demoen, B., Mariën, A., Callebaut, A.: Indexing prolog clauses. In: NACLP, pp. 1001–1012 (1989)Google Scholar
  6. 6.
    Wielemaker, J.: SWI-Prolog 5.5: Reference Manual. SWI, University of Amsterdam, Roetersstraat 15, 1018 WB Amsterdam, The Netherlands (2008)Google Scholar
  7. 7.
    Santos Costa, V., Sagonas, K., Lopes, R.: Demand-driven indexing of prolog clauses. In: Dahl, V., Niemelä, I. (eds.) ICLP 2007. LNCS, vol. 4670, pp. 395–409. Springer, Heidelberg (2007)Google Scholar
  8. 8.
    Comer, D.: The ubiquitous b-tree. ACM Comput. Surv. 11(2), 121–137 (1979)MathSciNetCrossRefzbMATHGoogle Scholar
  9. 9.
    Guttman, A.: R-trees: A dynamic index structure for spatial searching. In: Yormark, B. (ed.) SIGMOD 1984, Proceedings of Annual Meeting, Boston, Massachusetts, June 18-21, pp. 47–57. ACM Press, New York (1984)Google Scholar
  10. 10.
    The Postgis Development Team: Postgis adds support for geographic objects to the postgresql object-relational database,
  11. 11.
    Revesz, P.: Introduction to constraint databases. Springer, New York (2002)zbMATHGoogle Scholar
  12. 12.
    Chen, W., Kifer, M., Warren, D.S.: Hilog: A foundation for higher-order logic programming. J. Log. Program. 15(3), 187–230 (1993)MathSciNetCrossRefzbMATHGoogle Scholar
  13. 13.
    Demoen, B.: Dynamic attributes, their hprolog implementation, and a first evaluation. Technical report, Department of Computer Science, K.U.Leuven, Leuven, Belgium (2002)Google Scholar
  14. 14.
    Vaz, D., Ferreira, M., Lopes, R.: Spatial-yap: A logic-based geographic information system. In: Dahl, V., Niemelä, I. (eds.) ICLP 2007. LNCS, vol. 4670, pp. 195–208. Springer, Heidelberg (2007)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2009

Authors and Affiliations

  • David Vaz
    • 1
  • Vítor Santos Costa
    • 2
  • Michel Ferreira
    • 3
  1. 1.LIACC - DCC/FCUPUniversity of PortoPortugal
  2. 2.CRACS - DCC/FCUPUniversity of PortoPortugal
  3. 3.Instituto de Telecomunicações - DCC/FCUPUniversity of PortoPortugal

Personalised recommendations