PowerPoint PresentationSlide 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 52Slide 53Slide 54Slide 55Slide 56Slide 57Slide 58Slide 59Slide 60Slide 61Slide 62Slide 63Slide 64Slide 65Slide 66Slide 67Slide 68Slide 69Slide 70Slide 71Slide 72Chapter 2 A Semantic Web Primer1Chapter 2Structured Web Documents in XMLGrigoris AntoniouFrank van HarmelenChapter 1 A Semantic Web Primer2The Semantic Web Layer TowerChapter 2 A Semantic Web Primer3An HTML Example<h2>Nonmonotonic Reasoning: Context-Dependent Reasoning</h2><i>by <b>V. Marek</b> and <b>M. Truszczynski</b></i><br>Springer 1993<br>ISBN 0387976892Chapter 2 A Semantic Web Primer4The Same Example in XML <book><title>Nonmonotonic Reasoning: Context-Dependent Reasoning</title><author>V. Marek</author><author>M. Truszczynski</author><publisher>Springer</publisher><year>1993</year><ISBN>0387976892</ISBN></book>Chapter 2 A Semantic Web Primer5HTML versus XML: SimilaritiesBoth use tags (e.g. <h2> and </year>) Tags may be nested (tags within tags) Human users can read and interpret both HTML and XML representations quite easily … But how about machines?Chapter 2 A Semantic Web Primer6Problems with Automated Interpretation of HTML DocumentsAn intelligent agent trying to retrieve the namesof the authors of the book Authors’ names could appear immediately after the titleor immediately after the word byAre there two authors?Or just one, called “V. Marek and M. Truszczynski”?Chapter 2 A Semantic Web Primer7HTML vs XML: Structural InformationHTML documents do not contain structural information: pieces of the document and their relationships. XML more easily accessible to machines because –Every piece of information is described. –Relations are also defined through the nesting structure. –E.g., the <author> tags appear within the <book> tags, so they describe properties of the particular book.Chapter 2 A Semantic Web Primer8HTML vs XML: Structural Information (2)A machine processing the XML document would be able to deduce that –the author element refers to the enclosing book element–rather than by proximity considerationsXML allows the definition of constraints on values–E.g. a year must be a number of four digitsChapter 2 A Semantic Web Primer9HTML vs XML: FormattingThe HTML representation provides more than the XML representation: –The formatting of the document is also described Τhe main use of an HTML document is to display information: it must define formattingXML: separation of content from display–same information can be displayed in different waysChapter 2 A Semantic Web Primer10HTML vs XML: Another ExampleIn HTML<h2>Relationship force-mass</h2><i> F = M × a </i>In XML<equation><meaning>Relationship force-mass</meaning><leftside> F </leftside><rightside> M × a </rightside></equation>Chapter 2 A Semantic Web Primer11HTML vs XML: Different Use of TagsIn both HTML docs same tagsIn XML completely differentHTML tags define display: color, lists …XML tags not fixed: user definable tagsXML meta markup language: language for defining markup languagesChapter 2 A Semantic Web Primer12XML VocabulariesWeb applications must agree on common vocabularies to communicate and collaborateCommunities and business sectors are defining their specialized vocabularies–mathematics (MathML)–bioinformatics (BSML)–human resources (HRML) –…Chapter 2 A Semantic Web Primer13Lecture Outline1. Introduction2. Detailed Description of XML3. Structuringa) DTDsb) XML Schema4. Namespaces5. Accessing, querying XML documents: XPath6. Transformations: XSLTChapter 2 A Semantic Web Primer14The XML LanguageAn XML document consists of a prologa number of elementsan optional epilog (not discussed)Chapter 2 A Semantic Web Primer15Prolog 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">Chapter 2 A Semantic Web Primer16XML ElementsThe “things” the XML document talks about–E.g. books, authors, publishersAn element consists of:–an opening tag–the content–a closing tag<lecturer>David Billington</lecturer>Chapter 2 A Semantic Web Primer17XML Elements (2)Tag names can be chosen almost freely.The first character must be a letter, an underscore, or a colonNo name may begin with the string “xml” in any combination of cases –E.g. “Xml”, “xML”Chapter 2 A Semantic Web Primer18Content of XML ElementsContent 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/> for <lecturer></lecturer>Chapter 2 A Semantic Web Primer19XML AttributesAn empty element is not necessarily meaningless–It may have some properties in terms of attributesAn attribute is a name-value pair inside the opening tag of an element<lecturer name="David Billington" phone="+61 − 7 − 3875 507"/>Chapter 2 A Semantic Web Primer20XML Attributes: An Example<order orderNo="23456" customer="John Smith" date="October 15, 2002"><item itemNo="a528" quantity="1"/><item itemNo="c817" quantity="3"/></order>Chapter 2 A Semantic Web Primer21The 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>Chapter 2 A Semantic Web Primer22XML Elements vs AttributesAttributes can be replaced by elementsWhen to use elements and when attributes is a matter of tasteBut attributes cannot be nestedChapter 2 A Semantic Web Primer23Further Components of XML DocsComments–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"?>Chapter 2 A Semantic Web Primer24Well-Formed XML DocumentsSyntactically correct
View Full Document