Graph Queries in a Next-Generation Datalog System

Graph Queries in a Next-Generation Datalog System

Graph Queries in a Next-Generation Datalog System Alexander Shkapsky Kai Zeng Carlo Zaniolo University of California, University of California, University of California, Los Angeles Los Angeles Los Angeles [email protected] [email protected] [email protected] ABSTRACT The excitement with these new developments should not Recent theoretical advances have enabled the use of special make us overlook the limitations and problems that have monotonic aggregates in recursion. These special aggregates impaired the power and generality of Datalog in the past{ make possible the concise expression and efficient implemen- problems that were clearly identified and motivated classi- tation of a rich new set of advanced applications. Among cal Datalog research [17, 19, 8, 15, 12, 16]. These seminal these applications, graph queries are particularly important works have recognized a key problem as that of supporting because of their pervasiveness in data intensive application aggregates in recursion, which are needed to support effi- areas. In this demonstration, we present our Deductive Ap- ciently many applications, including graph queries. Many plication Language (DeAL) System, the first of a new gen- graph queries require recursive aggregation to compute an eration of Deductive Database Systems that support appli- aggregate value for a vertex based on an aggregate value pro- cations that could not be expressed using regular stratifi- duced earlier for connected vertices. For example, PageRank cation, or could be expressed using XY-stratification (also iteratively calculates the probability for a document being supported in DeAL) but suffer from inefficient execution. visited by aggregating the transition probability for those Using example queries, we will (i) show how complex graph documents linking to the document. queries can be concisely expressed using DeAL and (ii) il- The previous solutions proposed were quite limited in lustrate the formal semantics and efficient implementation their scope, and to the best of our knowledge, they were not of these powerful new monotonic constructs. supported in any Datalog system, forcing programmers to hand-code and manually tune procedural implementations. Even when expressed in XY-stratified rules [4], recursive 1. INTRODUCTION programs with aggregates suffer from inefficient query eval- The recent revival of interest in Datalog [5] is driven by uation performance. In this springtime for Datalog, a more various developments that include the emergence of natural general theory has sprouted to life [14], providing the formal application areas, such as computer networking [13], paral- basis for the very practical language and system extensions lel and distributed programming [10], and distributed data that are the focus of our demo. Space constraints force us to management [2], and the success of industrial-strength sys- limit this presentation to a general overview, whereas details tems [9]. Additional drivers have been Datalog's uses in (i) and formal proofs are given in [14]. In this paper, we present our Deductive Application Lan- advanced computational and semantic models [10, 7], (ii) 2 the Big Data problem [3, 6], and (iii) Data Stream Manage- guage (DeAL) System , a next-generation Datalog system ment Systems [18]. Due to space limitations, this is a very we have developed at UCLA, building on earlier Deductive incomplete list, which does not mention many significant Database technology [4]. DeAL supports negation, built-in contributions from the past, and the many new contribu- and user defined aggregates, and non-monotonic aggregation tions that are emerging now, i.e., in a time that has been via XY-stratification, and more importantly, the new mono- described with terms such as `resurgence' [5], `springtime' tonic aggregate extensions discussed in Section 2. With sup- [10] and `renaissance' [1] for Datalog1. port for many powerful constructs, a wide range of complex applications can be declaratively expressed and executed ef- 1The last term is actually the most fitting, since the Renais- ficiently in our system. In this demonstration, we focus on sance is the era that, after the `dark ages', revived arts and DeAL's support for graph queries due to their data inten- sciences, producing accomplishments that outshined and sive nature and importance in several application domains, outlasted even the glorious ones of classical times. including the web, social networks and computer networks. We show how DeAL's monotonic aggregate syntax for recur- sive rules is natural and allows for the expression of powerful, Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are yet elegant graph queries. not made or distributed for profit or commercial advantage and that copies In the following section, we will review our monotonic bear this notice and the full citation on the first page. To copy otherwise, to aggregate extensions supported in DeAL. Section 3 provides republish, to post on servers or to redistribute to lists, requires prior specific an overview of the DeAL System architecture. Section 4 permission and/or a fee. Articles from this volume were invited to present presents example advanced applications. Section 5 describes their results at The 39th International Conference on Very Large Data Bases, our demonstration and we conclude in section 6. August 26th - 30th 2013, Riva del Garda, Trento, Italy. Proceedings of the VLDB Endowment, Vol. 6, No. 12 2 Copyright 2013 VLDB Endowment 2150-8097/13/10... $ 10.00. http://wis.cs.ucla.edu/deals 1258 2. MONOTONIC AGGREGATES semantics of the seminaive fixpoint iteration, we see that be- DeAL supports the standard SQL aggregates and user- cause of the final max aggregate used in the actualDays only defined aggregates. These are non-monotonic aggregates maxima are of interest for each part, and lesser values can (w.r.t. set containment) and therefore can only be used be discarded during the recursive computation. This max- in stratified programs, i.e., with the same constraints regu- based optimization is applicable whenever the function used lating the use of negation in programs. DeAL also supports in the body to compute the fsmax argument is monotonically XY-stratification that is a form of explicit (i.e., compile-time increasing for positive numbers. In the example at hand this recognizable) local stratification that was first introduced is trivially true, since Days is transferred from the body to by LDL++ [4] and recently proved quite useful in the par- the head by the identity function, but the same would be allelization of advanced analytics in MapReduce distributed true, if e.g., the argument of fsmax in the head is Days in execution environments [6]. The important novelty of DeAL the body multiplied by a positive constant. Therefore with however is that it introduces the two monotonic aggregates fsmax used in recursion, both the declarative semantics of fsmax and fscnt that can be used freely in recursive defini- Datalog and its efficient implementation are preserved. tions. The formal semantics of these two aggregates is based As discussed in [14] the fsmax aggregate can be used on on the DatalogFS work which proved that a least-fixpoint arbitrary positive numbers not just integers. For instance, semantics, and its equivalent unique minimal model seman- the following program computes the maximum probability tics, exist for these [14]. Given that their formal seman- path between two nodes in a network where net(X; Y; P) de- tics has already received in-depth treatment [14], we will notes the probability of reaching Y starting from X is P. next concentrate on their intuitive appeal and expressivity, through a variety of examples, and then describe the basics Example 2. Max Probability Path of their efficient implementation. These topics are the focus reach(X; Y; fsmaxhPi) net(X; Y; P): of discussion for our demonstration. reach(X; Z; fsmaxhPi) reach(X; Y; P1); reach(Y; Z; P2); P = P1 ∗ P2: 2.1 The fsmax Aggregate maxP(X; Y; maxhPi) reach(X; Y; P): We present the fsmax construct through an example using Bill of Materials (BOM), a classical recursive application for This program uses quadratic rules as in Floyd's shortest- traditional Database Management Systems. In BOM, the path algorithm, but linear rules would also be sufficient. database contains a large set of assbl(Part; Subpart; Qty) With regards to Floyd's algorithm, this can also be ex- facts which describe how a given part is assembled using pressed in DeAL, but since we only support maxima, the various subparts, each in a given quantity. Not all subparts inverses of the costs of the arcs was actually used in the are assembled, basic parts are instead supplied by exter- computation to find shortest paths [14]. nal suppliers in a given number of days, as per the facts basic(Part; Days): Simple assemblies, such as bicycles, can 2.2 The Continuous fscnt Aggregate be put together the very same day in which the last basic This monotonic construct performs a continuous count of part arrives. Thus, the time needed to deliver a bicycle is the number of distinct occurrences and allows us to express the maximum of the number of days that the various basic many queries that could not be expressed efficiently, or could parts require to arrive. not be expressed at all, in Datalog with stratified negation or aggregates. For instance, the following query that counts the Example 1. How many days until delivery? paths between nodes in a directed graph was not expressible delivery(Part; fsmaxhDaysi) basic(Part; Days): in Datalog with stratified aggregates [16]. delivery(Part; fsmaxhDaysi) assbl(Part; Sub; ); delivery(Sub; Days): Example 3. Counting Paths actualDays(Part; maxhDaysi) delivery(Part; Days): cpaths(X; Y; fscnthXi) arc(X; Y): We use the notation for aggregates that is used in LDL++ cpaths(X; Z; fscnth(Y; C)i) cpaths(X; Y; C); arc(Y; Z): [4], and thus max denotes the usual non-monotonic aggregate maxC(X; Z; maxhCi) cpaths(X; Z; C): that can also be expressed using negation.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    4 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us