I
1b10) must if
- New go : s
on = max
you
Hobowall ,
.
IBardl
thrashold Otherwise
I min
the mir
I
T =
Comete the con
ten
down .
found
that ore
fac
Svenbound we
highest
with re-consente
the and
obsects bound
first score
lower
their
set
n by
must objects
the
After
stor you
ocen
every
con
sor . position
the ser
objects .
of
accessed
the
to
according new
CownBounds
the LB stesso 0
sullo ,
Example +
masca
zona se
: volare colema
della
stesso ultimo
sullo volare
UB manca
zona se
= b
, ↓
. = 0
15 o to =
cos :
Awas pub
best 08 2
2+ .
6
+ =
=
0
& core 1
: balb
chaiches
↑ corrent os o r
:
tog
J ,
2
> Ib 13
- home
they
because
must T
you go on
Someub !
↳ (scorel
2 )
T
=>
Some = .
2
T Stal
to
= 0 ,
,
7
T 3,5 +
= + a
0 95
-
T , =
9 7Sta6
= 0 + a =
. 1
, 77
/
2 23
, Pr
P
2
lihtbit P1
best
6
96 0
97 +0
75
+ +
0
+ 0 90
0 ,
. . .
wort com b recent
cos Rient
6
019tal to
5
970
astafto 8 0 , present
+
to , ,
0
. not a
- I
dias
6
7340 973 ↓
5 +
,
1 0.
, +
aizstasta7 ↓
2
0 ,
5
1 +0]
0
+ ,
w
& D
e Somma
Pinet bsoma
1902
↓ na rigay
considerati h)
(dopo
The MaxOptimal algorithm
Input: integer k, a monotone function S combining ranked lists R1, …, Rm;
Output: the top k pairs:
1. Do a sorted access on each object o
2. For each object o, do random accesses in the other lists Rj , thus extracting score sj
3. Compute overall score S(s1, …, sm), if you don’t have o on the other lists compute always
the max with the same value. If the value is among the k highest seen so far, remember o
4. Let sLi be the last score seen under sorted access for Ri
5. Define threshold T=S(sL1, …, sLm)
6. If the score of the k-th object is worse than T, go to step 1
7. Return the current top-k objects (with the highest max)
EXAMPLE Summary rach
sonted an
access
Do a its
of
the
compute max
and
element ,
volul
the
it's seme
done
they
(if ore
score timel ar
the
infinite
thrashold T
define
then a find
until son
T
deceose
end
other
vedate access
. Do
it elements
tagn
the
have
ser
so
the tay sare ,
h max
Comparing top-k query algorithms
Sated Random
accesses : accesses
:
medRank TA
Bo FA
Optimal
Max
NRA
Skylines
Tuple t dominates tuple s, indicated t s, iff
≺
– 1≤i≤m t[Ai ] ≤ s[Ai ] (t is nowhere worse than s)
→
∀i.
– 1≤j≤m∧ t[Aj ] < s[Aj ] (and better at least once)
∃j.
(lower values are better. Opposite convention wrt. top-k queries)
Skyline of a relation: set of its non-dominated tuples, set of potentially optimal tuples,
set of all top 1 objects according to some monotone scoring function
Skyline ≠ Top-k query because it is based on the notion of dominance and there is no
scoring function that, on all possible instances, yields in the first k positions the skyline
points.
k-skyband = set of tuples dominated by less than k tuples
Skylines - Block Nested loop (BNL)
Input: a dataset D of multi-dimensional points;
Output: the skyline of D
1. Let W = Ø
2. for every point p in D
3. if p not dominated by any point in W
4. remove from W the points dominated by p
5. add p to W
6. return W
Skylines - Sort Filter Skyline (SFS)
Input: a dataset D of multi-dimensional points;
Output: the skyline of D Summary accending
1. Let S = D sorted by a monotone function of D’s attributes points
the
onder
Sat accending
in first
Add the
sated
2. Let W = Ø accesses
do .
and
dominate f
if to
A B they
points if
all s
ed
its volus in
Then
.
I
ore intos
point
Of
3. for every point p in S , element
Bone at lest
and by
(NoI
dominated ore
! not
is
one ar menshoted the
all
mot
4. if p not dominated by any point in W if
point is
A
S
in in
the
. point enes
are
the
of
5. add p to W colus ·,
6. return W dominated
not sinline
EXAMPLE Ma
Novatel add it
because empty to
int
↳ s
s in
: o
un
Gillion
·
sort Novotel
by because of
the values
D all
:
25
f 0
Die . Willion Nevotel's
- th not itto
38 ore add
one
0 5
-
, 4
0 . 1 bis Novotel not
because Ibis
the
by all values of
No
475 : on
0 . it
oo
Nevotel's to
the
=> one 5
Straten Novotel
by because of
the values
D all
:
steaton
points Nevotel's
the
the not itto
or add
one
gray
in 5
-
dominated
ore
acc Hilton Novotel
by
offen peints
by because of
the
, values
some D all
:
it
thow
so away
son on Hilton Nevotel's
He not itto
or add
one 5
-
SEY
Se
E - : SE Gh
G dominato da Se
E
e
non =
e ,
Ap dominato do SE
GS2 Al
E G
SoRT mon e ,
= ,
,
dominato
>
- da
T A
e GAEDS 24
dominato SE
b E
da G A
ma el =
, , ,
,
dominato de A
e dominato
M de A
ri (Artidh
L 6
, . GEIG 53
dominato
3 do
ven Se
e E via = ,
A 4
,
D
, , ,
E6 EXL
ALT
GXA
EXA G4L AXL ALD
,
, ,
. , , ,
, 243
LCm 643
A A43
G2M E
CM 43
,
# ,
,
, , ,
1 SEY
Se
domina
E :
Eras -
G SE Gh
-
EXO Se
2 =
>
- ,
GXA
EXA SE
An Sa Al
G
, => ,
= ,
GXT
EXT ALT
+ ,
, S 24
SE
LEXL G4L G
ALL A
= = , ,
,
, , dominato
perché
LLD-drancese qualamo
de
CXDIALD da
DELD e
già so a
, ,
M
MEX GLM
, BEIG 53
A45 24 Se
E43 042 = 1
3 A 4
, , ,
, ,
2 SEY
Se
E :
-
GELG
EXA SE
An Al
Sa
=> ,
:
ELT
T ELL
↳
DELD
M ELM
ELJ
the
In
.
3 da
poide dominati
SE
2-sayBond punti
A3 di
di Da meno
: ,
Cin questo 0
da
casa
Fontil of
MR Come
1 the helf lists
the
a
S of
to more
. .
U max
BO a
S row
. , 8
now
until
FA trandom
Coman of
1
a
s
. missing
occhs
di
S "I f
fls least
time
. T
if
TA missime story and
scare
nouge
~ =
, , fleat
T
Irawleron 41b
if
stag
Sat offen and,
NRA =
!
a
eneg ,
not
Ib f(PE) pa mesent
o
=
= , f (B) present
03 =
f(PE) ment
ub Py o
=
= , mot
lauer vole
Pr proget
=
MAXO ofte
sot
42 T
if
stop Cultima
f Cestial every occer
= ,
sety points
SFS the da
point
20 ins S ND massimo
,
, punto tutti
da quaero voloni
Un
(se in quelli
D in
5 è
mol I
sai
a
e se
.
line befor
but
BNL adding that
Points volue
by
fam
sfs in s D
remove S
,
,
metze
(volare im
ediese
MR sal st
usa
Bo Isolomaxl
santminime
FA fllst
Sa vow)
mining
TA U2
+ -
NRA
MAXD
SFS
BNL integration
data
for
architectures
Application to
data
relational
mapping
for
interface
an
of
specification
(JPA):
API
Persistent
Java •
Java
in
data
oriented
object Java
in
transactions
managing
for
API
(JTA):
API
Transaction
Java
JPA provides a POJO (Plain Old Java Object) that is an object with methods gets and
-used to
set (as Javabean) menge
objects
more
design
Database
EXAMPLE
Application design Components:
Database connection in web tier
Repetitive code in the controllers
At initialization:
At termination:
Persistent data: extraction
Persistent data: creation
Persistent data: modification
Transaction
Data extraction with JPA
Data creation with JPA
Data modification with JPA
Transaction management in JPA
JPA object relational mapping
Object-relational mapping (ORM): technique of bridging the gap between the object
model and the relational mode, it tries to map the concepts from one model onto another
Impedance mismatch: challenge of mapping one model to the other lies in the concepts
in one model for which there is no logical equivalent in the other
Differences between ORM and RM
JPA main concepts to mapping:
Entity: a class (JavaBean) representing a collection of persistent objects mapped onto a
relational table;
Persistence Unit: the set of all classes that are persistently mapped to one database
(analogous to the notion of db schema);
Persistence Context: the set of all managed objects of the entities defined in the
persistence unit (analogous to the notion of db instance);
Managed entity: an entity part of a persistence context for which the changes of the
state are tracked;
Entity manager: the interface for interacting with a Persistence Context;
Client: a component that can interact with a Persistence Context, indirectly through an
Entity Manager (e.g., an EJB component). EXAMPLE enth
A
of spa
Entity manager operations
Entity EXAMPLE
Properties:
• Identification (primary key);
• Nesting;
• Relationship;
• Referential integrity (foreign key);
• Inheritance.
Scarica il documento per vederlo tutto.
Scarica il documento per vederlo tutto.
Scarica il documento per vederlo tutto.
Scarica il documento per vederlo tutto.
Scarica il documento per vederlo tutto.
Scarica il documento per vederlo tutto.
Scarica il documento per vederlo tutto.