CSE 428 Semantic Web Topics XML - PowerPoint PPT Presentation

1 / 7
About This Presentation
Title:

CSE 428 Semantic Web Topics XML

Description:

artist Wilco /artist cover photo='/covers/yht.gif' / track no ... ELEMENT artist (#PCDATA) !ELEMENT cover EMPTY !ATTLIST cover. photo CDATA #REQUIRED ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 8
Provided by: JeffH47
Category:
Tags: cse | xml | artist | semantic | topics | web

less

Transcript and Presenter's Notes

Title: CSE 428 Semantic Web Topics XML


1
CSE 428Semantic Web TopicsXML
  • Jeff Heflin
  • Lehigh University

2
XML Example
lt?xml version"1.0" ?gt ltcd sernum"99999"gt
lt!-- IMHO, a truly great CD --gt  lttitlegtYankee
Hotel Foxtrotlt/titlegt   ltartistgtWilcolt/artistgt
  ltcover photo"/covers/yht.gif" /gt   lttrack
no4"gtWar on Warlt/trackgt lt/cdgt
3
XML DTD
  • lt!ELEMENT cd (title, artist, track, cover?)
    gtlt!ATTLIST cd         sernum CDATA REQUIREDgt
    lt!ELEMENT title   (PCDATA) gt lt!ELEMENT artist
    (PCDATA) gt lt!ELEMENT cover EMPTYgt lt!ATTLIST
    cover         photo CDATA REQUIREDgt

4
XML Schema Example
  • ltxsdschema xmlnsxsd"http//www.w3.org//2000/10/
    XMLSchema"gtltxsdelement name"movie"gt ltxsdcompl
    exTypegt                lt!-- b/c it has children
    --gt ltxsdsequencegt ltxsdelement name"title"
    type"xsdstring" /gt ltxsdelement
    name"directorgt ltxsdcomplexTypegt       ltx
    sdsequencegt ltxsdelement name"title"
    type"xsdstring" minOccurs"0"
    /gt       ltxsdelement name"fname"
    type"xsdstring" /gt ltxsdelement
    name"lname" type"xsdstring" /gt lt/xsdsequ
    encegt lt/xsdcomplexTypegt   
    lt/xsdelementgt       ltxsdelement name"actor"
    minOccurs"0" maxOcurs"unbounded"
    gt        ...       lt/xsdelementgt lt/xsdsequen
    cegt    ltxsdattribute name"gross"
    type"xsddecimal" /gt lt/xsdcomplexTypegtlt/xsdel
    ementgt
  • lt/xsdschemagt

5
Name Conflicts?
  • Elements about people title, fname, lname
  • Elements about movies title, director, actor
  • ltmoviegt lttitlegtStar Warslt/titlegt
    ltdirectorgt ltfnamegtGeorgelt/fnamegt ltlnamegtLuca
    slt/lnamegt lt/directorgt ltactorgt lttitlegtSirlt/tit
    legt ltfnamegtAleclt/fnamegt ltlnamegtGuinesslt/lname
    gt lt/actorgt lt/moviegt

6
XML Namespaces
  • ltmmovie xmlnsm"http//www.hollywood.org/movies"
    xmlnsp"http//www.standards.org/people"gt
    ltmtitlegtStar Warslt/mtitlegt ltmdirectorgt ltp
    fnamegtGeorgelt/pfnamegt ltplnamegtLucaslt/plnamegt
    lt/mdirectorgt ltmactorgt ltptitlegtSirlt/ptitlegt
    ltpfnamegtAleclt/pfnamegt ltplnamegtGuinesslt/pl
    namegt lt/mactorgt lt/mmoviegt

7
XSLT Example
An XSLT Stylesheet
Original Document
  • ltbookgt     lttitlegtThe Fellowship of the
    Ringlt/titlegt     ltauthorgtJ.R.R. Tolkienlt/authorgt
        ltpublishedgt1963lt/publishedgt lt/bookgt
  • ltxslstylesheet version1.0 xmlnsxslhttp//w
    ww.w3.org/1999/gt
  • ltxsltemplate match"/"gt lthtmlgt ltbodygt ltxslapp
    ly-templates select"book /gt lt/bodygt lt/htmlgtltx
    sltemplategt
  • ltxsltemplate match"book"gt ltpgt ltbgtltxslvalue-of
    select"title" /gtlt/bgt     by ltxslvalue-of
    select"author /gt . ltxslvalue-of
    select"published /gt lt/pgtlt/xsltemplategt
    lt/xslstylesheetgt

Transformed Document
lthtmlgtltbodygt     ltpgt ltbgtThe Fellowship of the
Ringlt/bgt     by J.R.R. Tolkien. 1963 lt/pgt
lt/bodygt lt/htmlgt
Write a Comment
User Comments (0)
About PowerShow.com