Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of...

234
Foundations of Preference Queries Jan Chomicki University at Buffalo Jan Chomicki () Preference Queries 1 / 65

Transcript of Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of...

Page 1: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Foundations of Preference Queries

Jan ChomickiUniversity at Buffalo

Jan Chomicki () Preference Queries 1 / 65

Page 2: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Plan of the course

1 Preference relations

2 Preference queries

3 Preference management

4 Advanced topics

Jan Chomicki () Preference Queries 2 / 65

Page 3: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Part I

Preference relations

Jan Chomicki () Preference Queries 3 / 65

Page 4: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Outline of Part I

1 Preference relationsPreferenceEquivalencePreference specificationCombining preferencesSkylines

Jan Chomicki () Preference Queries 4 / 65

Page 5: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference relations

Universe of objects

constants: uninterpreted, numbers,...

individuals (entities)

tuples

sets

Preference relation �binary relation between objects

x � y ≡ x is better than y ≡ x dominates y

an abstract, uniform way of talking about desirability, worth, cost,timeliness,..., and their combinations

preference relations used in queries

Jan Chomicki () Preference Queries 5 / 65

Page 6: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference relations

Universe of objects

constants: uninterpreted, numbers,...

individuals (entities)

tuples

sets

Preference relation �binary relation between objects

x � y ≡ x is better than y ≡ x dominates y

an abstract, uniform way of talking about desirability, worth, cost,timeliness,..., and their combinations

preference relations used in queries

Jan Chomicki () Preference Queries 5 / 65

Page 7: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Buying a car

Salesman: What kind of car do you prefer?Customer: The newer the better, if it is the same make. And cheap, too.Salesman: Which is more important for you: the age or the price?Customer: The age, definitely.Salesman: Those are the best cars, according to your preferences, that wehave in stock.Customer: Wait...it better be a BMW.

Jan Chomicki () Preference Queries 6 / 65

Page 8: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Buying a car

Salesman: What kind of car do you prefer?

Customer: The newer the better, if it is the same make. And cheap, too.Salesman: Which is more important for you: the age or the price?Customer: The age, definitely.Salesman: Those are the best cars, according to your preferences, that wehave in stock.Customer: Wait...it better be a BMW.

Jan Chomicki () Preference Queries 6 / 65

Page 9: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Buying a car

Salesman: What kind of car do you prefer?Customer: The newer the better, if it is the same make. And cheap, too.

Salesman: Which is more important for you: the age or the price?Customer: The age, definitely.Salesman: Those are the best cars, according to your preferences, that wehave in stock.Customer: Wait...it better be a BMW.

Jan Chomicki () Preference Queries 6 / 65

Page 10: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Buying a car

Salesman: What kind of car do you prefer?Customer: The newer the better, if it is the same make. And cheap, too.Salesman: Which is more important for you: the age or the price?

Customer: The age, definitely.Salesman: Those are the best cars, according to your preferences, that wehave in stock.Customer: Wait...it better be a BMW.

Jan Chomicki () Preference Queries 6 / 65

Page 11: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Buying a car

Salesman: What kind of car do you prefer?Customer: The newer the better, if it is the same make. And cheap, too.Salesman: Which is more important for you: the age or the price?Customer: The age, definitely.

Salesman: Those are the best cars, according to your preferences, that wehave in stock.Customer: Wait...it better be a BMW.

Jan Chomicki () Preference Queries 6 / 65

Page 12: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Buying a car

Salesman: What kind of car do you prefer?Customer: The newer the better, if it is the same make. And cheap, too.Salesman: Which is more important for you: the age or the price?Customer: The age, definitely.Salesman: Those are the best cars, according to your preferences, that wehave in stock.

Customer: Wait...it better be a BMW.

Jan Chomicki () Preference Queries 6 / 65

Page 13: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Buying a car

Salesman: What kind of car do you prefer?Customer: The newer the better, if it is the same make. And cheap, too.Salesman: Which is more important for you: the age or the price?Customer: The age, definitely.Salesman: Those are the best cars, according to your preferences, that wehave in stock.Customer: Wait...it better be a BMW.

Jan Chomicki () Preference Queries 6 / 65

Page 14: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Properties of preference relations

Properties of �irreflexivity: ∀x . x 6� x

asymmetry: ∀x , y . x � y ⇒ y 6� x

transitivity: ∀x , y , z . (x � y ∧ y � z)⇒ x � z

negative transitivity: ∀x , y , z . (x 6� y ∧ y 6� z)⇒ x 6� z

connectivity: ∀x , y . x � y ∨ y � x ∨ x = y

Orders

strict partial order (SPO): irreflexive and transitive

weak order (WO): negatively transitive SPO

total order: connected SPO

Jan Chomicki () Preference Queries 7 / 65

Page 15: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Properties of preference relations

Properties of �irreflexivity: ∀x . x 6� x

asymmetry: ∀x , y . x � y ⇒ y 6� x

transitivity: ∀x , y , z . (x � y ∧ y � z)⇒ x � z

negative transitivity: ∀x , y , z . (x 6� y ∧ y 6� z)⇒ x 6� z

connectivity: ∀x , y . x � y ∨ y � x ∨ x = y

Orders

strict partial order (SPO): irreflexive and transitive

weak order (WO): negatively transitive SPO

total order: connected SPO

Jan Chomicki () Preference Queries 7 / 65

Page 16: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Properties of preference relations

Properties of �irreflexivity: ∀x . x 6� x

asymmetry: ∀x , y . x � y ⇒ y 6� x

transitivity: ∀x , y , z . (x � y ∧ y � z)⇒ x � z

negative transitivity: ∀x , y , z . (x 6� y ∧ y 6� z)⇒ x 6� z

connectivity: ∀x , y . x � y ∨ y � x ∨ x = y

Orders

strict partial order (SPO): irreflexive and transitive

weak order (WO): negatively transitive SPO

total order: connected SPO

Jan Chomicki () Preference Queries 7 / 65

Page 17: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Weak and total orders

Weak order

a b

c d e

f

Total order

a

d

f

Jan Chomicki () Preference Queries 8 / 65

Page 18: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Order properties of preference relations

Irreflexivity, asymmetry: uncontroversial.

Transitivity:

captures rationality of preference

not always guaranteed: voting paradoxes

helps with preference querying

Negative transitivity:

scoring functions represent weak orders

We assume that preference relations are SPOs.

Jan Chomicki () Preference Queries 9 / 65

Page 19: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Order properties of preference relations

Irreflexivity, asymmetry: uncontroversial.

Transitivity:

captures rationality of preference

not always guaranteed: voting paradoxes

helps with preference querying

Negative transitivity:

scoring functions represent weak orders

We assume that preference relations are SPOs.

Jan Chomicki () Preference Queries 9 / 65

Page 20: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Order properties of preference relations

Irreflexivity, asymmetry: uncontroversial.

Transitivity:

captures rationality of preference

not always guaranteed: voting paradoxes

helps with preference querying

Negative transitivity:

scoring functions represent weak orders

We assume that preference relations are SPOs.

Jan Chomicki () Preference Queries 9 / 65

Page 21: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Order properties of preference relations

Irreflexivity, asymmetry: uncontroversial.

Transitivity:

captures rationality of preference

not always guaranteed: voting paradoxes

helps with preference querying

Negative transitivity:

scoring functions represent weak orders

We assume that preference relations are SPOs.

Jan Chomicki () Preference Queries 9 / 65

Page 22: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Order properties of preference relations

Irreflexivity, asymmetry: uncontroversial.

Transitivity:

captures rationality of preference

not always guaranteed: voting paradoxes

helps with preference querying

Negative transitivity:

scoring functions represent weak orders

We assume that preference relations are SPOs.

Jan Chomicki () Preference Queries 9 / 65

Page 23: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

When are two objects equivalent?

Relation ∼binary relation between objects

x ∼ y ≡ x ′′is equivalent to ′′ y

Several notions of equivalence

equality: x ∼eq y ≡ x = y

indifference: x ∼i y ≡ x � y ∧ y � x

restricted indifference:x ∼r y ≡ ∀z . (x ≺ z ⇔ y ≺ z) ∧ (z ≺ y ⇔ z ≺ x)

Properties of equivalence

equivalence relation: reflexive, symmetric, transitive

equality and restricted indifference (if � is an SPO) are equivalencerelations

indifference is reflexive and symmetric; transitive for WO

Jan Chomicki () Preference Queries 10 / 65

Page 24: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

When are two objects equivalent?

Relation ∼binary relation between objects

x ∼ y ≡ x ′′is equivalent to ′′ y

Several notions of equivalence

equality: x ∼eq y ≡ x = y

indifference: x ∼i y ≡ x � y ∧ y � x

restricted indifference:x ∼r y ≡ ∀z . (x ≺ z ⇔ y ≺ z) ∧ (z ≺ y ⇔ z ≺ x)

Properties of equivalence

equivalence relation: reflexive, symmetric, transitive

equality and restricted indifference (if � is an SPO) are equivalencerelations

indifference is reflexive and symmetric; transitive for WO

Jan Chomicki () Preference Queries 10 / 65

Page 25: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

When are two objects equivalent?

Relation ∼binary relation between objects

x ∼ y ≡ x ′′is equivalent to ′′ y

Several notions of equivalence

equality: x ∼eq y ≡ x = y

indifference: x ∼i y ≡ x � y ∧ y � x

restricted indifference:x ∼r y ≡ ∀z . (x ≺ z ⇔ y ≺ z) ∧ (z ≺ y ⇔ z ≺ x)

Properties of equivalence

equivalence relation: reflexive, symmetric, transitive

equality and restricted indifference (if � is an SPO) are equivalencerelations

indifference is reflexive and symmetric; transitive for WO

Jan Chomicki () Preference Queries 10 / 65

Page 26: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

When are two objects equivalent?

Relation ∼binary relation between objects

x ∼ y ≡ x ′′is equivalent to ′′ y

Several notions of equivalence

equality: x ∼eq y ≡ x = y

indifference: x ∼i y ≡ x � y ∧ y � x

restricted indifference:x ∼r y ≡ ∀z . (x ≺ z ⇔ y ≺ z) ∧ (z ≺ y ⇔ z ≺ x)

Properties of equivalence

equivalence relation: reflexive, symmetric, transitive

equality and restricted indifference (if � is an SPO) are equivalencerelations

indifference is reflexive and symmetric; transitive for WOJan Chomicki () Preference Queries 10 / 65

Page 27: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Example

bmw

ford vw mazda

kia

This is a strict partialorder which is not aweak order.

Preference:

bmw � ford, bmw � vwbmw � mazda, bmw � kiamazda � kia

Indifference:

ford ∼i vw, vw ∼i ford,ford ∼i mazda, mazda ∼i

ford,vw ∼i mazda, mazda ∼i

vw,ford ∼i kia, kia ∼i ford,vw ∼i kia, kia ∼i vw

Restricted indifference:

ford ∼r vw, vw ∼r ford

Jan Chomicki () Preference Queries 11 / 65

Page 28: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Example

bmw

ford vw mazda

kia

This is a strict partialorder which is not aweak order.

Preference:

bmw � ford, bmw � vwbmw � mazda, bmw � kiamazda � kia

Indifference:

ford ∼i vw, vw ∼i ford,ford ∼i mazda, mazda ∼i

ford,vw ∼i mazda, mazda ∼i

vw,ford ∼i kia, kia ∼i ford,vw ∼i kia, kia ∼i vw

Restricted indifference:

ford ∼r vw, vw ∼r ford

Jan Chomicki () Preference Queries 11 / 65

Page 29: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Example

bmw

ford vw mazda

kia

This is a strict partialorder which is not aweak order.

Preference:

bmw � ford, bmw � vwbmw � mazda, bmw � kiamazda � kia

Indifference:

ford ∼i vw, vw ∼i ford,ford ∼i mazda, mazda ∼i

ford,vw ∼i mazda, mazda ∼i

vw,ford ∼i kia, kia ∼i ford,vw ∼i kia, kia ∼i vw

Restricted indifference:

ford ∼r vw, vw ∼r ford

Jan Chomicki () Preference Queries 11 / 65

Page 30: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Example

bmw

ford vw mazda

kia

This is a strict partialorder which is not aweak order.

Preference:

bmw � ford, bmw � vwbmw � mazda, bmw � kiamazda � kia

Indifference:

ford ∼i vw, vw ∼i ford,ford ∼i mazda, mazda ∼i

ford,vw ∼i mazda, mazda ∼i

vw,ford ∼i kia, kia ∼i ford,vw ∼i kia, kia ∼i vw

Restricted indifference:

ford ∼r vw, vw ∼r ford

Jan Chomicki () Preference Queries 11 / 65

Page 31: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Not every SPO is a WO

Canonical example

mazda � kia, mazda ∼i vw, kia ∼i vw

Violation of negative transitivity

mazda � vw, vw � kia, mazda � kia

Jan Chomicki () Preference Queries 12 / 65

Page 32: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference specification

Explicit preference relations

Finite sets of pairs: bmw � mazda, mazda � kia,...

Implicit preference relations

can be infinite but finitely representable

defined using logic formulas in some constraint theory:

(m1, y1, p1) �1 (m2, y2, p2) ≡ y1 > y2 ∨ (y1 = y2 ∧ p1 < p2)

for relation Car(Make,Year ,Price).

defined using preference constructors (Preference SQL)

defined using real-valued scoring functions: [F (m, y , p) = α · y + β · p(m1, y1, p1) �2 (m2, y2, p2) ≡ F (m1, y1, p1) > F (m2, y2, p2)

Jan Chomicki () Preference Queries 13 / 65

Page 33: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference specification

Explicit preference relations

Finite sets of pairs: bmw � mazda, mazda � kia,...

Implicit preference relations

can be infinite but finitely representable

defined using logic formulas in some constraint theory:

(m1, y1, p1) �1 (m2, y2, p2) ≡ y1 > y2 ∨ (y1 = y2 ∧ p1 < p2)

for relation Car(Make,Year ,Price).

defined using preference constructors (Preference SQL)

defined using real-valued scoring functions: [F (m, y , p) = α · y + β · p(m1, y1, p1) �2 (m2, y2, p2) ≡ F (m1, y1, p1) > F (m2, y2, p2)

Jan Chomicki () Preference Queries 13 / 65

Page 34: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference specification

Explicit preference relations

Finite sets of pairs: bmw � mazda, mazda � kia,...

Implicit preference relations

can be infinite but finitely representable

defined using logic formulas in some constraint theory:

(m1, y1, p1) �1 (m2, y2, p2) ≡ y1 > y2 ∨ (y1 = y2 ∧ p1 < p2)

for relation Car(Make,Year ,Price).

defined using preference constructors (Preference SQL)

defined using real-valued scoring functions: [F (m, y , p) = α · y + β · p(m1, y1, p1) �2 (m2, y2, p2) ≡ F (m1, y1, p1) > F (m2, y2, p2)

Jan Chomicki () Preference Queries 13 / 65

Page 35: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference specification

Explicit preference relations

Finite sets of pairs: bmw � mazda, mazda � kia,...

Implicit preference relations

can be infinite but finitely representable

defined using logic formulas in some constraint theory:

(m1, y1, p1) �1 (m2, y2, p2) ≡ y1 > y2 ∨ (y1 = y2 ∧ p1 < p2)

for relation Car(Make,Year ,Price).

defined using preference constructors (Preference SQL)

defined using real-valued scoring functions: [F (m, y , p) = α · y + β · p(m1, y1, p1) �2 (m2, y2, p2) ≡ F (m1, y1, p1) > F (m2, y2, p2)

Jan Chomicki () Preference Queries 13 / 65

Page 36: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference specification

Explicit preference relations

Finite sets of pairs: bmw � mazda, mazda � kia,...

Implicit preference relations

can be infinite but finitely representable

defined using logic formulas in some constraint theory:

(m1, y1, p1) �1 (m2, y2, p2) ≡ y1 > y2 ∨ (y1 = y2 ∧ p1 < p2)

for relation Car(Make,Year ,Price).

defined using preference constructors (Preference SQL)

defined using real-valued scoring functions: [F (m, y , p) = α · y + β · p(m1, y1, p1) �2 (m2, y2, p2) ≡ F (m1, y1, p1) > F (m2, y2, p2)

Jan Chomicki () Preference Queries 13 / 65

Page 37: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference specification

Explicit preference relations

Finite sets of pairs: bmw � mazda, mazda � kia,...

Implicit preference relations

can be infinite but finitely representable

defined using logic formulas in some constraint theory:

(m1, y1, p1) �1 (m2, y2, p2) ≡ y1 > y2 ∨ (y1 = y2 ∧ p1 < p2)

for relation Car(Make,Year ,Price).

defined using preference constructors (Preference SQL)

defined using real-valued scoring functions:

[F (m, y , p) = α · y + β · p(m1, y1, p1) �2 (m2, y2, p2) ≡ F (m1, y1, p1) > F (m2, y2, p2)

Jan Chomicki () Preference Queries 13 / 65

Page 38: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference specification

Explicit preference relations

Finite sets of pairs: bmw � mazda, mazda � kia,...

Implicit preference relations

can be infinite but finitely representable

defined using logic formulas in some constraint theory:

(m1, y1, p1) �1 (m2, y2, p2) ≡ y1 > y2 ∨ (y1 = y2 ∧ p1 < p2)

for relation Car(Make,Year ,Price).

defined using preference constructors (Preference SQL)

defined using real-valued scoring functions: [F (m, y , p) = α · y + β · p

(m1, y1, p1) �2 (m2, y2, p2) ≡ F (m1, y1, p1) > F (m2, y2, p2)

Jan Chomicki () Preference Queries 13 / 65

Page 39: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference specification

Explicit preference relations

Finite sets of pairs: bmw � mazda, mazda � kia,...

Implicit preference relations

can be infinite but finitely representable

defined using logic formulas in some constraint theory:

(m1, y1, p1) �1 (m2, y2, p2) ≡ y1 > y2 ∨ (y1 = y2 ∧ p1 < p2)

for relation Car(Make,Year ,Price).

defined using preference constructors (Preference SQL)

defined using real-valued scoring functions: [F (m, y , p) = α · y + β · p(m1, y1, p1) �2 (m2, y2, p2) ≡ F (m1, y1, p1) > F (m2, y2, p2)

Jan Chomicki () Preference Queries 13 / 65

Page 40: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Logic formulas

The language of logic formulasconstants

object (tuple) attributes

comparison operators: =, 6=, <,>, . . .arithmetic operators: +, ·, . . .Boolean connectives: ¬,∧,∨quantifiers:

∀,∃usually can be eliminated (quantifier elimination)

Jan Chomicki () Preference Queries 14 / 65

Page 41: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Logic formulas

The language of logic formulasconstants

object (tuple) attributes

comparison operators: =, 6=, <,>, . . .arithmetic operators: +, ·, . . .Boolean connectives: ¬,∧,∨quantifiers:

∀,∃usually can be eliminated (quantifier elimination)

Jan Chomicki () Preference Queries 14 / 65

Page 42: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Representability

Definition

A scoring function f represents a preference relation � if for all x , y

x � y ≡ f (x) > f (y).

Necessary condition for representability

The preference relation � is a weak order.

Sufficient condition for representability

� is a weak order

the domain is countable or some continuity conditions are satisfied(studied in decision theory)

Jan Chomicki () Preference Queries 15 / 65

Page 43: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Representability

Definition

A scoring function f represents a preference relation � if for all x , y

x � y ≡ f (x) > f (y).

Necessary condition for representability

The preference relation � is a weak order.

Sufficient condition for representability

� is a weak order

the domain is countable or some continuity conditions are satisfied(studied in decision theory)

Jan Chomicki () Preference Queries 15 / 65

Page 44: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Representability

Definition

A scoring function f represents a preference relation � if for all x , y

x � y ≡ f (x) > f (y).

Necessary condition for representability

The preference relation � is a weak order.

Sufficient condition for representability

� is a weak order

the domain is countable or some continuity conditions are satisfied(studied in decision theory)

Jan Chomicki () Preference Queries 15 / 65

Page 45: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Representability

Definition

A scoring function f represents a preference relation � if for all x , y

x � y ≡ f (x) > f (y).

Necessary condition for representability

The preference relation � is a weak order.

Sufficient condition for representability

� is a weak order

the domain is countable or some continuity conditions are satisfied(studied in decision theory)

Jan Chomicki () Preference Queries 15 / 65

Page 46: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Not every WO can be represented using a scoring function

Lexicographic order in R × R

(x1, y1) �lo (x2, y2) ≡ x1 > x2 ∨ (x1 = x2 ∧ y1 > y2)

Proof1 Assume there is a real-valued function f such that

x �lo y ≡ f (x) > f (y).

2 For every x0, (x0, 1) �lo (x0, 0).

3 Thus f (x0, 1) > f (x0, 0).

4 Consider now x1 > x0.

5 Clearly f (x1, 1) > f (x1, 0) > f (x0, 1) > f (x0, 0).

6 So there are uncountably many nonempty disjoint intervals in R.

7 Each such interval contains a rational number: contradiction with thecountability of the set of rational numbers.

Jan Chomicki () Preference Queries 16 / 65

Page 47: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Not every WO can be represented using a scoring function

Lexicographic order in R × R

(x1, y1) �lo (x2, y2) ≡ x1 > x2 ∨ (x1 = x2 ∧ y1 > y2)

Proof1 Assume there is a real-valued function f such that

x �lo y ≡ f (x) > f (y).

2 For every x0, (x0, 1) �lo (x0, 0).

3 Thus f (x0, 1) > f (x0, 0).

4 Consider now x1 > x0.

5 Clearly f (x1, 1) > f (x1, 0) > f (x0, 1) > f (x0, 0).

6 So there are uncountably many nonempty disjoint intervals in R.

7 Each such interval contains a rational number: contradiction with thecountability of the set of rational numbers.

Jan Chomicki () Preference Queries 16 / 65

Page 48: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Not every WO can be represented using a scoring function

Lexicographic order in R × R

(x1, y1) �lo (x2, y2) ≡ x1 > x2 ∨ (x1 = x2 ∧ y1 > y2)

Proof

1 Assume there is a real-valued function f such thatx �lo y ≡ f (x) > f (y).

2 For every x0, (x0, 1) �lo (x0, 0).

3 Thus f (x0, 1) > f (x0, 0).

4 Consider now x1 > x0.

5 Clearly f (x1, 1) > f (x1, 0) > f (x0, 1) > f (x0, 0).

6 So there are uncountably many nonempty disjoint intervals in R.

7 Each such interval contains a rational number: contradiction with thecountability of the set of rational numbers.

Jan Chomicki () Preference Queries 16 / 65

Page 49: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Not every WO can be represented using a scoring function

Lexicographic order in R × R

(x1, y1) �lo (x2, y2) ≡ x1 > x2 ∨ (x1 = x2 ∧ y1 > y2)

Proof1 Assume there is a real-valued function f such that

x �lo y ≡ f (x) > f (y).

2 For every x0, (x0, 1) �lo (x0, 0).

3 Thus f (x0, 1) > f (x0, 0).

4 Consider now x1 > x0.

5 Clearly f (x1, 1) > f (x1, 0) > f (x0, 1) > f (x0, 0).

6 So there are uncountably many nonempty disjoint intervals in R.

7 Each such interval contains a rational number: contradiction with thecountability of the set of rational numbers.

Jan Chomicki () Preference Queries 16 / 65

Page 50: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Not every WO can be represented using a scoring function

Lexicographic order in R × R

(x1, y1) �lo (x2, y2) ≡ x1 > x2 ∨ (x1 = x2 ∧ y1 > y2)

Proof1 Assume there is a real-valued function f such that

x �lo y ≡ f (x) > f (y).

2 For every x0, (x0, 1) �lo (x0, 0).

3 Thus f (x0, 1) > f (x0, 0).

4 Consider now x1 > x0.

5 Clearly f (x1, 1) > f (x1, 0) > f (x0, 1) > f (x0, 0).

6 So there are uncountably many nonempty disjoint intervals in R.

7 Each such interval contains a rational number: contradiction with thecountability of the set of rational numbers.

Jan Chomicki () Preference Queries 16 / 65

Page 51: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Not every WO can be represented using a scoring function

Lexicographic order in R × R

(x1, y1) �lo (x2, y2) ≡ x1 > x2 ∨ (x1 = x2 ∧ y1 > y2)

Proof1 Assume there is a real-valued function f such that

x �lo y ≡ f (x) > f (y).

2 For every x0, (x0, 1) �lo (x0, 0).

3 Thus f (x0, 1) > f (x0, 0).

4 Consider now x1 > x0.

5 Clearly f (x1, 1) > f (x1, 0) > f (x0, 1) > f (x0, 0).

6 So there are uncountably many nonempty disjoint intervals in R.

7 Each such interval contains a rational number: contradiction with thecountability of the set of rational numbers.

Jan Chomicki () Preference Queries 16 / 65

Page 52: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Not every WO can be represented using a scoring function

Lexicographic order in R × R

(x1, y1) �lo (x2, y2) ≡ x1 > x2 ∨ (x1 = x2 ∧ y1 > y2)

Proof1 Assume there is a real-valued function f such that

x �lo y ≡ f (x) > f (y).

2 For every x0, (x0, 1) �lo (x0, 0).

3 Thus f (x0, 1) > f (x0, 0).

4 Consider now x1 > x0.

5 Clearly f (x1, 1) > f (x1, 0) > f (x0, 1) > f (x0, 0).

6 So there are uncountably many nonempty disjoint intervals in R.

7 Each such interval contains a rational number: contradiction with thecountability of the set of rational numbers.

Jan Chomicki () Preference Queries 16 / 65

Page 53: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Not every WO can be represented using a scoring function

Lexicographic order in R × R

(x1, y1) �lo (x2, y2) ≡ x1 > x2 ∨ (x1 = x2 ∧ y1 > y2)

Proof1 Assume there is a real-valued function f such that

x �lo y ≡ f (x) > f (y).

2 For every x0, (x0, 1) �lo (x0, 0).

3 Thus f (x0, 1) > f (x0, 0).

4 Consider now x1 > x0.

5 Clearly f (x1, 1) > f (x1, 0) > f (x0, 1) > f (x0, 0).

6 So there are uncountably many nonempty disjoint intervals in R.

7 Each such interval contains a rational number: contradiction with thecountability of the set of rational numbers.

Jan Chomicki () Preference Queries 16 / 65

Page 54: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Not every WO can be represented using a scoring function

Lexicographic order in R × R

(x1, y1) �lo (x2, y2) ≡ x1 > x2 ∨ (x1 = x2 ∧ y1 > y2)

Proof1 Assume there is a real-valued function f such that

x �lo y ≡ f (x) > f (y).

2 For every x0, (x0, 1) �lo (x0, 0).

3 Thus f (x0, 1) > f (x0, 0).

4 Consider now x1 > x0.

5 Clearly f (x1, 1) > f (x1, 0) > f (x0, 1) > f (x0, 0).

6 So there are uncountably many nonempty disjoint intervals in R.

7 Each such interval contains a rational number: contradiction with thecountability of the set of rational numbers.

Jan Chomicki () Preference Queries 16 / 65

Page 55: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Not every WO can be represented using a scoring function

Lexicographic order in R × R

(x1, y1) �lo (x2, y2) ≡ x1 > x2 ∨ (x1 = x2 ∧ y1 > y2)

Proof1 Assume there is a real-valued function f such that

x �lo y ≡ f (x) > f (y).

2 For every x0, (x0, 1) �lo (x0, 0).

3 Thus f (x0, 1) > f (x0, 0).

4 Consider now x1 > x0.

5 Clearly f (x1, 1) > f (x1, 0) > f (x0, 1) > f (x0, 0).

6 So there are uncountably many nonempty disjoint intervals in R.

7 Each such interval contains a rational number: contradiction with thecountability of the set of rational numbers.

Jan Chomicki () Preference Queries 16 / 65

Page 56: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference constructors [Kie02, KK02]

Good values

Prefer v ∈ S1 over v 6∈ S1.POS(Make,{mazda,vw})

Bad values

Prefer v 6∈ S1 over v ∈ S1.NEG(Make,{yugo})

Explicit preference

Preference encoded by a finitedirected graph.

EXP(Make,{(bmw,ford),...,(mazda,kia)})

Value comparison

Prefer larger/smaller values.HIGHEST(Year)LOWEST(Price)

Distance

Prefer values closer to v0.

AROUND(Price,12K)

Jan Chomicki () Preference Queries 17 / 65

Page 57: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference constructors [Kie02, KK02]

Good values

Prefer v ∈ S1 over v 6∈ S1.

POS(Make,{mazda,vw})

Bad values

Prefer v 6∈ S1 over v ∈ S1.NEG(Make,{yugo})

Explicit preference

Preference encoded by a finitedirected graph.

EXP(Make,{(bmw,ford),...,(mazda,kia)})

Value comparison

Prefer larger/smaller values.HIGHEST(Year)LOWEST(Price)

Distance

Prefer values closer to v0.

AROUND(Price,12K)

Jan Chomicki () Preference Queries 17 / 65

Page 58: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference constructors [Kie02, KK02]

Good values

Prefer v ∈ S1 over v 6∈ S1.POS(Make,{mazda,vw})

Bad values

Prefer v 6∈ S1 over v ∈ S1.NEG(Make,{yugo})

Explicit preference

Preference encoded by a finitedirected graph.

EXP(Make,{(bmw,ford),...,(mazda,kia)})

Value comparison

Prefer larger/smaller values.HIGHEST(Year)LOWEST(Price)

Distance

Prefer values closer to v0.

AROUND(Price,12K)

Jan Chomicki () Preference Queries 17 / 65

Page 59: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference constructors [Kie02, KK02]

Good values

Prefer v ∈ S1 over v 6∈ S1.POS(Make,{mazda,vw})

Bad values

Prefer v 6∈ S1 over v ∈ S1.

NEG(Make,{yugo})

Explicit preference

Preference encoded by a finitedirected graph.

EXP(Make,{(bmw,ford),...,(mazda,kia)})

Value comparison

Prefer larger/smaller values.HIGHEST(Year)LOWEST(Price)

Distance

Prefer values closer to v0.

AROUND(Price,12K)

Jan Chomicki () Preference Queries 17 / 65

Page 60: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference constructors [Kie02, KK02]

Good values

Prefer v ∈ S1 over v 6∈ S1.POS(Make,{mazda,vw})

Bad values

Prefer v 6∈ S1 over v ∈ S1.NEG(Make,{yugo})

Explicit preference

Preference encoded by a finitedirected graph.

EXP(Make,{(bmw,ford),...,(mazda,kia)})

Value comparison

Prefer larger/smaller values.HIGHEST(Year)LOWEST(Price)

Distance

Prefer values closer to v0.

AROUND(Price,12K)

Jan Chomicki () Preference Queries 17 / 65

Page 61: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference constructors [Kie02, KK02]

Good values

Prefer v ∈ S1 over v 6∈ S1.POS(Make,{mazda,vw})

Bad values

Prefer v 6∈ S1 over v ∈ S1.NEG(Make,{yugo})

Explicit preference

Preference encoded by a finitedirected graph.

EXP(Make,{(bmw,ford),...,(mazda,kia)})

Value comparison

Prefer larger/smaller values.HIGHEST(Year)LOWEST(Price)

Distance

Prefer values closer to v0.

AROUND(Price,12K)

Jan Chomicki () Preference Queries 17 / 65

Page 62: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference constructors [Kie02, KK02]

Good values

Prefer v ∈ S1 over v 6∈ S1.POS(Make,{mazda,vw})

Bad values

Prefer v 6∈ S1 over v ∈ S1.NEG(Make,{yugo})

Explicit preference

Preference encoded by a finitedirected graph.

EXP(Make,{(bmw,ford),...,(mazda,kia)})

Value comparison

Prefer larger/smaller values.HIGHEST(Year)LOWEST(Price)

Distance

Prefer values closer to v0.

AROUND(Price,12K)

Jan Chomicki () Preference Queries 17 / 65

Page 63: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference constructors [Kie02, KK02]

Good values

Prefer v ∈ S1 over v 6∈ S1.POS(Make,{mazda,vw})

Bad values

Prefer v 6∈ S1 over v ∈ S1.NEG(Make,{yugo})

Explicit preference

Preference encoded by a finitedirected graph.

EXP(Make,{(bmw,ford),...,(mazda,kia)})

Value comparison

Prefer larger/smaller values.

HIGHEST(Year)LOWEST(Price)

Distance

Prefer values closer to v0.

AROUND(Price,12K)

Jan Chomicki () Preference Queries 17 / 65

Page 64: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference constructors [Kie02, KK02]

Good values

Prefer v ∈ S1 over v 6∈ S1.POS(Make,{mazda,vw})

Bad values

Prefer v 6∈ S1 over v ∈ S1.NEG(Make,{yugo})

Explicit preference

Preference encoded by a finitedirected graph.

EXP(Make,{(bmw,ford),...,(mazda,kia)})

Value comparison

Prefer larger/smaller values.HIGHEST(Year)LOWEST(Price)

Distance

Prefer values closer to v0.

AROUND(Price,12K)

Jan Chomicki () Preference Queries 17 / 65

Page 65: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference constructors [Kie02, KK02]

Good values

Prefer v ∈ S1 over v 6∈ S1.POS(Make,{mazda,vw})

Bad values

Prefer v 6∈ S1 over v ∈ S1.NEG(Make,{yugo})

Explicit preference

Preference encoded by a finitedirected graph.

EXP(Make,{(bmw,ford),...,(mazda,kia)})

Value comparison

Prefer larger/smaller values.HIGHEST(Year)LOWEST(Price)

Distance

Prefer values closer to v0.

AROUND(Price,12K)

Jan Chomicki () Preference Queries 17 / 65

Page 66: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference constructors [Kie02, KK02]

Good values

Prefer v ∈ S1 over v 6∈ S1.POS(Make,{mazda,vw})

Bad values

Prefer v 6∈ S1 over v ∈ S1.NEG(Make,{yugo})

Explicit preference

Preference encoded by a finitedirected graph.

EXP(Make,{(bmw,ford),...,(mazda,kia)})

Value comparison

Prefer larger/smaller values.HIGHEST(Year)LOWEST(Price)

Distance

Prefer values closer to v0.

AROUND(Price,12K)

Jan Chomicki () Preference Queries 17 / 65

Page 67: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Combining preferences

Preference composition

combining preferences about objects of the same kind

dimensionality is not increased

representing preference aggregation, revision, ...

Preference accumulation

defining preferences over objects in terms of preferences over simplerobjects

dimensionality is increased (preferences over Cartesian product).

Jan Chomicki () Preference Queries 18 / 65

Page 68: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Combining preferences

Preference composition

combining preferences about objects of the same kind

dimensionality is not increased

representing preference aggregation, revision, ...

Preference accumulation

defining preferences over objects in terms of preferences over simplerobjects

dimensionality is increased (preferences over Cartesian product).

Jan Chomicki () Preference Queries 18 / 65

Page 69: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Combining preferences

Preference composition

combining preferences about objects of the same kind

dimensionality is not increased

representing preference aggregation, revision, ...

Preference accumulation

defining preferences over objects in terms of preferences over simplerobjects

dimensionality is increased (preferences over Cartesian product).

Jan Chomicki () Preference Queries 18 / 65

Page 70: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Combining preferences: composition

Boolean composition

x �∪ y ≡ x �1 y ∨ x �2 y

and similarly for ∩.

Prioritized composition

x �lex y ≡ x �1 y ∨ (y �1 x ∧ x �2 y).

Pareto composition

x �Par y ≡ (x �1 y ∧ y �2 x) ∨ (x �2 y ∧ y �1 x).

Jan Chomicki () Preference Queries 19 / 65

Page 71: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Combining preferences: composition

Boolean composition

x �∪ y ≡ x �1 y ∨ x �2 y

and similarly for ∩.

Prioritized composition

x �lex y ≡ x �1 y ∨ (y �1 x ∧ x �2 y).

Pareto composition

x �Par y ≡ (x �1 y ∧ y �2 x) ∨ (x �2 y ∧ y �1 x).

Jan Chomicki () Preference Queries 19 / 65

Page 72: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Combining preferences: composition

Boolean composition

x �∪ y ≡ x �1 y ∨ x �2 y

and similarly for ∩.

Prioritized composition

x �lex y ≡ x �1 y ∨ (y �1 x ∧ x �2 y).

Pareto composition

x �Par y ≡ (x �1 y ∧ y �2 x) ∨ (x �2 y ∧ y �1 x).

Jan Chomicki () Preference Queries 19 / 65

Page 73: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Combining preferences: composition

Boolean composition

x �∪ y ≡ x �1 y ∨ x �2 y

and similarly for ∩.

Prioritized composition

x �lex y ≡ x �1 y ∨ (y �1 x ∧ x �2 y).

Pareto composition

x �Par y ≡ (x �1 y ∧ y �2 x) ∨ (x �2 y ∧ y �1 x).

Jan Chomicki () Preference Queries 19 / 65

Page 74: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference composition

Preference relation �1

bmw

ford mazda

kia

Preference relation �2

bmw

ford

mazda

kia

Prioritized composition

bmw

ford

mazda

kia

Pareto composition

bmwford

mazdakia

Jan Chomicki () Preference Queries 20 / 65

Page 75: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference composition

Preference relation �1

bmw

ford mazda

kia

Preference relation �2

bmw

ford

mazda

kia

Prioritized composition

bmw

ford

mazda

kia

Pareto composition

bmwford

mazdakia

Jan Chomicki () Preference Queries 20 / 65

Page 76: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference composition

Preference relation �1

bmw

ford mazda

kia

Preference relation �2

bmw

ford

mazda

kia

Prioritized composition

bmw

ford

mazda

kia

Pareto composition

bmwford

mazdakia

Jan Chomicki () Preference Queries 20 / 65

Page 77: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference composition

Preference relation �1

bmw

ford mazda

kia

Preference relation �2

bmw

ford

mazda

kia

Prioritized composition

bmw

ford

mazda

kia

Pareto composition

bmwford

mazdakia

Jan Chomicki () Preference Queries 20 / 65

Page 78: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference composition

Preference relation �1

bmw

ford mazda

kia

Preference relation �2

bmw

ford

mazda

kia

Prioritized composition

bmw

ford

mazda

kia

Pareto composition

bmwford

mazdakia

Jan Chomicki () Preference Queries 20 / 65

Page 79: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Combining preferences: accumulation [Kie02]

Prioritized accumulation: �pr= (�1 & �2)

(x1, x2) �pr (y1, y2) ≡ x1 �1 y1 ∨ (x1 = y1 ∧ x2 �2 y2).

Pareto accumulation: �pa= (�1 ⊗ �2)

(x1, x2) �pa (y1, y2) ≡ (x1 �1 y1 ∧ x2 �2 y2) ∨ (x1 �1 y1 ∧ x2 �2 y2).

Properties

closure

associativity

commutativity of Pareto accumulation

Jan Chomicki () Preference Queries 21 / 65

Page 80: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Combining preferences: accumulation [Kie02]

Prioritized accumulation: �pr= (�1 & �2)

(x1, x2) �pr (y1, y2) ≡ x1 �1 y1 ∨ (x1 = y1 ∧ x2 �2 y2).

Pareto accumulation: �pa= (�1 ⊗ �2)

(x1, x2) �pa (y1, y2) ≡ (x1 �1 y1 ∧ x2 �2 y2) ∨ (x1 �1 y1 ∧ x2 �2 y2).

Properties

closure

associativity

commutativity of Pareto accumulation

Jan Chomicki () Preference Queries 21 / 65

Page 81: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Combining preferences: accumulation [Kie02]

Prioritized accumulation: �pr= (�1 & �2)

(x1, x2) �pr (y1, y2) ≡ x1 �1 y1 ∨ (x1 = y1 ∧ x2 �2 y2).

Pareto accumulation: �pa= (�1 ⊗ �2)

(x1, x2) �pa (y1, y2) ≡ (x1 �1 y1 ∧ x2 �2 y2) ∨ (x1 �1 y1 ∧ x2 �2 y2).

Properties

closure

associativity

commutativity of Pareto accumulation

Jan Chomicki () Preference Queries 21 / 65

Page 82: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Combining preferences: accumulation [Kie02]

Prioritized accumulation: �pr= (�1 & �2)

(x1, x2) �pr (y1, y2) ≡ x1 �1 y1 ∨ (x1 = y1 ∧ x2 �2 y2).

Pareto accumulation: �pa= (�1 ⊗ �2)

(x1, x2) �pa (y1, y2) ≡ (x1 �1 y1 ∧ x2 �2 y2) ∨ (x1 �1 y1 ∧ x2 �2 y2).

Properties

closure

associativity

commutativity of Pareto accumulation

Jan Chomicki () Preference Queries 21 / 65

Page 83: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Skylines

Skyline

Given single-attribute total preference relations �A1 , . . . ,�An for arelational schema R(A1, . . . ,An), the skyline preference relation �sky isdefined as

�sky =�A1 ⊗ �A2 ⊗ · · ·⊗ �An .

Unfolding the definition

(x1, . . . , xn) �sky (y1, . . . , yn) ≡∧i

xi �Aiyi ∧

∨i

xi �Aiyi .

Two-dimensional Euclidean space

(x1, x2) �sky (y1, y2) ≡ x1 ≥ y1 ∧ x2 > y2 ∨ x1 > y1 ∧ x2 ≥ y2

Jan Chomicki () Preference Queries 22 / 65

Page 84: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Skylines

Skyline

Given single-attribute total preference relations �A1 , . . . ,�An for arelational schema R(A1, . . . ,An), the skyline preference relation �sky isdefined as

�sky =�A1 ⊗ �A2 ⊗ · · ·⊗ �An .

Unfolding the definition

(x1, . . . , xn) �sky (y1, . . . , yn) ≡∧i

xi �Aiyi ∧

∨i

xi �Aiyi .

Two-dimensional Euclidean space

(x1, x2) �sky (y1, y2) ≡ x1 ≥ y1 ∧ x2 > y2 ∨ x1 > y1 ∧ x2 ≥ y2

Jan Chomicki () Preference Queries 22 / 65

Page 85: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Skylines

Skyline

Given single-attribute total preference relations �A1 , . . . ,�An for arelational schema R(A1, . . . ,An), the skyline preference relation �sky isdefined as

�sky =�A1 ⊗ �A2 ⊗ · · ·⊗ �An .

Unfolding the definition

(x1, . . . , xn) �sky (y1, . . . , yn) ≡∧i

xi �Aiyi ∧

∨i

xi �Aiyi .

Two-dimensional Euclidean space

(x1, x2) �sky (y1, y2) ≡ x1 ≥ y1 ∧ x2 > y2 ∨ x1 > y1 ∧ x2 ≥ y2

Jan Chomicki () Preference Queries 22 / 65

Page 86: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Skyline in Euclidean space

Maximal skyline vectors

Maxima

A skyline consists of all maxima of monotonic scoring functions.

Skyline is not a WO

(2, 0) �sky (0, 2), (0, 2) �sky (1, 0), (2, 0) �sky (1, 0)

Jan Chomicki () Preference Queries 23 / 65

Page 87: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Skyline in Euclidean space

Maximal skyline vectors

Maxima

A skyline consists of all maxima of monotonic scoring functions.

Skyline is not a WO

(2, 0) �sky (0, 2), (0, 2) �sky (1, 0), (2, 0) �sky (1, 0)

Jan Chomicki () Preference Queries 23 / 65

Page 88: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Skyline in Euclidean space

Maximal skyline vectors

Maxima

A skyline consists of all maxima of monotonic scoring functions.

Skyline is not a WO

(2, 0) �sky (0, 2), (0, 2) �sky (1, 0), (2, 0) �sky (1, 0)

Jan Chomicki () Preference Queries 23 / 65

Page 89: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Skyline in Euclidean space

Maximal skyline vectors

Maxima

A skyline consists of all maxima of monotonic scoring functions.

Skyline is not a WO

(2, 0) �sky (0, 2), (0, 2) �sky (1, 0), (2, 0) �sky (1, 0)

Jan Chomicki () Preference Queries 23 / 65

Page 90: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Skyline in Euclidean space

Maximal skyline vectors

Maxima

A skyline consists of all maxima of monotonic scoring functions.

Skyline is not a WO

(2, 0) �sky (0, 2), (0, 2) �sky (1, 0), (2, 0) �sky (1, 0)

Jan Chomicki () Preference Queries 23 / 65

Page 91: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Skyline variants

Groupwise skyline

compare only tuples in the same group

Order properties

Attribute orders are general SPOs.

Non-Euclidean spaces

Metric spaces:

distance vectors in road networks

Dynamic attributes

Attribute values can change dynamically:

distance from query point in road networks

Jan Chomicki () Preference Queries 24 / 65

Page 92: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Skyline variants

Groupwise skyline

compare only tuples in the same group

Order properties

Attribute orders are general SPOs.

Non-Euclidean spaces

Metric spaces:

distance vectors in road networks

Dynamic attributes

Attribute values can change dynamically:

distance from query point in road networks

Jan Chomicki () Preference Queries 24 / 65

Page 93: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Skyline variants

Groupwise skyline

compare only tuples in the same group

Order properties

Attribute orders are general SPOs.

Non-Euclidean spaces

Metric spaces:

distance vectors in road networks

Dynamic attributes

Attribute values can change dynamically:

distance from query point in road networks

Jan Chomicki () Preference Queries 24 / 65

Page 94: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Skyline variants

Groupwise skyline

compare only tuples in the same group

Order properties

Attribute orders are general SPOs.

Non-Euclidean spaces

Metric spaces:

distance vectors in road networks

Dynamic attributes

Attribute values can change dynamically:

distance from query point in road networks

Jan Chomicki () Preference Queries 24 / 65

Page 95: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Skyline variants

Groupwise skyline

compare only tuples in the same group

Order properties

Attribute orders are general SPOs.

Non-Euclidean spaces

Metric spaces:

distance vectors in road networks

Dynamic attributes

Attribute values can change dynamically:

distance from query point in road networks

Jan Chomicki () Preference Queries 24 / 65

Page 96: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Combining scoring functions

Scoring functions can be combined using numerical operators.

Common scenario

scoring functions f1, . . . , fn

aggregate scoring function: F (t) = E (f1(t), . . . , fn(t))

linear scoring function: Σni=1αi fi

Numerical vs. logical combination

logical combination cannot be defined numerically

numerical combination cannot be defined logically (unless arithmeticoperators are available)

Jan Chomicki () Preference Queries 25 / 65

Page 97: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Combining scoring functions

Scoring functions can be combined using numerical operators.

Common scenario

scoring functions f1, . . . , fn

aggregate scoring function: F (t) = E (f1(t), . . . , fn(t))

linear scoring function: Σni=1αi fi

Numerical vs. logical combination

logical combination cannot be defined numerically

numerical combination cannot be defined logically (unless arithmeticoperators are available)

Jan Chomicki () Preference Queries 25 / 65

Page 98: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Combining scoring functions

Scoring functions can be combined using numerical operators.

Common scenario

scoring functions f1, . . . , fn

aggregate scoring function: F (t) = E (f1(t), . . . , fn(t))

linear scoring function: Σni=1αi fi

Numerical vs. logical combination

logical combination cannot be defined numerically

numerical combination cannot be defined logically (unless arithmeticoperators are available)

Jan Chomicki () Preference Queries 25 / 65

Page 99: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Combining scoring functions

Scoring functions can be combined using numerical operators.

Common scenario

scoring functions f1, . . . , fn

aggregate scoring function: F (t) = E (f1(t), . . . , fn(t))

linear scoring function: Σni=1αi fi

Numerical vs. logical combination

logical combination cannot be defined numerically

numerical combination cannot be defined logically (unless arithmeticoperators are available)

Jan Chomicki () Preference Queries 25 / 65

Page 100: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Part II

Preference Queries

Jan Chomicki () Preference Queries 26 / 65

Page 101: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Outline of Part II

2 Preference queriesRetrieving non-dominated elementsRewriting queries with winnowRetrieving Top-K elementsOptimizing Top-K queries

Jan Chomicki () Preference Queries 27 / 65

Page 102: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Winnow[Cho03]

Winnow

new relational algebra operator ω (other names: Best, BMO [Kie02])

retrieves the non-dominated (best) elements in a database relation

can be expressed in terms of other operators

Definition

Given a preference relation � and a database relation r :

ω�(r) = {t ∈ r | ¬∃t ′ ∈ r . t ′ � t}.

Notation: If a preference relation �C is defined using a formula C , thenwe write ωC (r), instead of ω�C

(r).

Skyline query

ω�sky (r) computes the set of maximal vectors in r (the skyline set).

Jan Chomicki () Preference Queries 28 / 65

Page 103: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Winnow[Cho03]

Winnow

new relational algebra operator ω (other names: Best, BMO [Kie02])

retrieves the non-dominated (best) elements in a database relation

can be expressed in terms of other operators

Definition

Given a preference relation � and a database relation r :

ω�(r) = {t ∈ r | ¬∃t ′ ∈ r . t ′ � t}.

Notation: If a preference relation �C is defined using a formula C , thenwe write ωC (r), instead of ω�C

(r).

Skyline query

ω�sky (r) computes the set of maximal vectors in r (the skyline set).

Jan Chomicki () Preference Queries 28 / 65

Page 104: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Winnow[Cho03]

Winnow

new relational algebra operator ω (other names: Best, BMO [Kie02])

retrieves the non-dominated (best) elements in a database relation

can be expressed in terms of other operators

Definition

Given a preference relation � and a database relation r :

ω�(r) = {t ∈ r | ¬∃t ′ ∈ r . t ′ � t}.

Notation: If a preference relation �C is defined using a formula C , thenwe write ωC (r), instead of ω�C

(r).

Skyline query

ω�sky (r) computes the set of maximal vectors in r (the skyline set).

Jan Chomicki () Preference Queries 28 / 65

Page 105: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Winnow[Cho03]

Winnow

new relational algebra operator ω (other names: Best, BMO [Kie02])

retrieves the non-dominated (best) elements in a database relation

can be expressed in terms of other operators

Definition

Given a preference relation � and a database relation r :

ω�(r) = {t ∈ r | ¬∃t ′ ∈ r . t ′ � t}.

Notation: If a preference relation �C is defined using a formula C , thenwe write ωC (r), instead of ω�C

(r).

Skyline query

ω�sky (r) computes the set of maximal vectors in r (the skyline set).

Jan Chomicki () Preference Queries 28 / 65

Page 106: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Winnow[Cho03]

Winnow

new relational algebra operator ω (other names: Best, BMO [Kie02])

retrieves the non-dominated (best) elements in a database relation

can be expressed in terms of other operators

Definition

Given a preference relation � and a database relation r :

ω�(r) = {t ∈ r | ¬∃t ′ ∈ r . t ′ � t}.

Notation: If a preference relation �C is defined using a formula C , thenwe write ωC (r), instead of ω�C

(r).

Skyline query

ω�sky (r) computes the set of maximal vectors in r (the skyline set).

Jan Chomicki () Preference Queries 28 / 65

Page 107: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Example of winnow

Relation Car(Make,Year ,Price)

Preference relation:

(m, y , p) �1 (m′, y ′, p′) ≡ y > y ′ ∨ (y = y ′ ∧ p < p′).

Make Year Price

mazda 2009 20K

ford 2009 15K

ford 2007 12K

Jan Chomicki () Preference Queries 29 / 65

Page 108: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Example of winnow

Relation Car(Make,Year ,Price)

Preference relation:

(m, y , p) �1 (m′, y ′, p′) ≡ y > y ′ ∨ (y = y ′ ∧ p < p′).

Make Year Price

mazda 2009 20K

ford 2009 15K

ford 2007 12K

Jan Chomicki () Preference Queries 29 / 65

Page 109: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Example of winnow

Relation Car(Make,Year ,Price)

Preference relation:

(m, y , p) �1 (m′, y ′, p′) ≡ y > y ′ ∨ (y = y ′ ∧ p < p′).

Make Year Price

mazda 2009 20K

ford 2009 15K

ford 2007 12K

Jan Chomicki () Preference Queries 29 / 65

Page 110: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Example of winnow

Relation Car(Make,Year ,Price)

Preference relation:

(m, y , p) �1 (m′, y ′, p′) ≡ y > y ′ ∨ (y = y ′ ∧ p < p′).

Make Year Price

mazda 2009 20K

ford 2009 15K

ford 2007 12K

Jan Chomicki () Preference Queries 29 / 65

Page 111: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Computing winnow using BNL [BKS01]

Require: SPO �, database relation r

1: initialize window W and temporary file F to empty2: repeat3: for every tuple t in the input do4: if t is dominated by a tuple in W then5: ignore t6: else if t dominates some tuples in W then7: eliminate them and insert t into W8: else if there is room in W then9: insert t into W

10: else11: add t to F12: end if13: end for14: output tuples from W that were added when F was empty15: make F the input, clear F16: until empty input

Jan Chomicki () Preference Queries 30 / 65

Page 112: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

BNL in action

Preference relation: a � c, a � d, b � e.

Window

Temporary file

Input

Jan Chomicki () Preference Queries 31 / 65

Page 113: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

BNL in action

Preference relation: a � c, a � d, b � e.

Window

Temporary file

Input

c,e,d,a,b

Jan Chomicki () Preference Queries 31 / 65

Page 114: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

BNL in action

Preference relation: a � c, a � d, b � e.

Window

c

Temporary file

Input

e,d,a,b

Jan Chomicki () Preference Queries 31 / 65

Page 115: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

BNL in action

Preference relation: a � c, a � d, b � e.

Window

c

e

Temporary file

Input

d,a,b

Jan Chomicki () Preference Queries 31 / 65

Page 116: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

BNL in action

Preference relation: a � c, a � d, b � e.

Window

c

e

Temporary file

d

Input

a,b

Jan Chomicki () Preference Queries 31 / 65

Page 117: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

BNL in action

Preference relation: a � c, a � d, b � e.

Window

a

e

Temporary file

d

Input

b

Jan Chomicki () Preference Queries 31 / 65

Page 118: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

BNL in action

Preference relation: a � c, a � d, b � e.

Window

a

b

Temporary file

d

Input

Jan Chomicki () Preference Queries 31 / 65

Page 119: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

BNL in action

Preference relation: a � c, a � d, b � e.

Window

a

b

Temporary file

Input

d

Jan Chomicki () Preference Queries 31 / 65

Page 120: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

BNL in action

Preference relation: a � c, a � d, b � e.

Window

a

b

Temporary file

Input

Jan Chomicki () Preference Queries 31 / 65

Page 121: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Computing winnow with presorting

SFS: adding presorting step to BNL [CGGL03]

topologically sort the input:

if x dominates y , then x precedes y in the sorted inputwindow contains only winnow points and can be output after every pass

for skylines: sort the input using a monotonic scoring function, forexample

∏ki=1 xi .

LESS: integrating different techniques [GSG07]

adding an elimination filter to the first external sort pass

combining the last external sort pass with the first SFS pass

average running time: O(kn)

Jan Chomicki () Preference Queries 32 / 65

Page 122: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Computing winnow with presorting

SFS: adding presorting step to BNL [CGGL03]

topologically sort the input:

if x dominates y , then x precedes y in the sorted inputwindow contains only winnow points and can be output after every pass

for skylines: sort the input using a monotonic scoring function, forexample

∏ki=1 xi .

LESS: integrating different techniques [GSG07]

adding an elimination filter to the first external sort pass

combining the last external sort pass with the first SFS pass

average running time: O(kn)

Jan Chomicki () Preference Queries 32 / 65

Page 123: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Computing winnow with presorting

SFS: adding presorting step to BNL [CGGL03]

topologically sort the input:

if x dominates y , then x precedes y in the sorted inputwindow contains only winnow points and can be output after every pass

for skylines: sort the input using a monotonic scoring function, forexample

∏ki=1 xi .

LESS: integrating different techniques [GSG07]

adding an elimination filter to the first external sort pass

combining the last external sort pass with the first SFS pass

average running time: O(kn)

Jan Chomicki () Preference Queries 32 / 65

Page 124: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

SFS in action

Preference relation: a � c, a � d, b � e.

Window

Temporary file

Input

Jan Chomicki () Preference Queries 33 / 65

Page 125: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

SFS in action

Preference relation: a � c, a � d, b � e.

Window

Temporary file

Input

a,b,c,d,e

Jan Chomicki () Preference Queries 33 / 65

Page 126: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

SFS in action

Preference relation: a � c, a � d, b � e.

Window

a

Temporary file

Input

b,c,d,e

Jan Chomicki () Preference Queries 33 / 65

Page 127: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

SFS in action

Preference relation: a � c, a � d, b � e.

Window

a

b

Temporary file

Input

c,d,e

Jan Chomicki () Preference Queries 33 / 65

Page 128: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

SFS in action

Preference relation: a � c, a � d, b � e.

Window

a

b

Temporary file

Input

d,e

Jan Chomicki () Preference Queries 33 / 65

Page 129: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

SFS in action

Preference relation: a � c, a � d, b � e.

Window

a

b

Temporary file

Input

e

Jan Chomicki () Preference Queries 33 / 65

Page 130: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

SFS in action

Preference relation: a � c, a � d, b � e.

Window

a

b

Temporary file

Input

Jan Chomicki () Preference Queries 33 / 65

Page 131: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Generalizations of winnow

Iterating winnow

ω0�(r) = ω�(r)

ωn+1� (r) = ω�(r −

⋃1≤i≤n ω

i�(r))

Ranking

Rank tuples by their minimum distance from a winnow tuple:

η�(r) = {(t, i) | t ∈ ωiC (r)}.

k-band

Return the tuples dominated by at most k tuples:

ω�(r) = {t ∈ r | #{t ′ ∈ r | t ′ � t} ≤ k}.

Jan Chomicki () Preference Queries 34 / 65

Page 132: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Generalizations of winnow

Iterating winnow

ω0�(r) = ω�(r)

ωn+1� (r) = ω�(r −

⋃1≤i≤n ω

i�(r))

Ranking

Rank tuples by their minimum distance from a winnow tuple:

η�(r) = {(t, i) | t ∈ ωiC (r)}.

k-band

Return the tuples dominated by at most k tuples:

ω�(r) = {t ∈ r | #{t ′ ∈ r | t ′ � t} ≤ k}.

Jan Chomicki () Preference Queries 34 / 65

Page 133: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Generalizations of winnow

Iterating winnow

ω0�(r) = ω�(r)

ωn+1� (r) = ω�(r −

⋃1≤i≤n ω

i�(r))

Ranking

Rank tuples by their minimum distance from a winnow tuple:

η�(r) = {(t, i) | t ∈ ωiC (r)}.

k-band

Return the tuples dominated by at most k tuples:

ω�(r) = {t ∈ r | #{t ′ ∈ r | t ′ � t} ≤ k}.

Jan Chomicki () Preference Queries 34 / 65

Page 134: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Generalizations of winnow

Iterating winnow

ω0�(r) = ω�(r)

ωn+1� (r) = ω�(r −

⋃1≤i≤n ω

i�(r))

Ranking

Rank tuples by their minimum distance from a winnow tuple:

η�(r) = {(t, i) | t ∈ ωiC (r)}.

k-band

Return the tuples dominated by at most k tuples:

ω�(r) = {t ∈ r | #{t ′ ∈ r | t ′ � t} ≤ k}.

Jan Chomicki () Preference Queries 34 / 65

Page 135: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference SQL

The language

basic preference constructors

Pareto/prioritized accumulation

new SQL clause PREFERRING

groupwise preferences

implementation: translation to SQL

Winnow in Preference SQLSELECT * FROM CarPREFERRING HIGHEST(Year)

CASCADE LOWEST(Price)

Jan Chomicki () Preference Queries 35 / 65

Page 136: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference SQL

The language

basic preference constructors

Pareto/prioritized accumulation

new SQL clause PREFERRING

groupwise preferences

implementation: translation to SQL

Winnow in Preference SQLSELECT * FROM CarPREFERRING HIGHEST(Year)

CASCADE LOWEST(Price)

Jan Chomicki () Preference Queries 35 / 65

Page 137: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference SQL

The language

basic preference constructors

Pareto/prioritized accumulation

new SQL clause PREFERRING

groupwise preferences

implementation: translation to SQL

Winnow in Preference SQLSELECT * FROM CarPREFERRING HIGHEST(Year)

CASCADE LOWEST(Price)

Jan Chomicki () Preference Queries 35 / 65

Page 138: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Algebraic laws [Cho03]

Commutativity of winnow with selection

If the formula

∀t1, t2.[α(t2) ∧ γ(t1, t2)]⇒ α(t1)

is valid, then for every r

σα(ωγ(r)) = ωγ(σα(r)).

Under the preference relation

(m, y , p) �C1 (m′, y ′, p′) ≡ y > y ′ ∧ p ≤ p′ ∨ y ≥ y ′ ∧ p < p′

the selection σPrice<20K commutes with ωC1 but σPrice>20K does not.

Jan Chomicki () Preference Queries 36 / 65

Page 139: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Algebraic laws [Cho03]

Commutativity of winnow with selection

If the formula

∀t1, t2.[α(t2) ∧ γ(t1, t2)]⇒ α(t1)

is valid, then for every r

σα(ωγ(r)) = ωγ(σα(r)).

Under the preference relation

(m, y , p) �C1 (m′, y ′, p′) ≡ y > y ′ ∧ p ≤ p′ ∨ y ≥ y ′ ∧ p < p′

the selection σPrice<20K commutes with ωC1 but σPrice>20K does not.

Jan Chomicki () Preference Queries 36 / 65

Page 140: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Algebraic laws [Cho03]

Commutativity of winnow with selection

If the formula

∀t1, t2.[α(t2) ∧ γ(t1, t2)]⇒ α(t1)

is valid, then for every r

σα(ωγ(r)) = ωγ(σα(r)).

Under the preference relation

(m, y , p) �C1 (m′, y ′, p′) ≡ y > y ′ ∧ p ≤ p′ ∨ y ≥ y ′ ∧ p < p′

the selection σPrice<20K commutes with ωC1 but σPrice>20K does not.

Jan Chomicki () Preference Queries 36 / 65

Page 141: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Other algebraic laws

Distributivity of winnow over Cartesian product

For every r1 and r2

ωC (r1 × r2) = ωC (r1)× r2

if C refers only to the attributes of r1.

Commutativity of winnow

If ∀t1, t2.[C1(t1, t2)⇒ C2(t1, t2)] is valid and �C1 and �C2 are SPOs, thenfor all finite instances r :

ωC1(ωC2(r)) = ωC2(ωC1(r)) = ωC2(r).

Jan Chomicki () Preference Queries 37 / 65

Page 142: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Other algebraic laws

Distributivity of winnow over Cartesian product

For every r1 and r2

ωC (r1 × r2) = ωC (r1)× r2

if C refers only to the attributes of r1.

Commutativity of winnow

If ∀t1, t2.[C1(t1, t2)⇒ C2(t1, t2)] is valid and �C1 and �C2 are SPOs, thenfor all finite instances r :

ωC1(ωC2(r)) = ωC2(ωC1(r)) = ωC2(r).

Jan Chomicki () Preference Queries 37 / 65

Page 143: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Semantic query optimization [Cho07b]

Using information about integrity constraints to:

eliminate redundant occurrences of winnow.

make more efficient computation of winnow possible.

Eliminating redundancy

Given a set of integrity constraints F , ωC is redundant w.r.t. F iff Fimplies the formula

∀t1, t2. R(t1) ∧ R(t2)⇒ t1 ∼C t2.

Jan Chomicki () Preference Queries 38 / 65

Page 144: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Semantic query optimization [Cho07b]

Using information about integrity constraints to:

eliminate redundant occurrences of winnow.

make more efficient computation of winnow possible.

Eliminating redundancy

Given a set of integrity constraints F , ωC is redundant w.r.t. F iff Fimplies the formula

∀t1, t2. R(t1) ∧ R(t2)⇒ t1 ∼C t2.

Jan Chomicki () Preference Queries 38 / 65

Page 145: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Integrity constraints

Constraint-generating dependencies (CGD) [BCW99, ZO97]

∀t1. . . .∀tn. [R(t1) ∧ · · · ∧ R(tn) ∧ γ(t1, . . . tn)]⇒ γ′(t1, . . . tn).

CGD entailment

Decidable by reduction to the validity of ∀-formulas in the constrainttheory (assuming the theory is decidable).

Jan Chomicki () Preference Queries 39 / 65

Page 146: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Integrity constraints

Constraint-generating dependencies (CGD) [BCW99, ZO97]

∀t1. . . .∀tn. [R(t1) ∧ · · · ∧ R(tn) ∧ γ(t1, . . . tn)]⇒ γ′(t1, . . . tn).

CGD entailment

Decidable by reduction to the validity of ∀-formulas in the constrainttheory (assuming the theory is decidable).

Jan Chomicki () Preference Queries 39 / 65

Page 147: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Integrity constraints

Constraint-generating dependencies (CGD) [BCW99, ZO97]

∀t1. . . .∀tn. [R(t1) ∧ · · · ∧ R(tn) ∧ γ(t1, . . . tn)]⇒ γ′(t1, . . . tn).

CGD entailment

Decidable by reduction to the validity of ∀-formulas in the constrainttheory (assuming the theory is decidable).

Jan Chomicki () Preference Queries 39 / 65

Page 148: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Top-K queries

Scoring functions

each tuple t in a relation has numeric scores f1(t), . . . , fm(t) assignedby numeric component scoring functions f1, . . . , fm

the aggregate score of t is F (t) = E (f1(t), . . . , fm(t)) where E is anumeric-valued expression

F is monotone if E (x1, . . . , xm) ≤ E (y1, . . . , ym) whenever xi ≤ yi forall i

Top-K queries

return K elements having top F -values in a database relation R

query expressed in an extension of SQL:

SELECT *FROM RORDER BY F DESCLIMIT K

Jan Chomicki () Preference Queries 40 / 65

Page 149: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Top-K queries

Scoring functions

each tuple t in a relation has numeric scores f1(t), . . . , fm(t) assignedby numeric component scoring functions f1, . . . , fm

the aggregate score of t is F (t) = E (f1(t), . . . , fm(t)) where E is anumeric-valued expression

F is monotone if E (x1, . . . , xm) ≤ E (y1, . . . , ym) whenever xi ≤ yi forall i

Top-K queries

return K elements having top F -values in a database relation R

query expressed in an extension of SQL:

SELECT *FROM RORDER BY F DESCLIMIT K

Jan Chomicki () Preference Queries 40 / 65

Page 150: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Top-K queries

Scoring functions

each tuple t in a relation has numeric scores f1(t), . . . , fm(t) assignedby numeric component scoring functions f1, . . . , fm

the aggregate score of t is F (t) = E (f1(t), . . . , fm(t)) where E is anumeric-valued expression

F is monotone if E (x1, . . . , xm) ≤ E (y1, . . . , ym) whenever xi ≤ yi forall i

Top-K queries

return K elements having top F -values in a database relation R

query expressed in an extension of SQL:

SELECT *FROM RORDER BY F DESCLIMIT K

Jan Chomicki () Preference Queries 40 / 65

Page 151: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Top-K sets

Definition

Given a scoring function F and a database relation r , s is a Top-K set if:

s ⊆ r

|s| = min(K , |r |)∀t ∈ s. ∀t ′ ∈ r − s. F (t) ≥ F (t ′)

There may be more than one Top-K set: one is selectednon-deterministically.

Jan Chomicki () Preference Queries 41 / 65

Page 152: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Top-K sets

Definition

Given a scoring function F and a database relation r , s is a Top-K set if:

s ⊆ r

|s| = min(K , |r |)∀t ∈ s. ∀t ′ ∈ r − s. F (t) ≥ F (t ′)

There may be more than one Top-K set: one is selectednon-deterministically.

Jan Chomicki () Preference Queries 41 / 65

Page 153: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Example of Top-2

Relation Car(Make,Year ,Price)

component scoring functions:

f1(m, y , p) = (y − 2005)

f2(m, y , p) = (20000− p)

aggregate scoring function:F (m, y , p) = 1000 · f1(m, y , p) + f2(m, y , p)

Make Year Price Aggregate score

mazda 2009 20000 4000

ford 2009 15000 9000

ford 2007 12000 10000

Jan Chomicki () Preference Queries 42 / 65

Page 154: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Example of Top-2

Relation Car(Make,Year ,Price)

component scoring functions:

f1(m, y , p) = (y − 2005)

f2(m, y , p) = (20000− p)

aggregate scoring function:F (m, y , p) = 1000 · f1(m, y , p) + f2(m, y , p)

Make Year Price Aggregate score

mazda 2009 20000 4000

ford 2009 15000 9000

ford 2007 12000 10000

Jan Chomicki () Preference Queries 42 / 65

Page 155: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Example of Top-2

Relation Car(Make,Year ,Price)

component scoring functions:

f1(m, y , p) = (y − 2005)

f2(m, y , p) = (20000− p)

aggregate scoring function:F (m, y , p) = 1000 · f1(m, y , p) + f2(m, y , p)

Make Year Price Aggregate score

mazda 2009 20000 4000

ford 2009 15000 9000

ford 2007 12000 10000

Jan Chomicki () Preference Queries 42 / 65

Page 156: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Example of Top-2

Relation Car(Make,Year ,Price)

component scoring functions:

f1(m, y , p) = (y − 2005)

f2(m, y , p) = (20000− p)

aggregate scoring function:F (m, y , p) = 1000 · f1(m, y , p) + f2(m, y , p)

Make Year Price Aggregate score

mazda 2009 20000 4000

ford 2009 15000 9000

ford 2007 12000 10000

Jan Chomicki () Preference Queries 42 / 65

Page 157: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Computing Top-K

Naive approaches

sort, output the first K -tuples

scan the input maintaining a priority queue of size K

...

Better approaches

the entire input does not need to be scanned...

... provided additional data structures are available

variants of the threshold algorithm

Jan Chomicki () Preference Queries 43 / 65

Page 158: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Computing Top-K

Naive approaches

sort, output the first K -tuples

scan the input maintaining a priority queue of size K

...

Better approaches

the entire input does not need to be scanned...

... provided additional data structures are available

variants of the threshold algorithm

Jan Chomicki () Preference Queries 43 / 65

Page 159: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Computing Top-K

Naive approaches

sort, output the first K -tuples

scan the input maintaining a priority queue of size K

...

Better approaches

the entire input does not need to be scanned...

... provided additional data structures are available

variants of the threshold algorithm

Jan Chomicki () Preference Queries 43 / 65

Page 160: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Computing Top-K

Naive approaches

sort, output the first K -tuples

scan the input maintaining a priority queue of size K

...

Better approaches

the entire input does not need to be scanned...

... provided additional data structures are available

variants of the threshold algorithm

Jan Chomicki () Preference Queries 43 / 65

Page 161: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Computing Top-K

Naive approaches

sort, output the first K -tuples

scan the input maintaining a priority queue of size K

...

Better approaches

the entire input does not need to be scanned...

... provided additional data structures are available

variants of the threshold algorithm

Jan Chomicki () Preference Queries 43 / 65

Page 162: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Computing Top-K

Naive approaches

sort, output the first K -tuples

scan the input maintaining a priority queue of size K

...

Better approaches

the entire input does not need to be scanned...

... provided additional data structures are available

variants of the threshold algorithm

Jan Chomicki () Preference Queries 43 / 65

Page 163: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Threshold algorithm (TA)[FLN03]

Inputs

a monotone scoring function F (t) = E (f1(t), . . . , fm(t))

lists Si , i = 1, . . . ,m, each sorted on fi (descending) and representing adifferent ranking of the same set of objects

1 For each list Si in parallel retrieve the current object w in sorted order:

(random access) for every j 6= i , retrieve vj = fj(w) from the list Sj

if d = E (v1, . . . , vm) is among the highest K scores seen so far,remember t and d (ties broken arbitrarily)

2 Thresholding:

for each i : wi the last object seen under sorted access in Si

if there are already K top-K objects with score at least equal to thethreshold T = E (f1(w1), . . . , fm(wm)), return collected objects sortedby F and terminateotherwise, go to step 1.

Jan Chomicki () Preference Queries 44 / 65

Page 164: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Threshold algorithm (TA)[FLN03]

Inputs

a monotone scoring function F (t) = E (f1(t), . . . , fm(t))

lists Si , i = 1, . . . ,m, each sorted on fi (descending) and representing adifferent ranking of the same set of objects

1 For each list Si in parallel retrieve the current object w in sorted order:

(random access) for every j 6= i , retrieve vj = fj(w) from the list Sj

if d = E (v1, . . . , vm) is among the highest K scores seen so far,remember t and d (ties broken arbitrarily)

2 Thresholding:

for each i : wi the last object seen under sorted access in Si

if there are already K top-K objects with score at least equal to thethreshold T = E (f1(w1), . . . , fm(wm)), return collected objects sortedby F and terminateotherwise, go to step 1.

Jan Chomicki () Preference Queries 44 / 65

Page 165: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

TA in action

Aggregate score

F (t) = P1(t) + P2(t)

Priority queue

OID P1

5 50

1 35

3 30

2 20

4 10

OID P2

3 50

2 40

1 30

4 20

5 10

Jan Chomicki () Preference Queries 45 / 65

Page 166: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

TA in action

Aggregate score

F (t) = P1(t) + P2(t)

Priority queue

T=100

OID P1

5 50

1 35

3 30

2 20

4 10

OID P2

3 50

2 40

1 30

4 20

5 10

Jan Chomicki () Preference Queries 45 / 65

Page 167: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

TA in action

Aggregate score

F (t) = P1(t) + P2(t)

Priority queue

5:60

T=100

OID P1

5 50

1 35

3 30

2 20

4 10

OID P2

3 50

2 40

1 30

4 20

5 10

Jan Chomicki () Preference Queries 45 / 65

Page 168: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

TA in action

Aggregate score

F (t) = P1(t) + P2(t)

Priority queue

3:80

5:60

T=100

OID P1

5 50

1 35

3 30

2 20

4 10

OID P2

3 50

2 40

1 30

4 20

5 10

Jan Chomicki () Preference Queries 45 / 65

Page 169: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

TA in action

Aggregate score

F (t) = P1(t) + P2(t)

Priority queue

3:80

5:60

T=75

OID P1

5 50

1 35

3 30

2 20

4 10

OID P2

3 50

2 40

1 30

4 20

5 10

Jan Chomicki () Preference Queries 45 / 65

Page 170: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

TA in action

Aggregate score

F (t) = P1(t) + P2(t)

Priority queue

3:80

1:65

5:60

T=75

OID P1

5 50

1 35

3 30

2 20

4 10

OID P2

3 50

2 40

1 30

4 20

5 10

Jan Chomicki () Preference Queries 45 / 65

Page 171: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

TA in action

Aggregate score

F (t) = P1(t) + P2(t)

Priority queue

3:80

1:65

5:60

2:60

T=75

OID P1

5 50

1 35

3 30

2 20

4 10

OID P2

3 50

2 40

1 30

4 20

5 10

Jan Chomicki () Preference Queries 45 / 65

Page 172: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

TA in databases

objects: tuples of a single relation r

single-attribute component scoring functions

sorted list access implemented through indexes

random access to all lists implemented by primary index access to rthat retrieves entire tuples

Jan Chomicki () Preference Queries 46 / 65

Page 173: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

TA in databases

objects: tuples of a single relation r

single-attribute component scoring functions

sorted list access implemented through indexes

random access to all lists implemented by primary index access to rthat retrieves entire tuples

Jan Chomicki () Preference Queries 46 / 65

Page 174: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Optimizing Top-K queries [LCIS05]

Goals

integrating Top-K with relational query evaluation and optimization

replacing blocking by pipelining

Example

SELECT *FROM Hotel h, Restaurant r, Museum mWHERE c1 AND c2 AND c3

ORDER BY f1 + f2 + f3LIMIT K

Is there a better evaluation plan than materialize-then-sort?

Jan Chomicki () Preference Queries 47 / 65

Page 175: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Optimizing Top-K queries [LCIS05]

Goals

integrating Top-K with relational query evaluation and optimization

replacing blocking by pipelining

Example

SELECT *FROM Hotel h, Restaurant r, Museum mWHERE c1 AND c2 AND c3

ORDER BY f1 + f2 + f3LIMIT K

Is there a better evaluation plan than materialize-then-sort?

Jan Chomicki () Preference Queries 47 / 65

Page 176: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Optimizing Top-K queries [LCIS05]

Goals

integrating Top-K with relational query evaluation and optimization

replacing blocking by pipelining

Example

SELECT *FROM Hotel h, Restaurant r, Museum mWHERE c1 AND c2 AND c3

ORDER BY f1 + f2 + f3LIMIT K

Is there a better evaluation plan than materialize-then-sort?

Jan Chomicki () Preference Queries 47 / 65

Page 177: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Optimizing Top-K queries [LCIS05]

Goals

integrating Top-K with relational query evaluation and optimization

replacing blocking by pipelining

Example

SELECT *FROM Hotel h, Restaurant r, Museum mWHERE c1 AND c2 AND c3

ORDER BY f1 + f2 + f3LIMIT K

Is there a better evaluation plan than materialize-then-sort?

Jan Chomicki () Preference Queries 47 / 65

Page 178: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Partial ranking of tuples

Model

set of component scoring functions P = {f1, . . . , fm} such thatfi (t) ≤ 1 for all t

aggregate scoring function F (t) = E (f1(t), . . . , fm(t))

how to rank intermediate tuples?

Ranking principle

Given P0 ⊆ P,

FP0(t) = E (g1(t), . . . , gm(t))

where

gi (t) =

fi (t) if fi ∈ P0

1 otherwise

Jan Chomicki () Preference Queries 48 / 65

Page 179: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Partial ranking of tuples

Model

set of component scoring functions P = {f1, . . . , fm} such thatfi (t) ≤ 1 for all t

aggregate scoring function F (t) = E (f1(t), . . . , fm(t))

how to rank intermediate tuples?

Ranking principle

Given P0 ⊆ P,

FP0(t) = E (g1(t), . . . , gm(t))

where

gi (t) =

fi (t) if fi ∈ P0

1 otherwise

Jan Chomicki () Preference Queries 48 / 65

Page 180: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Partial ranking of tuples

Model

set of component scoring functions P = {f1, . . . , fm} such thatfi (t) ≤ 1 for all t

aggregate scoring function F (t) = E (f1(t), . . . , fm(t))

how to rank intermediate tuples?

Ranking principle

Given P0 ⊆ P,

FP0(t) = E (g1(t), . . . , gm(t))

where

gi (t) =

fi (t) if fi ∈ P0

1 otherwise

Jan Chomicki () Preference Queries 48 / 65

Page 181: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Relations with rank

Rank-relation RP0

relation R

monotone aggregate scoring function F (the same for all relations)

set of component scoring functions P0 ⊆ P

order:

t1 >RP0t2 ≡ FP0(t1) > FP0(t2)

Jan Chomicki () Preference Queries 49 / 65

Page 182: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Relations with rank

Rank-relation RP0

relation R

monotone aggregate scoring function F (the same for all relations)

set of component scoring functions P0 ⊆ P

order:

t1 >RP0t2 ≡ FP0(t1) > FP0(t2)

Jan Chomicki () Preference Queries 49 / 65

Page 183: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Ranking intermediate results

Operators

rank operator µf : ranks tuples according to an additional componentscoring function f

standard relational algebra operators suitably extended to work onrank-relations

Operator Order

µf (RP0) t1 >µf (RP0) t2 ≡ FP0∪{f }(t1) > FP0∪{f }(t2)

RP1 ∩ SP2 t1 >RP1∩SP2

t2 ≡ FP1∪P2(t1) > FP1∪P2(t2)

Jan Chomicki () Preference Queries 50 / 65

Page 184: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Ranking intermediate results

Operators

rank operator µf : ranks tuples according to an additional componentscoring function f

standard relational algebra operators suitably extended to work onrank-relations

Operator Order

µf (RP0) t1 >µf (RP0) t2 ≡ FP0∪{f }(t1) > FP0∪{f }(t2)

RP1 ∩ SP2 t1 >RP1∩SP2

t2 ≡ FP1∪P2(t1) > FP1∪P2(t2)

Jan Chomicki () Preference Queries 50 / 65

Page 185: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Ranking intermediate results

Operators

rank operator µf : ranks tuples according to an additional componentscoring function f

standard relational algebra operators suitably extended to work onrank-relations

Operator Order

µf (RP0) t1 >µf (RP0) t2 ≡ FP0∪{f }(t1) > FP0∪{f }(t2)

RP1 ∩ SP2 t1 >RP1∩SP2

t2 ≡ FP1∪P2(t1) > FP1∪P2(t2)

Jan Chomicki () Preference Queries 50 / 65

Page 186: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Example

Query

SELECT *FROM SORDER BY f1 + f2 + f3LIMIT 1

Unranked relation S

A f1 f2 f3

1 0.7 0.8 0.9

2 0.9 0.85 0.8

3 0.5 0.45 0.75

Rank-relation S{f1}

A F{f1}

2 2.9

1 2.7

3 2.5

Jan Chomicki () Preference Queries 51 / 65

Page 187: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Example

Query

SELECT *FROM SORDER BY f1 + f2 + f3LIMIT 1

Unranked relation S

A f1 f2 f3

1 0.7 0.8 0.9

2 0.9 0.85 0.8

3 0.5 0.45 0.75

Rank-relation S{f1}

A F{f1}

2 2.9

1 2.7

3 2.5

Jan Chomicki () Preference Queries 51 / 65

Page 188: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Example

Query

SELECT *FROM SORDER BY f1 + f2 + f3LIMIT 1

Unranked relation S

A f1 f2 f3

1 0.7 0.8 0.9

2 0.9 0.85 0.8

3 0.5 0.45 0.75

Rank-relation S{f1}

A F{f1}

2 2.9

1 2.7

3 2.5

Jan Chomicki () Preference Queries 51 / 65

Page 189: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Example

Query

SELECT *FROM SORDER BY f1 + f2 + f3LIMIT 1

Unranked relation S

A f1 f2 f3

1 0.7 0.8 0.9

2 0.9 0.85 0.8

3 0.5 0.45 0.75

Rank-relation S{f1}

A F{f1}

2 2.9

1 2.7

3 2.5

Jan Chomicki () Preference Queries 51 / 65

Page 190: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Pipelined execution

A f1 f2 f3 F{f1}

2 0.9 0.85 0.8 2.9

1 0.7 0.8 0.9 2.7

3 0.5 0.45 0.75 2.5

IndexScanf1

A F{f1,f2}

2 2.75

1 2.5

3 1.95

µf2

A F{f1,f2,f3}

2 2.55

1 2.4

µf3

Jan Chomicki () Preference Queries 52 / 65

Page 191: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Pipelined execution

A f1 f2 f3 F{f1}

2 0.9 0.85 0.8 2.9

1 0.7 0.8 0.9 2.7

3 0.5 0.45 0.75 2.5

IndexScanf1

A F{f1,f2}

2 2.75

1 2.5

3 1.95

µf2

A F{f1,f2,f3}

2 2.55

1 2.4

µf3

Jan Chomicki () Preference Queries 52 / 65

Page 192: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Pipelined execution

A f1 f2 f3 F{f1}

2 0.9 0.85 0.8 2.9

1 0.7 0.8 0.9 2.7

3 0.5 0.45 0.75 2.5

IndexScanf1

A F{f1,f2}

2 2.75

1 2.5

3 1.95

µf2

A F{f1,f2,f3}

2 2.55

1 2.4

µf3

Jan Chomicki () Preference Queries 52 / 65

Page 193: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Pipelined execution

A f1 f2 f3 F{f1}

2 0.9 0.85 0.8 2.9

1 0.7 0.8 0.9 2.7

3 0.5 0.45 0.75 2.5

IndexScanf1

A F{f1,f2}

2 2.75

1 2.5

3 1.95

µf2

A F{f1,f2,f3}

2 2.55

1 2.4

µf3

Jan Chomicki () Preference Queries 52 / 65

Page 194: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Algebraic laws for rank-relation operators

Splitting for µ

R{f1,f2,...,fm} ≡ µf1(µf2(. . . (µfm (R)) . . .))

Commutativity of µ

µf1(µf2(RP0)) ≡ µf2(µf1(RP0))

Commutativity of µ with selection

σC (µf (RP0)) ≡ µf (σC (RP0))

Distributivity of µ over Cartesian product

µf (RP1 × SP2) ≡ µf (RP1)× SP2 if f refers only to the attributes of R.

Jan Chomicki () Preference Queries 53 / 65

Page 195: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Algebraic laws for rank-relation operators

Splitting for µ

R{f1,f2,...,fm} ≡ µf1(µf2(. . . (µfm (R)) . . .))

Commutativity of µ

µf1(µf2(RP0)) ≡ µf2(µf1(RP0))

Commutativity of µ with selection

σC (µf (RP0)) ≡ µf (σC (RP0))

Distributivity of µ over Cartesian product

µf (RP1 × SP2) ≡ µf (RP1)× SP2 if f refers only to the attributes of R.

Jan Chomicki () Preference Queries 53 / 65

Page 196: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Algebraic laws for rank-relation operators

Splitting for µ

R{f1,f2,...,fm} ≡ µf1(µf2(. . . (µfm (R)) . . .))

Commutativity of µ

µf1(µf2(RP0)) ≡ µf2(µf1(RP0))

Commutativity of µ with selection

σC (µf (RP0)) ≡ µf (σC (RP0))

Distributivity of µ over Cartesian product

µf (RP1 × SP2) ≡ µf (RP1)× SP2 if f refers only to the attributes of R.

Jan Chomicki () Preference Queries 53 / 65

Page 197: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Algebraic laws for rank-relation operators

Splitting for µ

R{f1,f2,...,fm} ≡ µf1(µf2(. . . (µfm (R)) . . .))

Commutativity of µ

µf1(µf2(RP0)) ≡ µf2(µf1(RP0))

Commutativity of µ with selection

σC (µf (RP0)) ≡ µf (σC (RP0))

Distributivity of µ over Cartesian product

µf (RP1 × SP2) ≡ µf (RP1)× SP2 if f refers only to the attributes of R.

Jan Chomicki () Preference Queries 53 / 65

Page 198: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Algebraic laws for rank-relation operators

Splitting for µ

R{f1,f2,...,fm} ≡ µf1(µf2(. . . (µfm (R)) . . .))

Commutativity of µ

µf1(µf2(RP0)) ≡ µf2(µf1(RP0))

Commutativity of µ with selection

σC (µf (RP0)) ≡ µf (σC (RP0))

Distributivity of µ over Cartesian product

µf (RP1 × SP2) ≡ µf (RP1)× SP2 if f refers only to the attributes of R.

Jan Chomicki () Preference Queries 53 / 65

Page 199: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Part III

Preference management

Jan Chomicki () Preference Queries 54 / 65

Page 200: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Outline of Part III

3 Preference managementPreference modification

Jan Chomicki () Preference Queries 55 / 65

Page 201: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference modification

Goal

Given a preference relation � and additional preference or indifferenceinformation I , construct a new preference relation �′ whose contentsdepend on � and I .

General postulates

fulfillment: the new information I should be completely incorporatedinto �′

minimal change: � should be changed as little as possible

closure:

order-theoretic properties of � should be preserved in �′ (SPO, WO)finiteness or finite representability of � should also be preserved in �′

Jan Chomicki () Preference Queries 56 / 65

Page 202: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference modification

Goal

Given a preference relation � and additional preference or indifferenceinformation I , construct a new preference relation �′ whose contentsdepend on � and I .

General postulates

fulfillment: the new information I should be completely incorporatedinto �′

minimal change: � should be changed as little as possible

closure:

order-theoretic properties of � should be preserved in �′ (SPO, WO)finiteness or finite representability of � should also be preserved in �′

Jan Chomicki () Preference Queries 56 / 65

Page 203: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference modification

Goal

Given a preference relation � and additional preference or indifferenceinformation I , construct a new preference relation �′ whose contentsdepend on � and I .

General postulates

fulfillment: the new information I should be completely incorporatedinto �′

minimal change: � should be changed as little as possible

closure:

order-theoretic properties of � should be preserved in �′ (SPO, WO)finiteness or finite representability of � should also be preserved in �′

Jan Chomicki () Preference Queries 56 / 65

Page 204: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference revision [Cho07a]

Setting

new information: revising preference relation �0

composition operator θ: union, prioritized or Pareto composition

composition eliminates (some) preference conflicts

additional assumptions: interval orders

�′= TC (�0 θ �) to guarantee SPO

VW , 2009

VW , 2008

VW , 2007

Kia, 2009

Kia, 2008

Kia, 2007

Jan Chomicki () Preference Queries 57 / 65

Page 205: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference revision [Cho07a]

Setting

new information: revising preference relation �0

composition operator θ: union, prioritized or Pareto composition

composition eliminates (some) preference conflicts

additional assumptions: interval orders

�′= TC (�0 θ �) to guarantee SPO

VW , 2009

VW , 2008

VW , 2007

Kia, 2009

Kia, 2008

Kia, 2007

Jan Chomicki () Preference Queries 57 / 65

Page 206: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference revision [Cho07a]

Setting

new information: revising preference relation �0

composition operator θ: union, prioritized or Pareto composition

composition eliminates (some) preference conflicts

additional assumptions: interval orders

�′= TC (�0 θ �) to guarantee SPO

VW , 2009

VW , 2008

VW , 2007

Kia, 2009

Kia, 2008

Kia, 2007

Jan Chomicki () Preference Queries 57 / 65

Page 207: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference revision [Cho07a]

Setting

new information: revising preference relation �0

composition operator θ: union, prioritized or Pareto composition

composition eliminates (some) preference conflicts

additional assumptions: interval orders

�′= TC (�0 θ �) to guarantee SPO

VW , 2009

VW , 2008

VW , 2007

Kia, 2009

Kia, 2008

Kia, 2007

Jan Chomicki () Preference Queries 57 / 65

Page 208: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference revision [Cho07a]

Setting

new information: revising preference relation �0

composition operator θ: union, prioritized or Pareto composition

composition eliminates (some) preference conflicts

additional assumptions: interval orders

�′= TC (�0 θ �) to guarantee SPO

VW , 2009

VW , 2008

VW , 2007

Kia, 2009

Kia, 2008

Kia, 2007

Jan Chomicki () Preference Queries 57 / 65

Page 209: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference contraction [MC08]

Setting

new information: contractor relation CON

�′: maximal subset of � disjoint with CON

VW , 2009

VW , 2008

VW , 2007

VW , 2006

VW , 2005

Jan Chomicki () Preference Queries 58 / 65

Page 210: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference contraction [MC08]

Setting

new information: contractor relation CON

�′: maximal subset of � disjoint with CON

VW , 2009

VW , 2008

VW , 2007

VW , 2006

VW , 2005

Jan Chomicki () Preference Queries 58 / 65

Page 211: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference contraction [MC08]

Setting

new information: contractor relation CON

�′: maximal subset of � disjoint with CON

VW , 2009

VW , 2008

VW , 2007

VW , 2006

VW , 2005

Jan Chomicki () Preference Queries 58 / 65

Page 212: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference contraction [MC08]

Setting

new information: contractor relation CON

�′: maximal subset of � disjoint with CON

VW , 2009

VW , 2008

VW , 2007

VW , 2006

VW , 2005

Jan Chomicki () Preference Queries 58 / 65

Page 213: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference contraction [MC08]

Setting

new information: contractor relation CON

�′: maximal subset of � disjoint with CON

VW , 2009

VW , 2008

VW , 2007

VW , 2006

VW , 2005

Jan Chomicki () Preference Queries 58 / 65

Page 214: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Substitutability [BGS06]

Setting

new information: set of indifference pairs

additional preferences are added to convert indifference to restrictedindifference

achieving object substitutability

VW , 2009

VW , 2008

VW , 2007

Kia, 2009

Kia, 2008

Kia, 2007

Jan Chomicki () Preference Queries 59 / 65

Page 215: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Substitutability [BGS06]

Setting

new information: set of indifference pairs

additional preferences are added to convert indifference to restrictedindifference

achieving object substitutability

VW , 2009

VW , 2008

VW , 2007

Kia, 2009

Kia, 2008

Kia, 2007

Jan Chomicki () Preference Queries 59 / 65

Page 216: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Substitutability [BGS06]

Setting

new information: set of indifference pairs

additional preferences are added to convert indifference to restrictedindifference

achieving object substitutability

VW , 2009

VW , 2008

VW , 2007

Kia, 2009

Kia, 2008

Kia, 2007

Jan Chomicki () Preference Queries 59 / 65

Page 217: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Substitutability [BGS06]

Setting

new information: set of indifference pairs

additional preferences are added to convert indifference to restrictedindifference

achieving object substitutability

VW , 2009

VW , 2008

VW , 2007

Kia, 2009

Kia, 2008

Kia, 2007

Jan Chomicki () Preference Queries 59 / 65

Page 218: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Substitutability [BGS06]

Setting

new information: set of indifference pairs

additional preferences are added to convert indifference to restrictedindifference

achieving object substitutability

VW , 2009

VW , 2008

VW , 2007

Kia, 2009

Kia, 2008

Kia, 2007

Jan Chomicki () Preference Queries 59 / 65

Page 219: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Part IV

Advanced topics

Jan Chomicki () Preference Queries 60 / 65

Page 220: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Outline of Part IV

Jan Chomicki () Preference Queries 61 / 65

Page 221: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Prospective research topics

Definability

Given a preference relation �C , how to construct a definition of a scoringfunction F representing �C , if such a function exists?

Extrinsic preference relations

Preference relations that are not fully defined by tuple contents:

x � y ≡ BMW (x) ∧ Kia(y)

where BMW and Kia are database relations.

Incomplete preferences

tuple scores and probabilities [SIC08, ZC08]

uncertain tuple scores

disjunctive preferences: a � b ∨ a � c

Jan Chomicki () Preference Queries 62 / 65

Page 222: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Prospective research topics

Definability

Given a preference relation �C , how to construct a definition of a scoringfunction F representing �C , if such a function exists?

Extrinsic preference relations

Preference relations that are not fully defined by tuple contents:

x � y ≡ BMW (x) ∧ Kia(y)

where BMW and Kia are database relations.

Incomplete preferences

tuple scores and probabilities [SIC08, ZC08]

uncertain tuple scores

disjunctive preferences: a � b ∨ a � c

Jan Chomicki () Preference Queries 62 / 65

Page 223: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Prospective research topics

Definability

Given a preference relation �C , how to construct a definition of a scoringfunction F representing �C , if such a function exists?

Extrinsic preference relations

Preference relations that are not fully defined by tuple contents:

x � y ≡ BMW (x) ∧ Kia(y)

where BMW and Kia are database relations.

Incomplete preferences

tuple scores and probabilities [SIC08, ZC08]

uncertain tuple scores

disjunctive preferences: a � b ∨ a � c

Jan Chomicki () Preference Queries 62 / 65

Page 224: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Prospective research topics

Definability

Given a preference relation �C , how to construct a definition of a scoringfunction F representing �C , if such a function exists?

Extrinsic preference relations

Preference relations that are not fully defined by tuple contents:

x � y ≡ BMW (x) ∧ Kia(y)

where BMW and Kia are database relations.

Incomplete preferences

tuple scores and probabilities [SIC08, ZC08]

uncertain tuple scores

disjunctive preferences: a � b ∨ a � c

Jan Chomicki () Preference Queries 62 / 65

Page 225: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference modification

beyond revision and contraction: merging, arbitration,...

general parametric framework?

conflict resolution

Variations

preference and similarity: “find the objects similar to one of the bestobjects”

Applications

preference queries as decision components: workflows, event systems

personalization of query results

preference negotiation: applying contraction

Jan Chomicki () Preference Queries 63 / 65

Page 226: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference modification

beyond revision and contraction: merging, arbitration,...

general parametric framework?

conflict resolution

Variations

preference and similarity: “find the objects similar to one of the bestobjects”

Applications

preference queries as decision components: workflows, event systems

personalization of query results

preference negotiation: applying contraction

Jan Chomicki () Preference Queries 63 / 65

Page 227: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference modification

beyond revision and contraction: merging, arbitration,...

general parametric framework?

conflict resolution

Variations

preference and similarity: “find the objects similar to one of the bestobjects”

Applications

preference queries as decision components: workflows, event systems

personalization of query results

preference negotiation: applying contraction

Jan Chomicki () Preference Queries 63 / 65

Page 228: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference modification

beyond revision and contraction: merging, arbitration,...

general parametric framework?

conflict resolution

Variations

preference and similarity: “find the objects similar to one of the bestobjects”

Applications

preference queries as decision components: workflows, event systems

personalization of query results

preference negotiation: applying contraction

Jan Chomicki () Preference Queries 63 / 65

Page 229: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

AcknowledgmentsDenis MindolinS lawek StaworkoXi Zhang

Jan Chomicki () Preference Queries 64 / 65

Page 230: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Jan Chomicki () Preference Queries 65 / 65

Page 231: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

M. Baudinet, J. Chomicki, and P. Wolper.Constraint-Generating Dependencies.Journal of Computer and System Sciences, 59:94–115, 1999.Preliminary version in ICDT’95.

W-T. Balke, U. Guntzer, and W. Siberski.Exploiting Indifference for Customization of Partial Order Skylines.In International Database Engineering and Applications Symposium(IDEAS), pages 80–88, 2006.

S. Borzsonyi, D. Kossmann, and K. Stocker.The Skyline Operator.In IEEE International Conference on Data Engineering (ICDE), pages421–430, 2001.

J. Chomicki, P. Godfrey, J. Gryz, and D. Liang.Skyline with Presorting.In IEEE International Conference on Data Engineering (ICDE), 2003.Poster.

J. Chomicki.

Jan Chomicki () Preference Queries 65 / 65

Page 232: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Preference Formulas in Relational Queries.ACM Transactions on Database Systems, 28(4):427–466, December2003.

J. Chomicki.Database Querying under Changing Preferences.Annals of Mathematics and Artificial Intelligence, 50(1-2):79–109,2007.

J. Chomicki.Semantic optimization techniques for preference queries.Information Systems, 32(5):660–674, 2007.

R. Fagin, A. Lotem, and M. Naor.Optimal Aggregation Algorithms for Middleware.Journal of Computer and System Sciences, 66(4):614–656, 2003.

P. Godfrey, R. Shipley, and J. Gryz.Algorithms and Analyses for Maximal Vector Computation.VLDB Journal, 16:5–28, 2007.

W. Kießling.

Jan Chomicki () Preference Queries 65 / 65

Page 233: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

Foundations of Preferences in Database Systems.In International Conference on Very Large Data Bases (VLDB), pages311–322, 2002.

W. Kießling and G. Kostler.Preference SQL - Design, Implementation, Experience.In International Conference on Very Large Data Bases (VLDB), pages990–1001, 2002.

C. Li, K. C-C. Chang, I.F. Ilyas, and S. Song.RankSQL: Query Algebra and Optimization for Relational Top-kQueries.In ACM SIGMOD International Conference on Management of Data,pages 131–142, 2005.

D. Mindolin and J. Chomicki.Maximal Contraction of Preference Relations.In National Conference on Artificial Intelligence, pages 492–497, 2008.

M.A. Soliman, I.F. Ilyas, and K. C-C. Chang.Probabilistic Top-k and Ranking-Aggregate Queries.

Jan Chomicki () Preference Queries 65 / 65

Page 234: Foundations of Preference Queries - cse.buffalo.educhomicki/talk-prefs09.pdf · Foundations of Preference Queries Jan Chomicki University at Bu alo Jan Chomicki Preference Queries

ACM Transactions on Database Systems, 33(3):13:1–13:54, 2008.

X. Zhang and J. Chomicki.On the Semantics and Evaluation of Top-k Queries in ProbabilisticDatabases.In International Workshop on Database Ranking (DBRank). IEEEComputer Society (ICDE Workshops), 2008.

X. Zhang and Z. M. Ozsoyoglu.Implication and Referential Constraints: A New Formal Reasoning.IEEE Transactions on Knowledge and Data Engineering,9(6):894–910, 1997.

Jan Chomicki () Preference Queries 65 / 65