NU AVDDH Data Databases and CMS
description
Transcript of NU AVDDH Data Databases and CMS
Intro to data, databases, and
content management
systemsAmazingly, in 90 minutes!
Apollonian View•Data — what is it, importance of
structure
•Databases — the classical repository for data
•Algorithms — formalizing the request and processing of data
•Content Management Systems —common example assembling all the above.
http://www.flickr.com/photos/snorpey/3317497657/http://www.flickr.com/photos/snorpey/3317497657/
Elizabeth Taylor
commons.wikimedia.org
Conrad Hilton, 1950-51
Michael Widling 1952-57
Mike Todd, 1957-58
Eddie Fisher, 1959-64
Richard Burton, 1964-74
Richard Burton, 1975-76
John Warner, 1976-82
Larry Fortensky, 1991-96
XML-or-
<person> <firstname>Matt</firstname> <lastname>Taylor</lastname></person>
<person> <firstname>Amanda</firstname> <lastname>French</lastname></person>
<person> <firstname>Josh</firstname> <lastname>Honn</lastname></person>
firstname
lastname
Matt Taylor
Amanda French
Josh Honn
Photos: Boston Public Library — Frank Rineharthttp://www.flickr.com/photos/boston_public_library/sets/72157622672603941/
Photos: Boston Public Library — Frank Rineharthttp://www.flickr.com/photos/boston_public_library/sets/72157622672603941/
Height 150 mm
Width 114 mm
SubjectNative American
with rifle
LocationOmaha,
Nebraska
Date 1898
Photographer Reinhart, F. A.
Photos: Boston Public Library — Frank Rineharthttp://www.flickr.com/photos/boston_public_library/sets/72157622672603941/
Height Width TitleLocatio
nDate Creator
150mm 114mm
Native American with rifle
Omaha, NE
1898Reinhart
, F. A.
144mm 116mmFreckled
FaceOmaha,
NE1898
Reinhart, F. A.
150mm 118mmLittle Bird
Omaha, NE
1898Reinhart
, F. A.
contributor
creator
date description
formatidentifier
language
publisher
relation
rights
source
subject
http://www.flickr.com/photos/ccacnorthlib/4131838228/
title
type
contributor
creator
date description
formatidentifier
language
publisher
relation
rights
source
subject
http://www.flickr.com/photos/ccacnorthlib/4131838228/
title
typeDUBLINCORE
Photos: Boston Public Library — Frank Rineharthttp://www.flickr.com/photos/boston_public_library/sets/72157622672603941/
Height Width TitleLocatio
nDate Creator
150mm 114mm
Native American with rifle
Omaha, NE
1898Reinhart
, F. A.
144mm 116mmFreckled
FaceOmaha,
NE1898
Reinhart, F. A.
150mm 118mmLittle Bird
Omaha, NE
1898Reinhart
, F. A.
Photos: Boston Public Library — Frank Rineharthttp://www.flickr.com/photos/boston_public_library/sets/72157622672603941/
PhotoID
Tribe Role Fringe BonesFeather
s
1001Unknow
nUnknow
nCow Hide
0 2
1002 ArapahoMedicine Woman
Fabric 126 0
1003 Arapaho Chief None 32 6
Recap 1
•Data is everywhere — in many forms
•We seek to bring order to data
•Creating tables is one way to do this
•All metadata is data — but data is not necessarily metadata
Practical I•Open Excel
•Enter data related to 3 favorite books in these columns:
•Title
•Author Last Name
•Author First Name
•Save as Excel file
•Save as CSV file too!
•What’s a CSV?
•How is a CSV different from an XLS file?
Photos: IMDB.com
Data modeling
Photos: IMDB.com
Photos: IMDB.com
Movies Actors
Photos: IMDB.com
Actor
firstnamelastnamebirth datedeath date
firstname at birthlastname at birth
height....
Photos: IMDB.com
Actor
firstname Textlastname Textbirth date Datedeath date Date
firstname at birth
Text
lastname at birth
Text
height (in inches)
Number
... ...
12
111
84
202
List of Heights
Sortedas Number
Sortedas Text
111
202
84
12
12
111
84
202
data types are important!
integer
decimal number
singlecharacter/letter
boolean(true/false)date
time
datetime
text
gps coordinate
currency amount
zip codebinary data
Photos: IMDB.com
Actor
firstname Textlastname Textbirth date Datedeath date Date
firstname at birth
Text
lastname at birth
Text
height (in inches)
Number
... ...
Photos: IMDB.com
Actor
firstname Text
lastname Text
birth date Date
death date Date
firstname at birth
Text
lastname at birth
Text
height (in in)Numbe
r
... ...firstname lastname birth datedeat
h date
fn at birth
ln at birth height
Matt Damon1970-10-
08Matthew
PaigeDamon 70
Morgan Freeman1937-06-
01Morgan Freeman 74
Jodie Foster1962-11-
19Alicia
ChristianFoster 63
MatthewMcConaugh
ey1969-11-
04Matthew
DavidMcConaughey 72
Photos: IMDB.com
Movie
title Text
length (minutes)
Number
release date Date
Photos: IMDB.com
Movie
title Text
length (minutes)
Number
release date Date
title length (min) release date
Contact 150 1997-07-11
Invictus 134 2009-12-11
Elysium 109 2013-08-09
Movie Actor?
Actor
firstname Text
lastname Text
birth date Date
death date Date
firstname at birth Text
lastname at birth Text
height (in inches) Number
Movie
title Text
length (minutes) Number
release date Date
Actor
firstname Text
lastname Text
birth date Date
death date Date
firstname at birth Text
lastname at birth Text
height (in inches) Number
Movie
title Text
length (minutes) Number
release date Date
Role
movie ?
actor ?
? ?
Actor
firstname Text
lastname Text
birth date Date
death date Date
firstname at birth Text
lastname at birth Text
height (in inches) Number
Movie
title Text
length (minutes) Number
release date Date
Role
movie Text ?
actor Text ?
character name Text
Actor
firstname Text
lastname Text
birth date Date
death date Date
firstname at birth Text
lastname at birth Text
height (in inches) Number
Movie
title Text
length (minutes) Number
release date Date
Role
? ?
? ?
character name Text
Actor
id Number
firstname Text
lastname Text
birth date Date
death date Date
firstname at birth Text
lastname at birth Text
height (in inches) Number
Movie
id Number
title Text
length (minutes) Number
release date Date
Role
? ?
? ?
character name Text
firstname lastname birth datedeat
h date
fn at birth
ln at birth height
Matt Damon1970-10-
08Matthew
PaigeDamon 70
Morgan Freeman1937-06-
01Morgan Freeman 74
Jodie Foster1962-11-
19Alicia
ChristianFoster 63
MatthewMcConaugh
ey1969-11-
04Matthew
DavidMcConaughey 72
title length (min) release date
Contact 150 1997-07-11
Invictus 134 2009-12-11
Elysium 109 2013-08-09
idfirstna
melastname birth date
death
date
fn at birth
ln at birthheigh
t
101 Matt Damon1970-10-
08Matthew Paige
Damon 70
102 Morgan Freeman1937-06-
01Morgan Freeman 74
103 Jodie Foster1962-11-
19
Alicia Christia
nFoster 63
104Matthe
wMcConaug
hey1969-11-
04
Matthew
David
McConaughey
72
id titlelength (min)
release date
101 Contact 150 1997-07-11
102 Invictus 134 2009-12-11
103 Elysium 109 2013-08-09
SSN
AccountNumber
ISBN
UPC
VINPassportNumber
Student ID
AccessionNumber
id
idfirstna
melastname birth date
death
date
fn at birth
ln at birthheigh
t
101 Matt Damon1970-10-
08Matthew Paige
Damon 70
102 Morgan Freeman1937-06-
01Morgan Freeman 74
103 Jodie Foster1962-11-
19
Alicia Christia
nFoster 63
104Matthe
wMcConaug
hey1969-11-
04
Matthew
David
McConaughey
72
id titlelength (min)
release date
101 Contact 150 1997-07-11
102 Invictus 134 2009-12-11
103 Elysium 109 2013-08-09
Actor
id Number
firstname Text
lastname Text
birth date Date
death date Date
firstname at birth Text
lastname at birth Text
height (in inches) Number
Movie
id Number
title Text
length (minutes) Number
release date Date
Role
movie id Number
actor id Number
character name Text
idfirstna
melastname birth date
death
date
fn at birth
ln at birthheigh
t
101 Matt Damon1970-10-
08Matthew Paige
Damon 70
102 Morgan Freeman1937-06-
01Morgan Freeman 74
103 Jodie Foster1962-11-
19
Alicia Christia
nFoster 63
104Matthe
wMcConaug
hey1969-11-
04
Matthew
David
McConaughey
72
id titlelength (min)
release date
101 Contact 150 1997-07-11
102 Invictus 134 2009-12-11
103 Elysium 109 2013-08-09
Movie
Actor
movie id actor id character name
102 102 Nelson Mandela
102 101 Francois Pienaar
Role
Actor
id Number
firstname Text
lastname Text
birth date Date
death date Date
firstname at birth Text
lastname at birth Text
height (in inches) Number
Movie
id Number
title Text
length (minutes) Number
release date Date
Role
movie id Number
actor id Number
character name Text
Recap II•Data modeling allows for a formal
structuring of information
•Information should be organized by notion of discrete objects and distinctive attributes
•In tables, objects become rows of information, and attributes become the columns
•Unique identifiers are useful attributes that help identify and relate data objects to one another
Practical II (a)•Imagine a data model for art &
architecture:
•Country … e.g. France, Spain, USA, Germany, etc.
•Person … e.g. Picasso, van der Rohe, etc.
•Residency … Periods of time artist spent in a country
Person
id Number
firstname Text
lastname Text
birth date Date
death date Date
Country
id Number
name Text
geographic center Coordinate
Residency
country id Number
person id Number
start date Date
end date Date
Practical II (b)
•Add a 4th column to your Excel (containing an ID) table and save it as a new CSV file:
•books_ids.csv
•Make sure your IDs are unique from everyone else’s -- how can we ensure this?
Normalization, Conformance
& Authorities
contributor
creator
date description
formatidentifier
language
publisher
relation
rights
source
subject
http://www.flickr.com/photos/ccacnorthlib/4131838228/
title
typeDUBLINCORE
Consistency is [usually] key!
“color” vs. “colour”
“Rembrandt” vs.“Rembrandt
Harmenszoon van Rijn”
“coarse” vs. “rough”
in. vs. cm.
“steamship” vs. “steamboat”
Why does it matter?
Does “steamboat” = “steamship” ?How do “stupid” computers know that?
steamship
http://en.wikipedia.org/wiki/File:Mars_Climate_Orbiter_-_mishap_diagram.png
How to improve conformance in
data:
•Develop style guides
•Use a controlled vocabulary
•Consult an authority
AAT
TGN
ULAN
AAT
TGN
ULAN
“motor home”
{TAXONOMY
Thought Question
•We know what a taxonomy is...
•What’s a “folksonomy” ?
Databases
Source: Wikimedia Commonshttp://upload.wikimedia.org/wikipedia/commons/1/12/Oracle_Headquarters_Redwood_Shores.jpg
DATABASE at Postmasters, March 2009 by Michael Mandiberg / CC BY-SAhttp://www.flickr.com/photos/theredproject/3332644561/
1960’s 1970’s 1980’s 1990’s
Relational PersonalWeb & Open
SourceHierarchical
Hierarchical Databases
File System
Note Organizers
Relational Database Systems
XML/Document Databases
Relational Database Systems
XML/Document Databases
SQLSQL
No SQLNo SQL
$⃠ ActorActorActorActor MovieMovieMovieMovie
RoleRoleRoleRole
SELECT * FROM actor WHERE lastname = ‘Freeman’;
RelationalActor
id Number
firstname Text
lastname Text
birth date Date
death date Date
firstname at birth Text
lastname at birth Text
height (in inches) Number
Movie
id Number
title Text
length (minutes) Number
release date Date
Role
movie id Number
actor id Number
character name Text
SQL Query:
Monsieur Monsieur Database,Database,
Tell me the title Tell me the title of the movie of the movie with ID 103with ID 103
Monsieur Monsieur Database,Database,
Tell me the title Tell me the title of the movie of the movie with ID 103with ID 103
OK. But OK. But only if you only if you speak my speak my language!language!
OK. But OK. But only if you only if you speak my speak my language!language!
SELECT id, title FROM movie WHERE id = ‘103’;
Result:
http://commons.wikimedia.org/wiki/File:Fetita_cu_cheie_icon.png
id title
103 Elysium
SQL Query:Monsieur Monsieur Database,Database,
Tell me Tell me everything everything about any about any
actors with last actors with last name name
“Freeman”“Freeman”
Monsieur Monsieur Database,Database,
Tell me Tell me everything everything about any about any
actors with last actors with last name name
“Freeman”“Freeman”
OK. But OK. But only if you only if you speak my speak my language!language!
OK. But OK. But only if you only if you speak my speak my language!language!
SELECT * FROM actor WHERE lastname = ‘Freeman’;
Result:
idfirstna
melastname birth date
death
date
fn at birth
ln at birthheigh
t
102 Morgan Freeman1937-06-
01Morgan Freeman 74
http://commons.wikimedia.org/wiki/File:Fetita_cu_cheie_icon.png
SQL Query:Tell me the Tell me the titles and titles and
characters of characters of the movies the movies
starring starring someone someone namednamed
Matt DamonMatt Damon
Tell me the Tell me the titles and titles and
characters of characters of the movies the movies
starring starring someone someone namednamed
Matt DamonMatt Damon
OK. But OK. But only if you only if you speak my speak my language!language!
OK. But OK. But only if you only if you speak my speak my language!language!
SELECT movie.title, role.character_name FROM movie, role, actor WHERE actor.firstname = ‘Matt’ AND actor.lastname = ‘Damon’ AND role.actor_id = actor.id AND role.movie_id = movie.id;
Result:
http://commons.wikimedia.org/wiki/File:Fetita_cu_cheie_icon.png
title character_name
Invictus Francois Pienaar
Elysium Max
Demo
MySQL Administration using phpMyAdmin to create a “books”
tablein the “booksdb” database
Practical III
follow me to usephpMyAdmin to upload your CSV
data
http://tinyurl.com/mattbase101
Demo
Sample website using our book data
http://tinyurl.com/mattbooks101
Web InterfaceWeb InterfaceWeb InterfaceWeb Interface
DatabaseDatabaseDatabaseDatabase
????
Web InterfaceWeb InterfaceWeb InterfaceWeb Interface
DatabaseDatabaseDatabaseDatabase
ApplicationApplicationApplicationApplication
Web InterfaceWeb InterfaceWeb InterfaceWeb Interface
DatabaseDatabaseDatabaseDatabase
““CODE”CODE”““CODE”CODE”
Web InterfaceWeb InterfaceWeb InterfaceWeb Interface
DatabaseDatabaseDatabaseDatabase
php javapython ruby
perl
Web InterfaceWeb InterfaceWeb InterfaceWeb Interface
DatabaseDatabaseDatabaseDatabase
php javapython ruby
perlWrite your ownapplication?
Use an existing application?
Both!
Web InterfaceWeb InterfaceWeb InterfaceWeb Interface
DatabaseDatabaseDatabaseDatabase
C M SContent Management System
Practical IV
•Consider Wordpress: Pages, Posts, Comments, Authors...
•What might it’s data model be?
PagePost
Comment
Author Category
Recap IV
•Databases have data
•Users have browsers, phones, etc...
•Application code spans the two and customizes the interactive experience
•CMSs provide a pre-built framework for interacting with data
•CMSs can be customized & extended