DOC PREVIEW
UTD CS 6314 - Semantic Web Intro and XML - Part 2

This preview shows page 1-2-3-25-26-27-28-50-51-52 out of 52 pages.

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

Unformatted text preview:

Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25Slide 26Slide 27Slide 28Slide 29Slide 30Slide 31Slide 32Slide 33Slide 34Slide 35Slide 36Slide 37Slide 38Slide 39Slide 40Slide 41Slide 42Slide 43Slide 44Slide 45Slide 46Slide 47Slide 48Slide 49Slide 50Slide 51Slide 52Semantic WebSemantic Web HistoryXML and RDFPart 2--Overview--1)XML Basics2)XML Structure3)RDF Basics--Review--XML BasicsThe XML LanguageAn XML document consists of a prologa number of elementsan optional epilog (not discussed)Prolog of an XML DocumentThe prolog consists of an XML declaration and an optional reference to external structuring documents<?xml version="1.0" encoding="UTF-16"?><!DOCTYPE book SYSTEM "book.dtd">XML ElementsThe “things” the XML document talks about–e.g. books, authors, publishersAn element consists of:–an opening tag–the content–a closing tag<lecturer>David Billington</lecturer>XML Elements (2)Tag names can be chosen almost freely.The first character must be a letter, an underscore, or a colonNo name may begin with the string “xml” in any combination of cases:–e.g. “Xml”, “xMl”, “xmL”, “XMl”, “XmL”, “xML”,“XML”Content of XML ElementsContent may be text, or other elements, or nothing <lecturer><name>David Billington</name><phone> +61 − 7 − 3875 507 </phone></lecturer>If there is no content, then the element is called empty; it is abbreviated as follows:<lecturer/> ( is short for <lecturer></lecturer> )XML AttributesAn empty element is not necessarily meaningless–It may have some properties in terms of attributesAn attribute is a name-value pair inside the opening tag of an element<lecturer name="David Billington" phone="+61 − 7 − 3875 507"/>XML Attributes: An Example<order orderNo="23456" customer="John Smith" date="October 15, 2002"><item itemNo="a528" quantity="1"/><item itemNo="c817" quantity="3"/></order>The Same Example without Attributes<order><orderNo>23456</orderNo><customer>John Smith</customer><date>October 15, 2002</date><item><itemNo>a528</itemNo><quantity>1</quantity></item><item><itemNo>c817</itemNo><quantity>3</quantity></item></order>XML Elements vs AttributesAttributes can be replaced by elementsWhen to use elements and when attributes is a matter of tasteHowever, attributes cannot be nested!Further Components of XML DocsComments–A piece of text that is to be ignored by parser–<!-- This is a comment --> Processing Instructions (PIs)–Define procedural attachments–<?stylesheet type="text/css" href="mystyle.css"?>Well-Formed XML DocumentsSyntactically correct documentsSome syntactic rules:–Only one outermost element (called root element)–Each element contains an opening and a corresponding closing tag–Tags may not overlap<author><name>Lee Hong</author></name>–Attributes within an element have unique names–Element and tag names must be permissibleThe Tree Model of XML Documents: An Example<email><head><from name="Michael Maher" address="[email protected]"/><to name="Grigoris Antoniou"address="[email protected]"/><subject>Where is your draft?</subject></head><body>Grigoris, where is the draft of the paper you promised me last week?</body></email>The Tree Model of XML Documents: An Example (2)The Tree Model of XML Docs The tree representation of an XML document is an ordered labeled tree:–There is exactly one root–There are no cycles–Each non-root node has exactly one parent–Each node has a label–The order of elements is important –… but the order of attributes is not importantXML Lecture Outline1. Introduction2. Detailed Description of XML3. Structuringa) DTD (Document Type Definition)b) XML Schema4. Namespaces5. Accessing, querying XML documents: XPathStructuring XML Documents Define all the element and attribute names that may be usedDefine the structure –what values an attribute may take–which elements may or must occur within other elements, etc.If such structuring information exists, the document can be validated (i.e., parsed)Structuring XML Dcuments (2)An XML document is valid if –it is well-formed–respects the structuring information it usesThere are two ways of defining the structure of XML documents: –DTDs (the older and more restricted way)–XML Schema (offers extended possibilities)DTD: Element Type Definition<lecturer><name>David Billington</name><phone> +61 − 7 − 3875 507 </phone></lecturer>DTD for above element (and all lecturer elements):<!ELEMENT lecturer (name, phone)><!ELEMENT name (#PCDATA)><!ELEMENT phone (#PCDATA)>The Meaning of the DTDThe element types lecturer, name, and phone may be used in the documentA lecturer element contains a name element and a phone element, in that order (sequence)A name element and a phone element may have any content In DTDs, #PCDATA is the only atomic type for elementsDTD: Disjunction in Element Type DefinitionsWe express that a lecturer element contains either a name element or a phone element as follows:<!ELEMENT lecturer (name|phone)>We express that a lecturer element contains both a name element and a phone element in any order:<!ELEMENT lecturer((name,phone)|(phone,name))>Example of an XML Element<order orderNo="23456" customer="John Smith" date="October 15, 2002"><item itemNo="a528" quantity="1"/><item itemNo="c817" quantity="3"/></order>The Corresponding DTD<!ELEMENT order (item+)><!ATTLIST order orderNo ID #REQUIREDcustomer CDATA #REQUIREDdate CDATA #REQUIRED><!ELEMENT item EMPTY><!ATTLIST item itemNo ID #REQUIREDquantity CDATA #REQUIREDcomments CDATA #IMPLIED>Notes about the DTDThe item element type is defined to be empty + (after item) is a cardinality operator:–?: appears zero times or once–*: appears zero or more times–+: appears one or more times–No cardinality operator means exactly onceNotes about the DTD (2)●In addition to defining elements, we define attributes●This is done in an attribute list containing:–Name of the element type to which the list applies–A list of triplets consisting:●Name●Type●Value Type...(and possible follow-on data)DTD: Attribute NamesAny name that may be used in an XML document using a DTDDTD: Attribute TypesSimilar to predefined data types, but limited selectionThe most important types


View Full Document

UTD CS 6314 - Semantic Web Intro and XML - Part 2

Download Semantic Web Intro and XML - Part 2
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 Semantic Web Intro and XML - Part 2 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 Semantic Web Intro and XML - Part 2 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?