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.

Examples

  • 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.

  • 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.

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

An example:


SELECT      PACKAGE(R) AS P
FROM        Recipes R REPEAT 0
WHERE       R.gluten-free = 'TRUE'
SUCH THAT
            count(*) = 3 AND
            sum(calories) BETWEEN 2000 and 2500 AND
            (SELECT count(*) FROM P WHERE carbs > 0) ≥ count(*)/2
MAXIMIZE   sum(protein)
MINIMIZE   sum(fat)
						

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):

Universities

People

Publications

Code

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

Acknowledgement

This work is supported by the National Science Foundation under grants IIS-1421322 and IIS-1420941.