DOC PREVIEW
UMD CMSC 330 - Markup & Query Languages

This preview shows page 1-2 out of 7 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 7 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 7 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1CMSC 330: Organization of Programming LanguagesMarkup & Query LanguagesCMSC 330 2Other Language TypesMarkup languages•Set of annotations to textQuery languages•Make queries to databases & information systemsUsed together in •Web interface to databasesCMSC 330 3Markup LanguagesSet 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 getRegained importance with advent of web•Used to describe format & presentation of web pagesCMSC 330 4History of Markup LanguagesGML (1960s)•Generalized markup language•Describe both structure & presentation of contentHTML (1991)•Hypertext markup language •Flexible & simple descriptive markup for web pages•Hypertext links parts of document to other documentsCMSC 330 5History 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 documentCMSC 330 6Markup Language – GMLExample:h1.Recipes: :p.Bread:ol:li.Flour:li.Yeast:li.Water:eol.2CMSC 330 7Markup Language – HTMLExample<html><head><title>Bread Recipe</title></head><body><h1>Bread</h1><ol><li>Flour<li>Yeast<li>Water</ol></body></html>CMSC 330 8Markup Language – XMLExample<recipe name=“Bread”> <title>Bread</title><ingredient>Flour </ingredient><ingredient>Yeast</ingredient><ingredient>Water</ingredient></recipe>CMSC 330 9HTML / XML ElementsElement•A start tag, an end tag, and data in between•Examples<director> Tyler Perry </director><actor> Tyler Perry </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>CMSC 330 10HTML ElementsStructural•Describes purpose of text•Examples<h1> Level 1 heading <h1><ol> Ordered list </ol><ul> Unordered list </ul><li> List item </li>CMSC 330 11HTML 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.cs.umd.edu”> URL link </a>CMSC 330 12XML DocumentAn XML element with nested XML elements•Example<movies><movie year=“2005”><title> Diary of a Mad Black Woman </title><director> Tyler Perry </director></movie><movie year=“2006”><title> Madea's Family Reunion </title><director> Tyler Perry </director></movie></movies>3CMSC 330 13XML 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 fileCMSC 330 14Comparing HTML With XMLHTML•Fixed set of tags•Presentation oriented•No data validation capabilities•Single presentationXML•Extensible set of tags•Content oriented•Standard Data infrastructure •Multiple output formsCMSC 330 15Using Markup LanguagesDescriptive 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 fontCMSC 330 16Markup Language UsageStarted with documentsNow 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 togetherCMSC 330 17Query LanguagesMake queries to •Databases•Information systemsGoals•Data retrieval•Data managementExamples•SQL (1970s) – Query relational databases•LDAP (1993) – Query directory services for TCP/IPCMSC 330 18Databases (DB)A structured collection of data (records)•Whose content can be quickly and easilyAccessed, managed, updatedDatabase model•HierarchicalRecords are stored in a tree•NetworkRecords have links to other records•RelationalRecords are stored in tables (relations)4CMSC 330 19Tables (Relations)Each column constitutes an attributeEach 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 1MajorCMSC 330 20SQL (Structured Query Language)Queries for relational database systemsAllows for complete•Table creation, deletion, editing•Data extraction (queries)•Database management & administrationCMSC 330 21SQL – Creating DatabaseTypes of attributes•char, varchar, int,, decimal, date, etc.•varchar is a string with varying # of charsNot Null•Each record must have valuePrimary 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));CMSC 330 22SQL – 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));CMSC 330 23SQL – Inserting ValuesIdentical resultOrder of fields do not matterINSERT INTO tableName (name, sex, age) VALUES (‘Bob’, ‘M’, 42);INSERT INTO tableName (age, name, sex,) VALUES (42, ‘ Bob’, ‘M’);CMSC 330 24SQL – Updating ValuesOperations 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’5CMSC 330 25Database ServerAccepts 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 Edition CMSC 330 26Database Web InterfaceRequires•Database server (MySQL)•Web server (Apache)•Method of connecting two


View Full Document

UMD CMSC 330 - Markup & 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 & 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 & 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 & 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?