Package Builder is a system that extends query engines to support package generation. A package is a collection of tuples with certain global properties defined on the collection as a whole.


  • Meal Planner:

    An athlete needs to put together a dietary plan in preparation for a race. She wants a high-protein set of three meals for the day, that are between 2000 and 2500 calories in total. All meals should be gluten-free. It is easy to exclude meals that include gluten, as this condition can be checked for each meal (tuple) individually with a regular selection predicate. Other constraints need to be verified collectively over the entire package.

  • Investment Portfolio:

    A broker wants to construct an investment portfolio for one of her clients. The client has a budget of $50K, wants to invest at least 30% of the assets in technology, and wants a balance of short-term and long-term options. The broker cannot select each stock option individually, but rather needs to find a stock package that satisfies all these constraints collectively.

VLDB 2020 Talk : Best Demonstration Award

Don't existing DBMSs support package queries already?

With existing query languages, users can easily express base constraints, i.e., constraints that apply to every tuple in the query result. Global constraints are properties that a set of tuples satisfy as a whole. Unfortunately, these types of constraints are largely disregarded by traditional DBMSs and their query languages. Therefore, supporting them is a burden on the application level, rather than, as it should, on the database level.

PaQL — The Package Query Language

Meal Planner example:

SELECT      PACKAGE(✱) AS MealPlan
FROM        Recipes R REPEAT 0
WHERE       R.gluten-free = 'TRUE'
            COUNT(*) = 3 AND
            SUM(calories) BETWEEN 2000 AND 2500 AND
            (SELECT COUNT(*) FROM MealPlan WHERE carbs > 0) >= COUNT(*)/2
MAXIMIZE    SUM(protein)

sPaQL — The Stochastic Package Query Language

We must often make decisions in the face of uncertain data. Probabilistic databases excel at modeling and managing uncertainty. We offer stochastic optimization within a probabilistic database, close to the data.

Portfolio Optimization example:

SELECT      PACKAGE(✱) AS Portfolio
FROM        Stock_Investments R REPEAT 5
            SUM(price) <= 1000 AND
            SUM(Gain) <= -10 WITH PROBABILITY <= 0.05

Interface Abstractions

Packages queries are more complex, semantically and algorithmically, compared to traditional database queries, and they pose challenges on several fronts. They can have complex specifications and they are hard to process by users given the large volume of results. Our package template abstraction encodes package specifications in a familiar tabular format. The system presents result packages to users in a way that allows them to meaningfully view the entire package space. Furthermore, PackageBuilder allows users to easily navigate the package space and to instruct the system about which constraints should be taken into account.

Here's a screenshot example of our package template abstraction (click on it to download the full-sized version):





Our code is publicly available, without guarantees, under MIT License here.


This work is or has been supported by: the National Science Foundation under grants IIS-1421322, IIS-1420941, IIS-1453543 and IIS-1943971; the NYUAD Center for Interacting Urban Networks (CITIES); Tamkeen under the NYUAD Research Institute Award CG001; the Swiss Re Institute under the Quantum Cities initiative.