Low complexity aggregation in graphlog and Datalog

  • Mariano P. Consens
  • Alberto O. Mendelzon
Logic And Databases
Part of the Lecture Notes in Computer Science book series (LNCS, volume 470)

Abstract

We present facilities for computing aggregate functions over sets of tuples and along paths in a database graph.

We show how Datalog can be extended to compute a large class of queries with aggregates without incurring the large expense of a language with general set manipulation capabilities. In particular, we aim for queries that can be executed efficiently in parallel, using the class nc and its various subclasses as formal models of low parallel complexity.

Our approach retains the standard relational notion of relations as sets of tuples, not requiring the introduction of multisets. For the case where no rules are recursive, the language is exactly as expressive as Klug's first order language with aggregates. We show that this class of non-recursive programs cannot express transitive closure (unless logspace=nlogspace), thus providing evidence for a widely believed but never proven folk result. We also study the expressive power and complexity of languages that support aggregation over recursion.

We then describe how these facilities, as well as manipulating the length of paths in database graphs, are incorporated into our visual query language GraphLog. While GraphLog could easily be extended to handle all the queries described above, we prefer to restrict the language in a natural way to avoid explicit recursion; all recursion is expressed as transitive closure. We show that this guarantees all expressible queries are in nc. We analyze other proposals and show that they can express queries that are logspace-complete for p and thus unlikely to be parallelizable efficiently.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [AB88]
    Serge Abiteboul and Catriel Beeri. On the power of languages for the manipulation of complex objects. Technical Report 846, INRIA, May 1988.Google Scholar
  2. [ADJ88]
    R. Agrawal, S. Dar, and H.V. Jagadish. On transitive closure problems involving path computations. Technical report, AT&T Bell Laboratories, 1988.Google Scholar
  3. [Agr87]
    R. Agrawal. Alpha: an extension of relational algebra to express a class of recursive queries. In Proc. IEEE 3rd. International Conference on Data Engineering, pages 580–590, 1987.Google Scholar
  4. [CM89]
    Mariano Consens and Alberto Mendelzon. Expressing structural hypertext queries in GraphLog. In Proceedings of the Second ACM Hypertext Conference, pages 269–292, 1989.Google Scholar
  5. [CM90a]
    Mariano Consens and Alberto Mendelzon. The G+/GraphLog visual query system. In Proceedings of the ACM-SIGMOD 1990 Annual Conference on Management of Data, page 388, 1990. Video presentation summary.Google Scholar
  6. [CM90b]
    Mariano Consens and Alberto Mendelzon. GraphLog: a visual formalism for real life recursion. In Proceedings of the Ninth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems, pages 404–416, 1990.Google Scholar
  7. [CMW88]
    I.F. Cruz, A.O. Mendelzon, and P.T. Wood. G+: Recursive queries without recursion. In Proceedings of the Second International Conference on Expert Database Systems, pages 355–368, 1988.Google Scholar
  8. [CN89]
    Isabel Cruz and Theodore Norvell. Aggregative closure: An extension of transitive closure. In Proc. IEEE 5th International Conference on Data Engineering, pages 384–391, 1989.Google Scholar
  9. [Con89]
    Mariano P. Consens. Graphlog: “real life” recursive queries using graphs. Master's thesis, Department of Computer Science, University of Toronto, 1989.Google Scholar
  10. [Coo80]
    Eric C. Cooper. On the expressive power of query languages for relational databases. Technical Report TR-14-80, Aiken Computation Lab., Harvard University, 1980.Google Scholar
  11. [Coo85]
    Stephen A. Cook. A taxonomy of problems with fast parallel algorithms. Information and Control, 64(1–3):2–22, 1985.CrossRefGoogle Scholar
  12. [Cru87]
    Isabel Cruz. G+: A graphical system for recursive queries. Master's thesis, Dept. of Computer Science, University of Toronto, 1987.Google Scholar
  13. [DS86]
    U. Dayal and J.M. Smith. Probe: A knowledge-oriented database management system. In Michel L. Brodie and John Mylopoulos, editors, On knowledge base management systems, pages 227–257. Springer-Verlag, 1986.Google Scholar
  14. [GJ79]
    M.R. Garey and D.S. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness. W.H. Freeman and Co., New York, 1979.Google Scholar
  15. [GPG90]
    Marc Gyssens, Jan Paredaens, and Dirk Van Gucht. A graph-oriented object database model. In Proceedings of the Ninth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems, pages 417–424, 1990.Google Scholar
  16. [Imm87]
    Neil Immerman. Languages that capture complexity classes. SIAM Journal on Computing, 16(4):760–778, 1987.Google Scholar
  17. [Imm88]
    Neil Immerman. Expressibility and parallel complexity. Technical report, Department of Computer Science, Yale University, 1988.Google Scholar
  18. [IR88]
    Y.E. Ioannidis and R. Ramakrishnan. Efficient transitive closure algorithms. Technical Report 765, Computer Sciences, Univ. of Wisconsin-Madison, 1988.Google Scholar
  19. [Kan88]
    P.C. Kanellakis. Logic programming and parallel complexity. In J. Minker, editor, Foundations of Deductive Databases and Logic Programming, pages 547–586. Morgan Kaufmann Publishers, Inc., 1988.Google Scholar
  20. [Klu82]
    Anthony Klug. Equivalence of relational algebra and relational calculus query languages having aggregate functions. Journal of the ACM, 29(3):699–717, 1982.Google Scholar
  21. [KP87]
    P. G. Kolaitis and C.H. Papadimitriou. Why not negation by fixpoint? In Proceedings of the Sixth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems, pages 231–239, 1987.Google Scholar
  22. [Kup87]
    G.M. Kuper. Logic programming with sets. In Proceedings of the Sixth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems, pages 11–20, 1987.Google Scholar
  23. [MPR90]
    Inderpal Mumick, Hamid Pirahesh, and Raghu Ramakrishnan. The magic of duplicates and aggregates. In Proceedings of the Sixteenth International Conference on Very Large Data Bases, 1990. To appear.Google Scholar
  24. [OOM87]
    G. Ozsoyoglu, Z.M. Ozsoyoglu, and V. Matos. Extending relational algebra and relational calculus with set-valued attributes and aggregate functions. ACM Transactions on Data Base Systems, 12(4):566–592, 1987.Google Scholar
  25. [RHDM86]
    A. Rosenthal, S. Heiler, U. Dayal, and F. Manola. Traversal recursion: A practical approach to supporting recursive applications. In Proceedings of the ACM-SIGMOD 1986 Annual Conference on Management of Data, pages 166–176, 1986.Google Scholar
  26. [She90]
    Yeh-Heng Sheng. IDLOG: Extending the expressive power of deductive database languages. In Proceedings of the ACM-SIGMOD 1990 Annual Conference on Management of Data, pages 54–63, 1990.Google Scholar
  27. [TZ86]
    S. Tsur and C. Zaniolo. LDL: a logic-based data-language. In Proceedings of the Twelve International Conference on Very Large Data Bases, pages 33–41, 1986.Google Scholar
  28. [Ull88]
    J.D. Ullman. Principles of Database and Knowledge-Base Systems, volume 1. Computer Science Press, Potomac, Md., 1988.Google Scholar
  29. [Ull89]
    J.D. Ullman. Principles of Database and Knowledge-Base Systems, volume 2. Computer Science Press, Potomac, Md., 1989.Google Scholar

Copyright information

© Springer-Verlag 1990

Authors and Affiliations

  • Mariano P. Consens
    • 1
  • Alberto O. Mendelzon
    • 1
  1. 1.Computer Systems Research InstituteUniversity of TorontoTorontoCanada

Personalised recommendations