SlideShare a Scribd company logo
1 of 48
From Data Structures to Databases

          Prof. Alvarado
            MDST 3703
         5 February 2013
Business
• Quiz 1
  – To be posted this evening
  – Due Thursday evening
  – Covers content before Databases
  – End-of-week reflections still due
• Blogging
  – Please remember to be timely
• Safari Resources
  – If you can‟t access, try going through the
    Library page
Review
• Building as knowing
  – Ramsay‟s point in “On Building”
• DH as cultural reverse engineering
  – Finding the rules in the patterns
  – Texts and images are the patterns in
    question
• Reverse engineering is like building
  – Same process in reverse (deconstruction)
  – Also requires building other things – like
    databases to store stuff
For example, in Studio on Thursday we began to reverse
engineer Plato’s Republic. The next step in our exercise
was to parse the text into “words” and organize them in a
list using an array
By the way, were we actually
      grabbing words?
Not really – we were find substrings,
 letter patterns that could also exist
     within words (e.g. “cavern”)

   Also, these patterns did not match
synonyms or pronouns (e.g. “this”) that
stand for the same thing as the word in
                question

This is the difference between SYNTAX
            and SEMANTICS
Syntax = sequences of signs
    Semantics = meanings of signs

Semantics is much harder for computers
         to grasp than syntax

  In fact, some think that semantics is
beyond the capacity of any computer …
Getting back to PHP
We can use arrays to model the text. So,
within a FOREACH loop iterating through
the lines of a text and parsing each line for
“words,” we could do the following:

  $words[$word]++;
  $words[] = $word;
  $lines[$lineNumber][] = $word;


Each method suggests a different model
More about PHP Arrays
• Arrays can be added to like so:
  $myArray[] = $newItem;
• Arrays can also use strings instead of
  number as indices, e.g.
  $myArray[3] = „foo‟;
  $myArray[„person‟] = „Bob‟;
• Array items may also point to arrays,
  creating multidimensional arrays
  $myArray[„person‟] = array();
  $myArray[„person‟][„Bob‟] = $something;
Arrays with string indices are called
    “associative arrays” in PHP

Arrays of arrays can be used to create
 data structures like trees and grids
Read Chapter 5 of PHP: The
Good Parts to learn more
about arrays (see link in
Resources on the course blog)

Also, the PHP manual is always
a good place to look
http://php.net/manual/en/language.types.array.php
Arrays as Data Structures
• PHP arrays can be used to create data
  structures to model things, like texts, e.g.
  $words[$word]++;
  $words[] = $word;
  $lines[$lineNumber][] = $word;
• These three create the following
  1. A simple list of word types (and their
     counts)
  2. A list of each word in order (position and
     word)
  3. A grid of line numbers and words
Here is an example of how we would create
the third kind of data structure. This would
store a grid of words.
These numbers are the first dimension of the array (Y)
 These horizontal numbers are the second dimension of the array (Y)




And it would store the text in grid something
like this one …
In this model, a text is a grid of words,
    each with an X and Y coordinate

Is this the only way to represent a text?

        Is it the most accurate?
Texts can also be represented as trees
Document Elements and Structures

Play                 – Heading
  – Act +              • Return Address
       • Scene +       • Date
          – Line +     • Recipient Info
                          – Name
Book                      – Title
  – Chapter +             – Address
       • Verse +     – Content
                       • Salutation
                       • Paragraph +
                       • Closing

Letter
XML is designed to represent text
What are some differences between
         trees and tables?
Tables are more rigid
  Trees allow for indefinite depth

 But tables are easier to manipulate

In any case, tables and trees are two
major kinds of data structure that you
         will encounter …
Speaking of trees …
what is this?
Tree of Logic (and a
    primitive computer)
". . . the tree of nature and logic by the
thirteenth-century poet, philosopher, and
missionary Ramon Lull. The main trunk supports
a version of the tree of Porphyry, which
illustrates Aristotle's categories. The ten leaves
on the right represent ten types of questions,
and the ten leaves on the left are keyed to a
system of rotating disks for generating answers.
Such diagrams and disks comprise Lull's Ars
Magna (Great Art), which was the first attempt
to develop mechanical aids to reasoning. It
served as an inspiration to the pioneer in
symbolic logic, Gottfried Wilhelm Leibniz.”

John Sowa, explaining the cover art for
Knowledge Representation
What is this tree an example of?
The tree is a “knowledge
  representation” (KR)
A KR is a model that comprises
1. A set of categories (aka Ontology)
  Names and relationships between names
2. A set of inference rules (aka Logic)
  A method of traversing names and relations
3. A medium for computation
  A medium for producing inferences
4. A language for expressing these things
  Such as a programming or markup language
Ontologies are systems of
categories rooted in world
views
Ontologies consist of
categories and their
relationships

These are often mapped
onto physical things – the
human body, or trees – as
part of our cognitive model
The tree as body as society among the Umeda of New Guinea
Logic is a name for the systematic
unpacking ontologies in discourse …
Here is a sample
ontology, one
very similar to
Aristotle’s
And this is a syllogism, the basic unit of
reasoning in classical logic

            How is it related to the tree?
The sentences in the
syllogism stand for
the traversal of the
tree that represents
an implicit ontology
Reasoning always implies an ontology

   Ontologies are often unexpressed

Ontologies often conflict with each other

(Digital) Humanists excavate or reverse
       engineer these ontologies
Now, a KR for a computer has to be
      an operationalized KR

How would we express a syllogism
           in PHP?
One way is to convert
the tree into an array
But, given such an array, how can we find out if
                  Socrates is mortal?

         How do we find if the following is set:
0           1           2           3              4
We’d have to some some complicated nested looping to
find the answer …
So, PHP gives us tools to create an
  ontology, but not a way to reason
        efficiently with them

To create more effective KRs, we need
      the services of a database
A database is a “a system that allows for
  the efficient storage and retrieval of
              information”

  But beyond this, it also allows us to
       “represent knowledge”

Given Unsworth‟s definition, how must it
              do this?
Databases provide a language to define
  ontologies (schema) and to “unpack”
these ontologies – via a query language
    that lets us efficiently search and
     retrieve data organized schema
In this course, we are going to use a
relational database to store and access
               information

 Relational databases use a language
             known as SQL

(pronounced S-Q-L, although some say
             “sequel”)
SQL
• SQL stands for “Structured Query
  Language”
  – NOT invented by Microsoft
• Invented in the 1970s and
  commercialized in the 1980s
  – Probably responsible for new business
    models like JIT inventories
• Built on Codd‟s relational model (1970)
  – Implements set theory and formal logic
  – Around the time of SGML
SQL
• A language used by relational databases
  – Oracle, SQL Server, Access, etc.
MySQL
• A very fast, simplified, and easy to use
  relational database
• A client/server app
  – Runs on the internet
  – Not a desktop app like Access
• Created by Monty Widenius in the mid
  1990s
  – Open Source
  – A Finn living in Sweden
  – Same time as PHP
• Powered the Web 2.0 revolution
phpMyAdmin
• A PHP interface to MySQL
• Relatively easy to use
  – No need to know SQL
• Great to manage databases that your PHP
  programs will use
• Today you will get started using UVA‟s
  free MySQL server
The role of PHP

More Related Content

What's hot

Intro to OWL & Ontology
Intro to OWL & OntologyIntro to OWL & Ontology
Intro to OWL & OntologyNarni Rajesh
 
LSI latent (par HATOUM Saria et DONGO ESCALANTE Irvin Franco)
LSI latent (par HATOUM Saria et DONGO ESCALANTE Irvin Franco)LSI latent (par HATOUM Saria et DONGO ESCALANTE Irvin Franco)
LSI latent (par HATOUM Saria et DONGO ESCALANTE Irvin Franco)rchbeir
 
3. introduction to text mining
3. introduction to text mining3. introduction to text mining
3. introduction to text miningLokesh Ramaswamy
 
FRSAD Functional Requirements for Subject Authority Data model
FRSAD Functional Requirements for Subject Authority Data modelFRSAD Functional Requirements for Subject Authority Data model
FRSAD Functional Requirements for Subject Authority Data modelMarcia Zeng
 
Web ontology language (owl)
Web ontology language (owl)Web ontology language (owl)
Web ontology language (owl)Ameer Sameer
 
Ontology Engineering: Introduction
Ontology Engineering: IntroductionOntology Engineering: Introduction
Ontology Engineering: IntroductionGuus Schreiber
 
Introducing FRSAD and Mapping it with Other Models
Introducing FRSAD and Mapping it with Other ModelsIntroducing FRSAD and Mapping it with Other Models
Introducing FRSAD and Mapping it with Other ModelsMarcia Zeng
 
Ontologies and Vocabularies
Ontologies and VocabulariesOntologies and Vocabularies
Ontologies and Vocabulariesseanb
 
PROLOG: Recursion And Lists In Prolog
PROLOG: Recursion And Lists In PrologPROLOG: Recursion And Lists In Prolog
PROLOG: Recursion And Lists In PrologDataminingTools Inc
 
Prolog (present)
Prolog (present) Prolog (present)
Prolog (present) Melody Joey
 

What's hot (17)

Ontology Engineering
Ontology EngineeringOntology Engineering
Ontology Engineering
 
Frsad overview
Frsad overviewFrsad overview
Frsad overview
 
Intro to OWL & Ontology
Intro to OWL & OntologyIntro to OWL & Ontology
Intro to OWL & Ontology
 
LSI latent (par HATOUM Saria et DONGO ESCALANTE Irvin Franco)
LSI latent (par HATOUM Saria et DONGO ESCALANTE Irvin Franco)LSI latent (par HATOUM Saria et DONGO ESCALANTE Irvin Franco)
LSI latent (par HATOUM Saria et DONGO ESCALANTE Irvin Franco)
 
3. introduction to text mining
3. introduction to text mining3. introduction to text mining
3. introduction to text mining
 
5 rdfs
5 rdfs5 rdfs
5 rdfs
 
FRSAD Functional Requirements for Subject Authority Data model
FRSAD Functional Requirements for Subject Authority Data modelFRSAD Functional Requirements for Subject Authority Data model
FRSAD Functional Requirements for Subject Authority Data model
 
Web ontology language (owl)
Web ontology language (owl)Web ontology language (owl)
Web ontology language (owl)
 
SWT Lecture Session 8 - Rules
SWT Lecture Session 8 - RulesSWT Lecture Session 8 - Rules
SWT Lecture Session 8 - Rules
 
NLTK
NLTKNLTK
NLTK
 
Ontology Engineering: Introduction
Ontology Engineering: IntroductionOntology Engineering: Introduction
Ontology Engineering: Introduction
 
Introducing FRSAD and Mapping it with Other Models
Introducing FRSAD and Mapping it with Other ModelsIntroducing FRSAD and Mapping it with Other Models
Introducing FRSAD and Mapping it with Other Models
 
MDST 3703 F10 Studio 4
MDST 3703 F10 Studio 4MDST 3703 F10 Studio 4
MDST 3703 F10 Studio 4
 
Ontology engineering
Ontology engineering Ontology engineering
Ontology engineering
 
Ontologies and Vocabularies
Ontologies and VocabulariesOntologies and Vocabularies
Ontologies and Vocabularies
 
PROLOG: Recursion And Lists In Prolog
PROLOG: Recursion And Lists In PrologPROLOG: Recursion And Lists In Prolog
PROLOG: Recursion And Lists In Prolog
 
Prolog (present)
Prolog (present) Prolog (present)
Prolog (present)
 

Viewers also liked

MDST 3703 F10 Seminar 11
MDST 3703 F10 Seminar 11MDST 3703 F10 Seminar 11
MDST 3703 F10 Seminar 11Rafael Alvarado
 
Mdst3705 2013-01-31-php3
Mdst3705 2013-01-31-php3Mdst3705 2013-01-31-php3
Mdst3705 2013-01-31-php3Rafael Alvarado
 
Mdst3703 2013-09-05-studio2
Mdst3703 2013-09-05-studio2Mdst3703 2013-09-05-studio2
Mdst3703 2013-09-05-studio2Rafael Alvarado
 
Thatcamp2011 intro to-cm_ses
Thatcamp2011 intro to-cm_sesThatcamp2011 intro to-cm_ses
Thatcamp2011 intro to-cm_sesRafael Alvarado
 
Mdst3703 projects-2012-10-11
Mdst3703 projects-2012-10-11Mdst3703 projects-2012-10-11
Mdst3703 projects-2012-10-11Rafael Alvarado
 
Mdst 3559-01-25-data-journalism
Mdst 3559-01-25-data-journalismMdst 3559-01-25-data-journalism
Mdst 3559-01-25-data-journalismRafael Alvarado
 
Mdst3705 2013-01-29-praxis
Mdst3705 2013-01-29-praxisMdst3705 2013-01-29-praxis
Mdst3705 2013-01-29-praxisRafael Alvarado
 
Mdst3705 2012-01-15-introduction
Mdst3705 2012-01-15-introductionMdst3705 2012-01-15-introduction
Mdst3705 2012-01-15-introductionRafael Alvarado
 

Viewers also liked (8)

MDST 3703 F10 Seminar 11
MDST 3703 F10 Seminar 11MDST 3703 F10 Seminar 11
MDST 3703 F10 Seminar 11
 
Mdst3705 2013-01-31-php3
Mdst3705 2013-01-31-php3Mdst3705 2013-01-31-php3
Mdst3705 2013-01-31-php3
 
Mdst3703 2013-09-05-studio2
Mdst3703 2013-09-05-studio2Mdst3703 2013-09-05-studio2
Mdst3703 2013-09-05-studio2
 
Thatcamp2011 intro to-cm_ses
Thatcamp2011 intro to-cm_sesThatcamp2011 intro to-cm_ses
Thatcamp2011 intro to-cm_ses
 
Mdst3703 projects-2012-10-11
Mdst3703 projects-2012-10-11Mdst3703 projects-2012-10-11
Mdst3703 projects-2012-10-11
 
Mdst 3559-01-25-data-journalism
Mdst 3559-01-25-data-journalismMdst 3559-01-25-data-journalism
Mdst 3559-01-25-data-journalism
 
Mdst3705 2013-01-29-praxis
Mdst3705 2013-01-29-praxisMdst3705 2013-01-29-praxis
Mdst3705 2013-01-29-praxis
 
Mdst3705 2012-01-15-introduction
Mdst3705 2012-01-15-introductionMdst3705 2012-01-15-introduction
Mdst3705 2012-01-15-introduction
 

Similar to Mdst3705 2013-02-05-databases

Mdst3705 2013-02-19-text-into-data
Mdst3705 2013-02-19-text-into-dataMdst3705 2013-02-19-text-into-data
Mdst3705 2013-02-19-text-into-dataRafael Alvarado
 
Tutorial on Semantic Digital Libraries (WWW'2007)
Tutorial on Semantic Digital Libraries (WWW'2007)Tutorial on Semantic Digital Libraries (WWW'2007)
Tutorial on Semantic Digital Libraries (WWW'2007)Sebastian Ryszard Kruk
 
UVA MDST 3073 Texts and Models-2012-09-11
UVA MDST 3073 Texts and Models-2012-09-11UVA MDST 3073 Texts and Models-2012-09-11
UVA MDST 3073 Texts and Models-2012-09-11Rafael Alvarado
 
Mdst3703 2013-09-17-text-models
Mdst3703 2013-09-17-text-modelsMdst3703 2013-09-17-text-models
Mdst3703 2013-09-17-text-modelsRafael Alvarado
 
Using topic modelling frameworks for NLP and semantic search
Using topic modelling frameworks for NLP and semantic searchUsing topic modelling frameworks for NLP and semantic search
Using topic modelling frameworks for NLP and semantic searchDawn Anderson MSc DigM
 
Mdst3703 2013-09-10-textual-signals
Mdst3703 2013-09-10-textual-signalsMdst3703 2013-09-10-textual-signals
Mdst3703 2013-09-10-textual-signalsRafael Alvarado
 
Mdst3705 2013-02-12-finding-data
Mdst3705 2013-02-12-finding-dataMdst3705 2013-02-12-finding-data
Mdst3705 2013-02-12-finding-dataRafael Alvarado
 
chapter2 Know.representation.pptx
chapter2 Know.representation.pptxchapter2 Know.representation.pptx
chapter2 Know.representation.pptxwendifrawtadesse1
 
Tutorial on Semantic Digital Libraries (ESWC'2007)
Tutorial on Semantic Digital Libraries (ESWC'2007)Tutorial on Semantic Digital Libraries (ESWC'2007)
Tutorial on Semantic Digital Libraries (ESWC'2007)Sebastian Ryszard Kruk
 
Effective Semantics for Engineering NLP Systems
Effective Semantics for Engineering NLP SystemsEffective Semantics for Engineering NLP Systems
Effective Semantics for Engineering NLP SystemsAndre Freitas
 
Jarrar: ORM in Description Logic
Jarrar: ORM in Description Logic  Jarrar: ORM in Description Logic
Jarrar: ORM in Description Logic Mustafa Jarrar
 
Semantic web
Semantic webSemantic web
Semantic webtariq1352
 
Semantic Web: introduction & overview
Semantic Web: introduction & overviewSemantic Web: introduction & overview
Semantic Web: introduction & overviewAmit Sheth
 
UVA MDST 3703 Marking-Up a Text 2012-09-13
UVA MDST 3703 Marking-Up a Text 2012-09-13UVA MDST 3703 Marking-Up a Text 2012-09-13
UVA MDST 3703 Marking-Up a Text 2012-09-13Rafael Alvarado
 
Making the semantic web work
Making the semantic web workMaking the semantic web work
Making the semantic web workPaul Houle
 
Knowledge Representation, Semantic Web
Knowledge Representation, Semantic WebKnowledge Representation, Semantic Web
Knowledge Representation, Semantic WebSerendipity Seraph
 

Similar to Mdst3705 2013-02-05-databases (20)

Mdst3705 2013-02-19-text-into-data
Mdst3705 2013-02-19-text-into-dataMdst3705 2013-02-19-text-into-data
Mdst3705 2013-02-19-text-into-data
 
Tutorial on Semantic Digital Libraries (WWW'2007)
Tutorial on Semantic Digital Libraries (WWW'2007)Tutorial on Semantic Digital Libraries (WWW'2007)
Tutorial on Semantic Digital Libraries (WWW'2007)
 
UVA MDST 3073 Texts and Models-2012-09-11
UVA MDST 3073 Texts and Models-2012-09-11UVA MDST 3073 Texts and Models-2012-09-11
UVA MDST 3073 Texts and Models-2012-09-11
 
Mdst3703 2013-09-17-text-models
Mdst3703 2013-09-17-text-modelsMdst3703 2013-09-17-text-models
Mdst3703 2013-09-17-text-models
 
Using topic modelling frameworks for NLP and semantic search
Using topic modelling frameworks for NLP and semantic searchUsing topic modelling frameworks for NLP and semantic search
Using topic modelling frameworks for NLP and semantic search
 
Mdst3703 2013-09-10-textual-signals
Mdst3703 2013-09-10-textual-signalsMdst3703 2013-09-10-textual-signals
Mdst3703 2013-09-10-textual-signals
 
Mdst3705 2013-02-12-finding-data
Mdst3705 2013-02-12-finding-dataMdst3705 2013-02-12-finding-data
Mdst3705 2013-02-12-finding-data
 
chapter2 Know.representation.pptx
chapter2 Know.representation.pptxchapter2 Know.representation.pptx
chapter2 Know.representation.pptx
 
Tutorial on Semantic Digital Libraries (ESWC'2007)
Tutorial on Semantic Digital Libraries (ESWC'2007)Tutorial on Semantic Digital Libraries (ESWC'2007)
Tutorial on Semantic Digital Libraries (ESWC'2007)
 
Effective Semantics for Engineering NLP Systems
Effective Semantics for Engineering NLP SystemsEffective Semantics for Engineering NLP Systems
Effective Semantics for Engineering NLP Systems
 
BT02.pptx
BT02.pptxBT02.pptx
BT02.pptx
 
Jarrar: ORM in Description Logic
Jarrar: ORM in Description Logic  Jarrar: ORM in Description Logic
Jarrar: ORM in Description Logic
 
Semantic web
Semantic webSemantic web
Semantic web
 
Semantic web
Semantic webSemantic web
Semantic web
 
Semantic Web: introduction & overview
Semantic Web: introduction & overviewSemantic Web: introduction & overview
Semantic Web: introduction & overview
 
UVA MDST 3703 Marking-Up a Text 2012-09-13
UVA MDST 3703 Marking-Up a Text 2012-09-13UVA MDST 3703 Marking-Up a Text 2012-09-13
UVA MDST 3703 Marking-Up a Text 2012-09-13
 
Knowledge mangement
Knowledge mangementKnowledge mangement
Knowledge mangement
 
Making the semantic web work
Making the semantic web workMaking the semantic web work
Making the semantic web work
 
Knowledge Representation, Semantic Web
Knowledge Representation, Semantic WebKnowledge Representation, Semantic Web
Knowledge Representation, Semantic Web
 
frames.pptx
frames.pptxframes.pptx
frames.pptx
 

More from Rafael Alvarado

Mdst3703 2013-10-08-thematic-research-collections
Mdst3703 2013-10-08-thematic-research-collectionsMdst3703 2013-10-08-thematic-research-collections
Mdst3703 2013-10-08-thematic-research-collectionsRafael Alvarado
 
Mdst3703 2013-10-01-hypertext-and-history
Mdst3703 2013-10-01-hypertext-and-historyMdst3703 2013-10-01-hypertext-and-history
Mdst3703 2013-10-01-hypertext-and-historyRafael Alvarado
 
Mdst3703 2013-09-24-hypertext
Mdst3703 2013-09-24-hypertextMdst3703 2013-09-24-hypertext
Mdst3703 2013-09-24-hypertextRafael Alvarado
 
Mdst3703 2013-09-12-semantic-html
Mdst3703 2013-09-12-semantic-htmlMdst3703 2013-09-12-semantic-html
Mdst3703 2013-09-12-semantic-htmlRafael Alvarado
 
Mdst3703 2013-09-03-plato2
Mdst3703 2013-09-03-plato2Mdst3703 2013-09-03-plato2
Mdst3703 2013-09-03-plato2Rafael Alvarado
 
Mdst3703 2013-08-29-hello-world
Mdst3703 2013-08-29-hello-worldMdst3703 2013-08-29-hello-world
Mdst3703 2013-08-29-hello-worldRafael Alvarado
 
UVA MDST 3703 2013 08-27 Introduction
UVA MDST 3703 2013 08-27 IntroductionUVA MDST 3703 2013 08-27 Introduction
UVA MDST 3703 2013 08-27 IntroductionRafael Alvarado
 
MDST 3705 2012-03-05 Databases to Visualization
MDST 3705 2012-03-05 Databases to VisualizationMDST 3705 2012-03-05 Databases to Visualization
MDST 3705 2012-03-05 Databases to VisualizationRafael Alvarado
 
Mdst3705 2013-02-26-db-as-genre
Mdst3705 2013-02-26-db-as-genreMdst3705 2013-02-26-db-as-genre
Mdst3705 2013-02-26-db-as-genreRafael Alvarado
 
Mdst3705 2012-01-22-code-as-language
Mdst3705 2012-01-22-code-as-languageMdst3705 2012-01-22-code-as-language
Mdst3705 2012-01-22-code-as-languageRafael Alvarado
 
Mdst3705 2013-01-24-php2
Mdst3705 2013-01-24-php2Mdst3705 2013-01-24-php2
Mdst3705 2013-01-24-php2Rafael Alvarado
 
Mdst3703 graph-theory-11-20-2012
Mdst3703 graph-theory-11-20-2012Mdst3703 graph-theory-11-20-2012
Mdst3703 graph-theory-11-20-2012Rafael Alvarado
 
Mdst3703 maps-and-timelines-2012-11-13
Mdst3703 maps-and-timelines-2012-11-13Mdst3703 maps-and-timelines-2012-11-13
Mdst3703 maps-and-timelines-2012-11-13Rafael Alvarado
 
Mdst3703 culturomics-2012-11-01
Mdst3703 culturomics-2012-11-01Mdst3703 culturomics-2012-11-01
Mdst3703 culturomics-2012-11-01Rafael Alvarado
 
Mdst3703 visualization-2012-10-23
Mdst3703 visualization-2012-10-23Mdst3703 visualization-2012-10-23
Mdst3703 visualization-2012-10-23Rafael Alvarado
 
Mdst3703 shiva-2012-10-18
Mdst3703 shiva-2012-10-18Mdst3703 shiva-2012-10-18
Mdst3703 shiva-2012-10-18Rafael Alvarado
 
Mdst3703 ontology-overrated-2012-10-16
Mdst3703 ontology-overrated-2012-10-16Mdst3703 ontology-overrated-2012-10-16
Mdst3703 ontology-overrated-2012-10-16Rafael Alvarado
 
UVA MDST 3703 JavaScript (ii) 2012-10-04
UVA MDST 3703 JavaScript (ii) 2012-10-04UVA MDST 3703 JavaScript (ii) 2012-10-04
UVA MDST 3703 JavaScript (ii) 2012-10-04Rafael Alvarado
 
UVA MDST 3703 JavaScript 2012-09-27
UVA MDST 3703 JavaScript 2012-09-27UVA MDST 3703 JavaScript 2012-09-27
UVA MDST 3703 JavaScript 2012-09-27Rafael Alvarado
 

More from Rafael Alvarado (20)

Mdst3703 2013-10-08-thematic-research-collections
Mdst3703 2013-10-08-thematic-research-collectionsMdst3703 2013-10-08-thematic-research-collections
Mdst3703 2013-10-08-thematic-research-collections
 
Mdst3703 2013-10-01-hypertext-and-history
Mdst3703 2013-10-01-hypertext-and-historyMdst3703 2013-10-01-hypertext-and-history
Mdst3703 2013-10-01-hypertext-and-history
 
Mdst3703 2013-09-24-hypertext
Mdst3703 2013-09-24-hypertextMdst3703 2013-09-24-hypertext
Mdst3703 2013-09-24-hypertext
 
Presentation1
Presentation1Presentation1
Presentation1
 
Mdst3703 2013-09-12-semantic-html
Mdst3703 2013-09-12-semantic-htmlMdst3703 2013-09-12-semantic-html
Mdst3703 2013-09-12-semantic-html
 
Mdst3703 2013-09-03-plato2
Mdst3703 2013-09-03-plato2Mdst3703 2013-09-03-plato2
Mdst3703 2013-09-03-plato2
 
Mdst3703 2013-08-29-hello-world
Mdst3703 2013-08-29-hello-worldMdst3703 2013-08-29-hello-world
Mdst3703 2013-08-29-hello-world
 
UVA MDST 3703 2013 08-27 Introduction
UVA MDST 3703 2013 08-27 IntroductionUVA MDST 3703 2013 08-27 Introduction
UVA MDST 3703 2013 08-27 Introduction
 
MDST 3705 2012-03-05 Databases to Visualization
MDST 3705 2012-03-05 Databases to VisualizationMDST 3705 2012-03-05 Databases to Visualization
MDST 3705 2012-03-05 Databases to Visualization
 
Mdst3705 2013-02-26-db-as-genre
Mdst3705 2013-02-26-db-as-genreMdst3705 2013-02-26-db-as-genre
Mdst3705 2013-02-26-db-as-genre
 
Mdst3705 2012-01-22-code-as-language
Mdst3705 2012-01-22-code-as-languageMdst3705 2012-01-22-code-as-language
Mdst3705 2012-01-22-code-as-language
 
Mdst3705 2013-01-24-php2
Mdst3705 2013-01-24-php2Mdst3705 2013-01-24-php2
Mdst3705 2013-01-24-php2
 
Mdst3703 graph-theory-11-20-2012
Mdst3703 graph-theory-11-20-2012Mdst3703 graph-theory-11-20-2012
Mdst3703 graph-theory-11-20-2012
 
Mdst3703 maps-and-timelines-2012-11-13
Mdst3703 maps-and-timelines-2012-11-13Mdst3703 maps-and-timelines-2012-11-13
Mdst3703 maps-and-timelines-2012-11-13
 
Mdst3703 culturomics-2012-11-01
Mdst3703 culturomics-2012-11-01Mdst3703 culturomics-2012-11-01
Mdst3703 culturomics-2012-11-01
 
Mdst3703 visualization-2012-10-23
Mdst3703 visualization-2012-10-23Mdst3703 visualization-2012-10-23
Mdst3703 visualization-2012-10-23
 
Mdst3703 shiva-2012-10-18
Mdst3703 shiva-2012-10-18Mdst3703 shiva-2012-10-18
Mdst3703 shiva-2012-10-18
 
Mdst3703 ontology-overrated-2012-10-16
Mdst3703 ontology-overrated-2012-10-16Mdst3703 ontology-overrated-2012-10-16
Mdst3703 ontology-overrated-2012-10-16
 
UVA MDST 3703 JavaScript (ii) 2012-10-04
UVA MDST 3703 JavaScript (ii) 2012-10-04UVA MDST 3703 JavaScript (ii) 2012-10-04
UVA MDST 3703 JavaScript (ii) 2012-10-04
 
UVA MDST 3703 JavaScript 2012-09-27
UVA MDST 3703 JavaScript 2012-09-27UVA MDST 3703 JavaScript 2012-09-27
UVA MDST 3703 JavaScript 2012-09-27
 

Mdst3705 2013-02-05-databases

  • 1. From Data Structures to Databases Prof. Alvarado MDST 3703 5 February 2013
  • 2. Business • Quiz 1 – To be posted this evening – Due Thursday evening – Covers content before Databases – End-of-week reflections still due • Blogging – Please remember to be timely • Safari Resources – If you can‟t access, try going through the Library page
  • 3. Review • Building as knowing – Ramsay‟s point in “On Building” • DH as cultural reverse engineering – Finding the rules in the patterns – Texts and images are the patterns in question • Reverse engineering is like building – Same process in reverse (deconstruction) – Also requires building other things – like databases to store stuff
  • 4. For example, in Studio on Thursday we began to reverse engineer Plato’s Republic. The next step in our exercise was to parse the text into “words” and organize them in a list using an array
  • 5. By the way, were we actually grabbing words?
  • 6. Not really – we were find substrings, letter patterns that could also exist within words (e.g. “cavern”) Also, these patterns did not match synonyms or pronouns (e.g. “this”) that stand for the same thing as the word in question This is the difference between SYNTAX and SEMANTICS
  • 7. Syntax = sequences of signs Semantics = meanings of signs Semantics is much harder for computers to grasp than syntax In fact, some think that semantics is beyond the capacity of any computer …
  • 8. Getting back to PHP We can use arrays to model the text. So, within a FOREACH loop iterating through the lines of a text and parsing each line for “words,” we could do the following: $words[$word]++; $words[] = $word; $lines[$lineNumber][] = $word; Each method suggests a different model
  • 9. More about PHP Arrays • Arrays can be added to like so: $myArray[] = $newItem; • Arrays can also use strings instead of number as indices, e.g. $myArray[3] = „foo‟; $myArray[„person‟] = „Bob‟; • Array items may also point to arrays, creating multidimensional arrays $myArray[„person‟] = array(); $myArray[„person‟][„Bob‟] = $something;
  • 10. Arrays with string indices are called “associative arrays” in PHP Arrays of arrays can be used to create data structures like trees and grids
  • 11. Read Chapter 5 of PHP: The Good Parts to learn more about arrays (see link in Resources on the course blog) Also, the PHP manual is always a good place to look http://php.net/manual/en/language.types.array.php
  • 12. Arrays as Data Structures • PHP arrays can be used to create data structures to model things, like texts, e.g. $words[$word]++; $words[] = $word; $lines[$lineNumber][] = $word; • These three create the following 1. A simple list of word types (and their counts) 2. A list of each word in order (position and word) 3. A grid of line numbers and words
  • 13. Here is an example of how we would create the third kind of data structure. This would store a grid of words.
  • 14. These numbers are the first dimension of the array (Y) These horizontal numbers are the second dimension of the array (Y) And it would store the text in grid something like this one …
  • 15. In this model, a text is a grid of words, each with an X and Y coordinate Is this the only way to represent a text? Is it the most accurate?
  • 16. Texts can also be represented as trees
  • 17. Document Elements and Structures Play – Heading – Act + • Return Address • Scene + • Date – Line + • Recipient Info – Name Book – Title – Chapter + – Address • Verse + – Content • Salutation • Paragraph + • Closing Letter
  • 18. XML is designed to represent text
  • 19. What are some differences between trees and tables?
  • 20. Tables are more rigid Trees allow for indefinite depth But tables are easier to manipulate In any case, tables and trees are two major kinds of data structure that you will encounter …
  • 21. Speaking of trees … what is this?
  • 22. Tree of Logic (and a primitive computer) ". . . the tree of nature and logic by the thirteenth-century poet, philosopher, and missionary Ramon Lull. The main trunk supports a version of the tree of Porphyry, which illustrates Aristotle's categories. The ten leaves on the right represent ten types of questions, and the ten leaves on the left are keyed to a system of rotating disks for generating answers. Such diagrams and disks comprise Lull's Ars Magna (Great Art), which was the first attempt to develop mechanical aids to reasoning. It served as an inspiration to the pioneer in symbolic logic, Gottfried Wilhelm Leibniz.” John Sowa, explaining the cover art for Knowledge Representation
  • 23.
  • 24.
  • 25. What is this tree an example of?
  • 26. The tree is a “knowledge representation” (KR)
  • 27. A KR is a model that comprises 1. A set of categories (aka Ontology) Names and relationships between names 2. A set of inference rules (aka Logic) A method of traversing names and relations 3. A medium for computation A medium for producing inferences 4. A language for expressing these things Such as a programming or markup language
  • 28. Ontologies are systems of categories rooted in world views
  • 29. Ontologies consist of categories and their relationships These are often mapped onto physical things – the human body, or trees – as part of our cognitive model
  • 30. The tree as body as society among the Umeda of New Guinea
  • 31. Logic is a name for the systematic unpacking ontologies in discourse …
  • 32. Here is a sample ontology, one very similar to Aristotle’s
  • 33. And this is a syllogism, the basic unit of reasoning in classical logic How is it related to the tree?
  • 34. The sentences in the syllogism stand for the traversal of the tree that represents an implicit ontology
  • 35. Reasoning always implies an ontology Ontologies are often unexpressed Ontologies often conflict with each other (Digital) Humanists excavate or reverse engineer these ontologies
  • 36. Now, a KR for a computer has to be an operationalized KR How would we express a syllogism in PHP?
  • 37. One way is to convert the tree into an array
  • 38. But, given such an array, how can we find out if Socrates is mortal? How do we find if the following is set: 0 1 2 3 4
  • 39. We’d have to some some complicated nested looping to find the answer …
  • 40. So, PHP gives us tools to create an ontology, but not a way to reason efficiently with them To create more effective KRs, we need the services of a database
  • 41. A database is a “a system that allows for the efficient storage and retrieval of information” But beyond this, it also allows us to “represent knowledge” Given Unsworth‟s definition, how must it do this?
  • 42. Databases provide a language to define ontologies (schema) and to “unpack” these ontologies – via a query language that lets us efficiently search and retrieve data organized schema
  • 43. In this course, we are going to use a relational database to store and access information Relational databases use a language known as SQL (pronounced S-Q-L, although some say “sequel”)
  • 44. SQL • SQL stands for “Structured Query Language” – NOT invented by Microsoft • Invented in the 1970s and commercialized in the 1980s – Probably responsible for new business models like JIT inventories • Built on Codd‟s relational model (1970) – Implements set theory and formal logic – Around the time of SGML
  • 45. SQL • A language used by relational databases – Oracle, SQL Server, Access, etc.
  • 46. MySQL • A very fast, simplified, and easy to use relational database • A client/server app – Runs on the internet – Not a desktop app like Access • Created by Monty Widenius in the mid 1990s – Open Source – A Finn living in Sweden – Same time as PHP • Powered the Web 2.0 revolution
  • 47. phpMyAdmin • A PHP interface to MySQL • Relatively easy to use – No need to know SQL • Great to manage databases that your PHP programs will use • Today you will get started using UVA‟s free MySQL server
  • 48. The role of PHP

Editor's Notes

  1. (theoretically)
  2. Let’s look at another tree
  3. Let’s look at another tree