object identities a presentation by corey anderson inspired by abiteboul and kanellakis

18
Object Identities A presentation by Corey Anderson Inspired by Abiteboul and Kanellakis

Upload: alban-green

Post on 19-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Object Identities A presentation by Corey Anderson Inspired by Abiteboul and Kanellakis

Object Identities

A presentation by Corey Anderson

Inspired by Abiteboul and Kanellakis

Page 2: Object Identities A presentation by Corey Anderson Inspired by Abiteboul and Kanellakis

2

The big idea

• Object-orientation in a database is good

• But no one uniform formalism exists yet

• So let’s use A&K’s formalism

– Object identities as First Class Citizens

Page 3: Object Identities A presentation by Corey Anderson Inspired by Abiteboul and Kanellakis

3

Object Identity

• A unique identity for each object

adam [ name: “Adam”,spouse: eve,children: {cain, abel, seth, …} ]

oid o-value

Page 4: Object Identities A presentation by Corey Anderson Inspired by Abiteboul and Kanellakis

4

Formalisms – basics

• oid– An identifier

• o-value– An oid, a constant, or a tuple of o-values

• Schema v. Instance

Page 5: Object Identities A presentation by Corey Anderson Inspired by Abiteboul and Kanellakis

5

Formalisms – classes

• Classes P = { P1, P2, … }

– P = { 1st-gen, 2nd-gen }

(P) : P {oids} (1st-gen) = { adam, eve }

Page 6: Object Identities A presentation by Corey Anderson Inspired by Abiteboul and Kanellakis

6

Formalisms – relations

• Relations R = { R1, R2, … }

– R = { ancestor-of-celebrity, founded-lineage }

(R) : R {o-values} (ancestor-of-celebrity) = {[seth, noah], …}

Page 7: Object Identities A presentation by Corey Anderson Inspired by Abiteboul and Kanellakis

7

Formalisms – typing

• Everything has a type = {} | constant | class | tuple | {} | |

• Given , each type has an interpretation [] (i.e., the set of things that are of that type)

– [P] = (P)

– [[1, 2]] = {[v1,v2] | v1 [1], v2 [2]}

Page 8: Object Identities A presentation by Corey Anderson Inspired by Abiteboul and Kanellakis

8

Formalisms – the last one!

• A schema S is a triple (R,P,T)– Relations R, classes P, type mapping T : RP

types(P)

• An instance I is a triple (, , )– o-value assignment , oid-assignment , oid-to-

o-value partial function

Page 9: Object Identities A presentation by Corey Anderson Inspired by Abiteboul and Kanellakis

9

An Example Schema

• P = { 1st-gen, 2nd-gen }

• R = { ancestor-of-celebrity, founded-lineage }

• T(1st-gen) =

[name: string, spouse: 1st-gen, children: {2nd-gen}]

• T(2nd-gen) = [name: string, occupations: { string }]

• T(ancestor-of-celebrity) = 2nd-gen

• T(founded-lineage) =

[anc: 2nd-gen, desc: (string or [spouse: string])]

Page 10: Object Identities A presentation by Corey Anderson Inspired by Abiteboul and Kanellakis

10

An Example Instance

(1st-gen) = { adam, eve } (2nd-gen) = { seth, cain, abel, other } (founded-lineage) = {cain, seth, other } (ancestor-of-celebrity) = {[anc: seth, desc: noah],

[anc: cain, desc: [spouse: “Ada”]] } (adam) = [name: “Adam”, spouse: eve,

children: {cain, abel, seth, other}] (abel) = [name: “Abel”, occupations: {“shepherd”}] (other) is undefined

• …

Page 11: Object Identities A presentation by Corey Anderson Inspired by Abiteboul and Kanellakis

11

Posing Queries – IQL

• The Identity Query Language

• Rule-based, like Datalog

• Formally, (S, Sin, Sout)

– Sin, Sout are projections of S

– Convert an instance of input schema Sin to an instance of output schema Sout

• Typed

Page 12: Object Identities A presentation by Corey Anderson Inspired by Abiteboul and Kanellakis

12

Simple IQL example

• Farmers who founded lineage– farmer-founders(x) 2nd-gen(x), founded-

lineage(x), x = [n, o], o = “farmer”

Page 13: Object Identities A presentation by Corey Anderson Inspired by Abiteboul and Kanellakis

13

Less simple IQL example

• Make a class of all the occupationsS = { R, P {occupation},

T {T(occupation) = [name: string]}

Sin S Sin from earlier

Sout S Sout = {{}, {occupation}, …}

• What’s (S, Sin, Sout)?

Page 14: Object Identities A presentation by Corey Anderson Inspired by Abiteboul and Kanellakis

14

The query

T(R1) = string T(R2) = [string, occupation]

R1(o) 2nd-gen(x), x = [n,o]

R2(o,z) R1(o) ;; Creates the oid z and ;; automagically sets ;; (occupation) = z

R2(o,z) ;; Define z’s o-valueoz ˆ

Page 15: Object Identities A presentation by Corey Anderson Inspired by Abiteboul and Kanellakis

15

Another example – nesting

R = {R2, R3} T(R2) = [D, D] T(R3) = [D, {D}]

R4(x) R2(x,y)

R5(x,z) R4(x) ;; A new oid!

(y) R5(x,z), R2(x,y) ;; z is set-valued

R3(x, ) R5(x,z)

z

z

1

2

Page 16: Object Identities A presentation by Corey Anderson Inspired by Abiteboul and Kanellakis

16

Why the authors like IQL

• IQL can express (almost) all possible database transformations– oid invention was necessary here

• IQL contains other cool query languages as sublanguages– Datalog, Datalog with negation, COL, …

Page 17: Object Identities A presentation by Corey Anderson Inspired by Abiteboul and Kanellakis

17

Type inheritance

• Augment definition of schema to include type hierarchy– Schema S is a quadruple (R, P, T, ) where

is a partial order on P

• Augment definition of instance to account for oids being a subclass object (P) = { (P’) | P’ P, P’ P }

Page 18: Object Identities A presentation by Corey Anderson Inspired by Abiteboul and Kanellakis

18

Take home messages

• oids are unique identifiers for objects

• oids and their use are formally defined

• IQL is a language with which to query OODBs