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

    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..
  Name       Module          Mark                           Smith
                                                            Semantic Web
  Smith   Semantic Web        86                      <mark>
                                      =>                    86
  Smith Advanced Databases 45                         <name>
  Jones Artificial Intelligence 95                  ……..
                                     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
 text documents such as bibliographies,

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

  language of SOAP - Simple Object Access

                        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
XML/XML schema is being widely accepted cf in the .NET

                          The Semantic Web
XML / XML Schema

  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 (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>
     <friend-of>Peppermint Patty</friend-of>
     <qualification> extroverted beagle </qualification>
    <name>Peppermint Patty</name>
    <qualification>bold, brash and tomboyish</qualification>
                                The Semantic Web
XML Schema – Example1
  <?xml version="1.0" encoding="utf-8"?>
  <xs:schema xmlns:xs="">
   <xs:element name="book">
      <xs:element name="title" type="xs:string"/>
      <xs:element name="author" type="xs:string"/>
      <xs:element name="character" minOccurs="0" maxOccurs="unbounded">
          <xs:element name="name" type="xs:string"/>
          <xs:element name="friend-of" type="xs:string" minOccurs="0"
          <xs:element name="since" type="xs:date"/>
          <xs:element name="qualification" type="xs:string"/>
     <xs:attribute name="isbn" type="xs:string"/>

                                       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'))
             (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:

       <Variable> x </Variable>

                           The Semantic Web

     XML Schema is being used extensively now in new

     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

Shared By: