complex_pref {rPref} | R Documentation |
Complex Preferences
Description
Complex preferences are used to compose different preference orders.
For example the Pareto composition (via operator *
) is the usual operator
to compose the preference for a Skyline query. The Skyline is also known as Pareto frontier.
All complex preferences are mathematically strict partial orders (irreflexive and transitive).
Usage
## S4 method for signature 'preference,preference'
e1 * e2
## S4 method for signature 'preference,preference'
e1 & e2
## S4 method for signature 'preference,preference'
e1 | e2
## S4 method for signature 'preference,preference'
e1 + e2
reverse(p)
is.complex_pref(x)
Arguments
p , e1 , e2 |
Preference objects (they can be either base preferences, see |
x |
An object to be tested if it is a complex preference. |
Skylines
The most important preference composition operator is the Pareto operator (p1 * p2
) to formulate a Skyline query.
A tuple t1 is better than t2 w.r.t. p1 * p2
if it is strictly better w.r.t. one of the preferences p1, p2 and is better or equal w.r.t. the other preference.
The syntactical correspondence to other query languages supporting Skylines/preferences to rPref is given as follows:
A query in the syntax from Börzsönyi et. al (2001) like
"
... SKYLINE OF a MAX, b MIN, c MAX
"corresponds in rPref to the preference
high(a) * low(b) * high(c)
.A query in the syntax from Kiessling (2002) like
"
... PREFERRING a LOWEST AND (b HIGHEST PRIOR TO c LOWEST)
"corresponds in rPref to
low(a) * (high(b) & low(c))
.A query in the syntax of the "Skyline" feature of the commercial database "EXASOL EXASolution 5" like
"
... PREFERRING LOW a PLUS (b = 1 PRIOR TO LOW c))
"corresponds in rPref to
low(a) * (true(b == 1) & low(c))
.
Note that preferences in rPref can be translated to some of this query dialects by show.query
.
Definition of Additional Preference Operators
Additionally, rPref supports the following preference composition operators:
p1 & p2
Prioritization (lexicographical order): A tuple t1 is better than t2 w.r.t.
p1 & p2
if it is strictly better w.r.t.p1
or is equal w.r.t.p1
and is better w.r.t.p2
.p1 | p2
Intersection preference: A tuple t1 is better than t2 w.r.t.
p1 | p2
if it is strictly better w.r.t. both preferences. This is a stricter variant of the Pareto operator. The evaluation ofpsel(df, p1 | p2)
is always a subset ofpsel(df, p1 * p2)
.p1 + p2
Union preference: A tuple t1 is better than t2 w.r.t.
p1 + p2
if it is strictly better w.r.t. to one of the preferences. Note that this can violate the strict partial order property, if the domains (the tuples on whichp1
andp2
define better-than-relationships) of the preferences are not disjoint.reverse(p1)
or-p1
Reverse preference (converse relation): A tuple t1 is better than t2 w.r.t.
-p1
if t2 is better than t1 w.r.t.p1
. The unary minus operator, i.e.-p1
, is a short hand notation forreverse(p1)
.
The function is.complex_pref
returns TRUE
if x
is a complex preference object
(i.e., was constructed by one of these binary operators or the unary operator reverse
)
and FALSE
otherwise.
Associated Data Sets
If one of the preferences for a binary operator are associated with a data set (see base_pref
),
then this association is propagated. For example, the preference
p <- high(mpg, df = mtcars) * high(hp)
as well as
p <- high(mpg) * high(hp, df = mtcars)
both result in the same complex preference which is associated with mtcars
.
A partial evaluation is also invoked for all preferences which are added.
For example, using this p
,
p <- p * true(cyl == max(mtcars$cyl))
generates the following console output:
[Preference] high(mpg) * high(hp) * true(cyl == 8)
* associated data source: data.frame "mtcars" [32 x 11]
We see that the association with the data set is propagated and max(mtcars$cyl)
is partially evaluated.
References
S. Borzsonyi, D. Kossmann, K. Stocker (2001): The Skyline Operator. In Data Engineering (ICDE '01), pages 421-430.
W. Kiessling (2002): Foundations of Preferences in Database Systems. In Very Large Data Bases (VLDB '02), pages 311-322.
S. Mandl, O. Kozachuk, M. Endres, W. Kiessling (2015): Preference Analytics in EXASolution. 16th Conference on Database Systems for Business, Technology, and Web.
See Also
See base_pref
for the construction of base preferences.
See general_pref
for functions applicable to all kind of preferences.
See psel
for the evaluation of preferences.
Examples
# Defines a preference for cars with low consumption (high mpg-value)
# and simultaneously high horsepower.
p1 <- high(mpg) * high(hp)
# Performs the preference search.
psel(mtcars, p1)
# Alternative way: create preference with associated data set.
p2 <- high(mpg, df = mtcars) * high(hp)
peval(p2)