Cse 428 semantic web topics xml
Download
1 / 7

CSE 428 - PowerPoint PPT Presentation


  • 290 Views
  • Uploaded on

CSE 428 Semantic Web Topics XML. Jeff Heflin Lehigh University. XML Example. <?xml version="1.0" ?> <cd sernum="99999">

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'CSE 428' - Olivia


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Cse 428 semantic web topics xml l.jpg

CSE 428Semantic Web TopicsXML

Jeff Heflin

Lehigh University


Xml example l.jpg
XML Example

<?xml version="1.0" ?> <cd sernum="99999">

<!-- IMHO, a truly great CD -->  <title>Yankee Hotel Foxtrot</title>   <artist>Wilco</artist>   <cover photo="/covers/yht.gif" />   <track no=“4">War on War</track> </cd>


Xml dtd l.jpg
XML DTD

<!ELEMENT cd (title, artist, track*, cover?) ><!ATTLIST cdsernum CDATA #REQUIRED> <!ELEMENT title   (#PCDATA) > <!ELEMENT artist (#PCDATA) > <!ELEMENT cover EMPTY> <!ATTLIST cover         photo CDATA #REQUIRED>


Xml schema example l.jpg
XML Schema Example

<xsd:schema xmlns:xsd="http://www.w3.org//2000/10/XMLSchema"><xsd:element name="movie"> <xsd:complexType>                <!-- b/c it has children --> <xsd:sequence> <xsd:element name="title" type="xsd:string" /> <xsd:element name="director“> <xsd:complexType>       <xsd:sequence> <xsd:element name="title" type="xsd:string" minOccurs="0" />       <xsd:element name="fname" type="xsd:string" /> <xsd:element name="lname" type="xsd:string" /> </xsd:sequence> </xsd:complexType>    </xsd:element>       <xsd:element name="actor" minOccurs="0" maxOcurs="unbounded" >        ...       </xsd:element> </xsd:sequence>    <xsd:attribute name="gross" type="xsd:decimal" /> </xsd:complexType></xsd:element>

</xsd:schema>


Name conflicts l.jpg
Name Conflicts?

Elements about people: title, fname, lname

Elements about movies: title, director, actor

<movie> <title>Star Wars</title> <director> <fname>George</fname> <lname>Lucas</lname> </director> <actor> <title>Sir</title> <fname>Alec</fname> <lname>Guiness</lname> </actor> </movie>


Xml namespaces l.jpg
XML Namespaces

<m:movie xmlns:m="http://www.hollywood.org/movies" xmlns:p="http://www.standards.org/people"> <m:title>Star Wars</m:title> <m:director> <p:fname>George</p:fname> <p:lname>Lucas</p:lname> </m:director> <m:actor> <p:title>Sir</p:title> <p:fname>Alec</p:fname> <p:lname>Guiness</p:lname> </m:actor> </m:movie>


Xslt example l.jpg

<xsl:stylesheet version=“1.0” xmlns:xsl=“http://www.w3.org/1999/…”>

<xsl:template match="/"> <html> <body> <xsl:apply-templates select="book“ /> </body> </html><xsl:template>

<xsl:template match="book"> <p> <b><xsl:value-of select="title" /></b>     by <xsl:value-of select="author“ /> . <xsl:value-of select="published“ /> </p></xsl:template> </xsl:stylesheet>

XSLT Example

An XSLT Stylesheet

Original Document

<book>     <title>The Fellowship of the Ring</title>     <author>J.R.R. Tolkien</author>     <published>1963</published> </book>

Transformed Document

<html><body>     <p> <b>The Fellowship of the Ring</b>     by J.R.R. Tolkien. 1963 </p> </body>

</html>


ad