The Semantic Web – WEEK 3 XML Schema

Document Sample
The Semantic Web – WEEK 3 XML Schema Powered By Docstoc
					The Semantic Web –
WEEK 3: XML Schema
  Tutorial/Practical: Exercises using
  the Suns

  Today’s lecture will include material
  relevant to Advanced DBs and
  Language Specification and
  Implementation modules!

  Lee McCluskey
    Recap of last week
   Well formed XML documents
   Valid XML documents - XML DTDs
   API’s for XML – DOMs
   URIs
   XML namespaces: XML namespace is a collection of
    names, identified by a URI reference, which are used in XML
    documents as element types and attribute names.




                              The Semantic Web
Semantic Web Technological
Infrastructure


    OWL                     - web ontology
    RDF   RDF(S)            - resource descriptions

    XML   XML Schema         - basic meta-language




                   The Semantic Web
Relational DB =>XML
Users can exchange data with a
uniform textual representation..
                                                    <person>
                                                      <name>
  Name       Module          Mark                           Smith
                                                       </name>
                                                      <module>
                                                            Semantic Web
                                                      </module>
  Smith   Semantic Web        86                      <mark>
                                      =>                    86
                                                      </mark>
  Smith Advanced Databases 45                         <name>
                                                            Smith
                                                       </name>
                                                    ……..
                                                    ……..
  Jones Artificial Intelligence 95                  ……..
                                                    </person>
                                     The Semantic Web
XML Schema - general idea
We can capture in XML
 typical database applications

 formal languages such as programming

  languages, query languages, mark-up languages
  etc
 text documents such as bibliographies,

  dictionaries, ontologies (later!) etc
 communication/messaging languages eg it is the

  language of SOAP - Simple Object Access
  Protocol

                        The Semantic Web
XML Schema – the need
  XML DTDs are limited for defining docs – they just
   define internal syntax structure
  XML Schema gives a way of defining a document an
   expressive data structure (with built in data types and
   complex types)
  Document constructs should have universal names,
   whose scope extends beyond their containing
   document. XML Schema allows others to re-use ‘mark-
   up’ vocabulary via namespaces
The Schema standard proposal is in
http://www.w3.org/2001/XMLSchema
XML/XML schema is being widely accepted cf in the .NET


                          The Semantic Web
XML / XML Schema

         Warning
  These languages are
 the MOST verbose you
  will ever encounter!!!

          The Semantic Web
 XML Schema
 The basic idea is the SAME as with DTDs: that
  with XML data document we have a
              Schema document
(written in XML of course!) which tightly
  defines the data document’s content.

This document in very similar to a user defined
  ‘data definition’ as found in high level
  programming languages.
                       The Semantic Web
XML Schema – Example1
 From XML.com (E.Van der Vlist)
 <?xml version="1.0" encoding="UTF-8"?>
  <book isbn="0836217462">
   <title> Being a Dog Is a Full-Time Job </title>
   <author>Charles M. Schulz</author>
   <character>
     <name>Snoopy</name>
     <friend-of>Peppermint Patty</friend-of>
     <since>1950-10-04</since>
     <qualification> extroverted beagle </qualification>
   </character>
   <character>
    <name>Peppermint Patty</name>
    <since>1966-08-22</since>
    <qualification>bold, brash and tomboyish</qualification>
   </character>
 </book>
                                The Semantic Web
XML Schema – Example1
  <?xml version="1.0" encoding="utf-8"?>
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <xs:element name="book">
    <xs:complexType>
     <xs:sequence>
      <xs:element name="title" type="xs:string"/>
      <xs:element name="author" type="xs:string"/>
      <xs:element name="character" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
         <xs:sequence>
          <xs:element name="name" type="xs:string"/>
          <xs:element name="friend-of" type="xs:string" minOccurs="0"
                          maxOccurs="unbounded"/>
          <xs:element name="since" type="xs:date"/>
          <xs:element name="qualification" type="xs:string"/>
         </xs:sequence>
        </xs:complexType>
      </xs:element>
     </xs:sequence>
     <xs:attribute name="isbn" type="xs:string"/>
    </xs:complexType>
   </xs:element>
  </xs:schema>


                                       The Semantic Web
XML Schema – Example 2
 Example from LSI module – capturing the syntax
   structure of a simple programming language
 data Cmd =   Assigns Identifier Exp
            | Sequence Cmd Cmd
            | While Exp Cmd
            | Block Dec Cmd
 data Dec = Const Identifier Exp
            | Var Identifier Exp
 data Exp =   SN Int
            | SB Bool
            | SV Identifier
            | SC Identifier
            | Plus Exp Exp
            | Minus Exp Exp
            | GT Exp Exp

                        The Semantic Web
XML Schema – Example 2

  (Block (Var 'r' (SV 'y'))
      (Block (Var 'q' (SN 0))
          (While (GT (SV 'r') (SV 'x'))
            (Sequence
             (Assigns 'r' (Minus (SV 'r') (SV 'x') ))
             (Assigns 'q' (Plus (SV 'q') (SN 1 ) ))
            )
           )
        )
  )
 “Concrete Syntax” .. Var r = y; Var q = 0;
 while r > x do r = r-x; q = q+1 endwhile

                        The Semantic Web
XML Schema – Example 2

      x = q+1 represented as:

      <Cmd>
      <Assigns>
       <Variable> x </Variable>
       <Exp>
        <Plus>
         <VarName>q</VarName>
         <Number>1</Number>
        </Plus>
       </Exp>
      </Assigns>
      </Cmd>


                           The Semantic Web
Summary

     XML Schema is being used extensively now in new
      technologies

     It is just a Standard by which we can specify complex data
         structures quite precisely, in such a way that the
         structures can be shared via the internet.




                         The Semantic Web
Web

				
DOCUMENT INFO
Shared By:
Categories:
Stats:
views:8
posted:9/15/2010
language:English
pages:14