330 likes | 531 Views
Information Integration Lecture 2. Data Model. Michael Genesereth Autumn 2001. Objects. Objects are the basis for our data model. Primitive: Quark23 Composite: Engine14 , CS246 Physical: Earth , Moon , Sun Abstract: Justice , CS246
E N D
Information Integration Lecture 2 Data Model Michael Genesereth Autumn 2001
Objects • Objects are the basis for our data model. • Primitive: Quark23 • Composite: Engine14, CS246 • Physical: Earth, Moon, Sun • Abstract: Justice, CS246 • Real: Jennifer, Mike, CS246 • Imaginary: Sherlock Holmes, Unicorn3
Objects as Data Structures a b c Without loss of generality, we can think about objects as data structures in a computer with a 1-1 correspondence to real world objects. NB: To accommodate numbers and strings, the computer might have to be infinitely large.
Universe of Discourse The Universe of Discourse is the set of all objects about which we want to say something.
Relations • An n-ary relation is a set of n-tuples of objects from a universe of discourse. • Jennifer is a professor. • Mike is a professor. • Jennifer teachesCS145. • Mike teaches CS157. • Mike teaches CS246. • John got an A in CS145. • John got a B in CS157.
Arity versus Cardinality • The arity of a relation is the number of objects involved in any tuple. The cardinality is the number of tuples. • Arity 1 cardinality 3: Arity 3 cardinality 2: • Mike is a professor. John got an A in CS145. • Jennifer is a professor. John got a B in CS157. • Zohar is a professor. • Arity 2 cardinality 4: • Jennifer teachesCS145. • Mike teaches CS157. • Mike teaches CS246. • Zohar teaches CS157.
Classes A class is a structure consisting of a unary relation (the class predicate) and a finite set of binary relations (its attributes). Class: course Predicate: course.instance Attribute: course.title Attribute: course.teacher Attribute: course.prerequisite
Predicates The extension of a class is the set of objects that satisfy the class predicate.
Attributes Each attribute of a class associates members of the class’s extension with corresponding values.
Tabular Representation of Classes NB: Class tables are rarely in first normal form.
Memory-Resident Representation Direct Object-Oriented Representation Real-World Objects represented as Structured Objects Relationships as pointers Reverse Relationships are reverse pointers Sentential Representation Real-World Objects represented as Structured Objects Sentences are objects Objects point to sentences containing them
Graph Representation block a on under block b stack on under block c
Naming Naming of objects necessary for communication. Choice #1: * All objects named Some objects named; others referenced by properties Choice #2: Relative Names * Globally Unique Names
Relative Naming via Foreign Keys In relative naming, all entries are strings (usually without quotes). Some are just strings (e.g. nicknames, addresses, descriptions, and so forth). Some refer to objects. Object references formalized by use of foreign keys, i.e. the use within one table of the value for the key attribute for another table.
Globally Unique Name Scheme A name is a sequence of alphanumeric characters together with various connector characters, such as / and . and _. Choice #3: Type determined by spelling Type determined by name registry * Mixture Choice #4: Semantically meaningful names Semantically meaningless names * Mixture
Predefined Names Numbers 123 123.456 123/456 Characters #\a #\b #\c Strings “abc def ghi” “abc \”def\” ghi” “abc \”d\\f\” ghi”
Objects versus Strings Object name refers to an object john String name refers to a string “john” john Objects and strings do not have same properties: John is 33 years old. “John” includes the character #\h.