DOC PREVIEW
UMD CMSC 330 - Markup and Query languages

This preview shows page 1-2-3-19-20-38-39-40 out of 40 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1CMSC330Markup and Query languages2Other Language Types• Markup languages– Set of annotations to text• Query languages– Make queries to databases & information systems• Used together in – Web interface to databases3Markup Languages• Set of annotations (tags) added to text– Example – <tag> text </tag>• Describe how text is– Structured, laid out, formatted…• First used in publishing industry– Typesetting, proofreading• nroff, troff, TeX, LaTeX– Mostly replaced by WYSIWYG editors like MS Word• What you see is what you get• Regained importance with advent of web– Used to describe format & presentation of web pages4History of Markup Languages• GML (1960s)– Generalized markup language– Describe both structure & presentation of content• HTML (1991)– Hypertext markup language – Flexible & simple descriptive markup for web pages– Hypertext links parts of document to other documents5History of Markup Languages (cont.)• XML (1998)– Extensible markup language– Language for describing tags (meta-language)– User can create tags and describe their uses– Used to describe documents w/ structured information– No mechanism for displaying XML document6Markup Language – HTML• Example<html><head><title>Bread Recipe</title></head><body><h1>Bread</h1><ol><li>Flour<li>Yeast<li>Water</ol></body></html>7Markup Language – XML• Example<recipe name=“Bread”> <title>Bread</title><ingredient>Flour </ingredient><ingredient>Yeast</ingredient><ingredient>Water</ingredient></recipe>8HTML / XML Elements• Element– A start tag, an end tag, and data in between– Examples• <director> Clint Eastwood </director>• <actor> Clint Eastwood </actor>• Attribute– A name-value pair separated by an equal sign (=)– Used to attach additional information to an element– Example• <city ZIP=“20742”> College Park </city>9HTML Elements• Structural– Describes purpose of text– Examples• <h1> Level 1 heading <h1>• <ol> Ordered list </ol>• <ul> Unordered list </ul>• <li> List item </li>10HTML Elements (cont.)• Presentation– Describes appearance of text– Examples• <b> boldface </b>• <i> italics </i>• <p> line spacing </p>• Hypertext– Links part of document to other documents– Examples• <a> Anchor </a>• <a href=“http://www.umd.edu”> URL link </a>11XML Document• An XML element with nested XML elements– Example<movies><movie year=“1999”><title> True Crime </title><director> Clint Eastwood </director></movie><movie year=“1971”><title> The Beguiled </title><director> Tyler Perry </director></movie></movies>12XML Documents (cont.)• Guidelines– Elements must have an end tag (unlike HTML)– Elements must be cleanly nested• Overlapping elements are not allowed– Attribute values must be enclosed in quotation marks– Document must have unique first element (root node)• Document Type Definition (DTD) – User can create set of rules to specify legal content– Place restrictions on XML file13Comparing HTML With XML• HTML– Fixed set of tags– Presentation oriented– No data validation capabilities– Single presentation• XML– Extensible set of tags– Content oriented– Standard Data infrastructure – Multiple output forms14Using Markup Languages• Descriptive markup– Structure• How is this organized? (<chapter>, <section>)– Semantics• What is this? (<person>, <title>)• Separate presentation from content– Keep presentation elsewhere (CSS, XSL)– Puts content in “delivery neutral format”• <h1> is a first level heading, but can be any font15Markup Language Usage• Started with documents• Now also used to organize– Metadata• Data about data, used to help understand / manage data• Example: <LastName optional=“true”> Smith </LastName>– Transactions• Single unit of work for application– Applications• Helping applications interact / work together16Query Languages• Make queries to – Databases– Information systems• Goals– Data retrieval– Data management• Examples– SQL (1970s) – Query relational databases– LDAP (1993) – Query directory services for TCP/IP17Databases (DB)• A structured collection of data (records)– Whose content can be quickly and easily• Accessed, managed, updated• Database model– Hierarchical• Records are stored in a tree– Network• Records have links to other records– Relational• Records are stored in tables (relations)18Tables (Relations)• Each column constitutes an attribute• Each row constitutes a record or tupleAttribute 2(column 2)Record 2(tuple 2)Record 1(tuple 1)Attribute 1(column 1)$45KComputer ProgrammingRecord 2$37K$56K2007 StartingSalaryBiologyRecord 3Computer EngineeringRecord 1Major19SQL (Structured Query Language)• Queries for relational database systems• Allows for complete– Table creation, deletion, editing– Data extraction (queries)– Database management &administration20SQL – Creating Database• Types of attributes– char, varchar, int,, decimal, date, etc.– varchar is a string with varying # of chars• Not Null– Each record must have value• Primary key – Must be unique for each recordCREATE TABLE tableName (name VARCHAR(55),sex CHAR(1) NOT NULL,age INT(3),birthdate DATE,primary key(name));21SQL – Creating Database (cont.)• Primary key – Can use autoincrementednumbers as primary key– Guaranteed to be unique– 1stentry key = 1– 2ndentry key = 2, etc…CREATE TABLE tableName (name VARCHAR(55),sex CHAR(1) NOT NULL,age INT(3),birthdate DATE,id INT AUTO_INCREMENT, primary key(id));22SQL – Inserting ValuesINSERT INTO tableName (name, sex, age) VALUES (‘Bob’, ‘M’, 42);INSERT INTO tableName (age, name, sex,) VALUES (42, ‘ Bob’, ‘M’);• Identical result• Order of fields do not matter23SQL – Updating Values• Operations in the form– Select …– From …– Where …• Means– Select a column– From a database– Where x meets y conditionUPDATE tableNameSET age = ’52’WHERE name LIKE ‘Bob’24Database Server• Accepts requests to access database– Requests in query language (e.g., SQL)• MySQL– Multithreaded– Multiuser– SQL database management system (DBMS)– Open source• Free download of Community Edition25Database Web Interface• Requires– Database server (MySQL)– Web server (Apache)– Method of connecting two (scripts)• CGI, Javascript, PHP, Ruby on Rails26PHP – PHP: Hypertext


View Full Document

UMD CMSC 330 - Markup and Query languages

Documents in this Course
Exam #1

Exam #1

6 pages

Quiz #1

Quiz #1

2 pages

Midterm 2

Midterm 2

12 pages

Exam #2

Exam #2

7 pages

Ocaml

Ocaml

7 pages

Parsing

Parsing

38 pages

Threads

Threads

12 pages

Ruby

Ruby

7 pages

Quiz #3

Quiz #3

2 pages

Threads

Threads

7 pages

Quiz #4

Quiz #4

2 pages

Exam #2

Exam #2

6 pages

Exam #1

Exam #1

6 pages

Threads

Threads

34 pages

Quiz #4

Quiz #4

2 pages

Threads

Threads

26 pages

Exam #2

Exam #2

9 pages

Exam #2

Exam #2

6 pages

Load more
Download Markup and Query languages
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Markup and Query languages and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Markup and Query languages 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?