SlideShare a Scribd company logo
1 of 41
Chapter 2   XML & Its Impact
Introduction
• Definition 2.1: XML is used to improve
  compatibility between the desperate
  systems of business partners by defining
  the meaning of data in business
  documents.
• Definition 2.2: XML is a language
  allowing the exchange of structured data.


Akerkar: Foundations of   © Narosa Publishing House, 2009   2
Semantic Web.
The design goals for XML

     –   XML shall be straightforwardly usable over the Internet.
     –   XML shall support a wide variety of applications.
     –   XML shall be compatible with SGML.
     –   It shall be easy to write programs which process XML
         documents.
     –   The number of optional features in XML is to be kept to the
         absolute minimum, ideally zero.
     –   XML documents should be human-legible and reasonably clear.
     –   The XML design should be prepared quickly.
     –   The design of XML shall be formal and concise.
     –   XML documents shall be easy to create.
     –   Terseness in XML markup is of minimal importance.

Akerkar: Foundations of   © Narosa Publishing House, 2009              3
Semantic Web.
W3C Understanding XML
• XML is for structuring data
• XML looks a bit like HTML
• XML is text, but isn’t meant to be read
• XML is verbose by design
• XML is a family of technologies
• XML is new, but not that new
• XML leads HTML to XHTML
• XML is modular
• XML is the basis for Resource Description Format (RDF)
  and the Semantic Web
• XML is license-free, platform-independent and well-
  supported

Akerkar: Foundations of   © Narosa Publishing House, 2009   4
Semantic Web.
XML Processing
• Example 2.1: gopal.xml is an XML document
  containing Gopal's resume. The document
  contains educational background, earlier work
  experience, references, and contact information
  by markup tags:
           <resume>
                  <contact-info> ... </contact-info>
                  <education> ... </education>
                  <experience> ... </experience>
                  <references> ... </references>
           </resume>


Akerkar: Foundations of    © Narosa Publishing House, 2009   5
Semantic Web.
XML Processing



                                      XML
                                    Processor
         gopal.xml                                          gopal.html




Akerkar: Foundations of   © Narosa Publishing House, 2009                6
Semantic Web.
HTML & XML
           <p> The lecture notes on: <br />
           <i> Semantic Web. </i>
           Author of the notes <br />
           <b> R. Akerkar. </b>


           <book_title> Semantic Web </book_title>
           <author> R. Akerkar </author>
           <publisher> Narosa Publishing House </publisher>
           <copydate> 2008 </copydate>


Akerkar: Foundations of   © Narosa Publishing House, 2009     7
Semantic Web.
XML Prolog
    prolog ::= (declaration, misc*, dtd?, misc*)
    misc ::= (comment | pi)

Here is a sample XML declaration:
           <?xml version = "1.0" encoding = "UTF-16"
            standalone = "yes"?>




Akerkar: Foundations of   © Narosa Publishing House, 2009   8
Semantic Web.
XML Comment
     – An XML comment has the same form as an HTML
       comment:
           <!-- this is an XML comment -->
     – XML processors ignore XML comments.
     – A processing instruction (PI) provides processing
       directions in the form of attribute values to a target
       XML processor. For example, the following PI tells a
       style sheet processor which style sheet should be
       used to process this document:
           <?xml:stylesheet type = "text/xsl" href = "outline.xsl"?>



Akerkar: Foundations of    © Narosa Publishing House, 2009             9
Semantic Web.
Elements
           element ::= (start-tag, content?, end-tag) | empty-elem-tag

           start-tag ::= <(name, attribute*)>
           end-tag ::= </name>

           empty-elem-tag ::= <(name, attribute+)/>
           content ::= (text | comment | pi | entity-ref | element)+

           <memo> <from> Gopal <to> Gita </from> </to> Dinner tonight?
            </memo>




Akerkar: Foundations of     © Narosa Publishing House, 2009              10
Semantic Web.
Document Declaration
• An XML document consists of a
  declaration followed by a single element
  called the root:

           <?xml version = "1.0"?>
            <ROOT>
                 CONTENT
            </ROOT>



Akerkar: Foundations of     © Narosa Publishing House, 2009   11
Semantic Web.
XML Overview
                                   XML Concepts




                                    Elements &
           DTDs                                             Namespaces
                                     Attributes




Akerkar: Foundations of   © Narosa Publishing House, 2009                12
Semantic Web.
Public Languages
• A registry of public languages is
  maintained by xml.org at:

           http://www.xml.org/xml/registry.jsp


     W3C recommendations also include a number
      of public languages including XHTML,
      MathML, and SVG.


Akerkar: Foundations of   © Narosa Publishing House, 2009   13
Semantic Web.
Foreign Elements
• A LabML report has the format:

           <experiment date = "...">
                 <introduction>...</introduction>
                 <equipment-list>...</equipment-list>
                 <procedure>...</procedure>
                 <data>...</data>
                 <analysis>...</analysis>
                 <summary>...</summary>
            </experiment>

Akerkar: Foundations of   © Narosa Publishing House, 2009   14
Semantic Web.
XML Design Patterns
• Document-Oriented
             <html> ... </html>
             <report> ... </report>
             <invoice> ... </invoice>
             <chapter> ... </chapter>

• Data Oriented
             <employee> ... </employee>
             <measurement> ... </measurement>
             <organization> ... </organization>

• Command Oriented
             <deposit> ... </deposit>
             <transfer> ... </transfer>
             <invoke> ... </invoke>
             <render> ... </render>


Akerkar: Foundations of      © Narosa Publishing House, 2009   15
Semantic Web.
Data Structures
• Records
           • <record type = "student">
                   <field name = "name"> Gopal </field>
                   <field name = "gpa"> 1.2 </field>
                   <field name = "class"> B. Sc. Second Year </field>
                   <!-- etc -->
             </record>
• Or, less generically:
           • <student>
                   <name> Gopal </name>
                   <gpa> 1.2 </gpa>
                   <class> B. Sc. Second Year </class>
                   <!-- etc -->
             </student>

Akerkar: Foundations of   © Narosa Publishing House, 2009               16
Semantic Web.
Data Structures
• Lists can be implicitly ordered by their position in the document
  (document order):
              <items>
                     <item>   100   </item>
                     <item>   200   </item>
                     <item>   300   </item>
                     <item>   400   </item>
                     <item>   500   </item>
              </items>

• Or the order can be made explicit:
           <items>
           <item id = "id4">
              <data> 400 </data>
              <prev ref = "id3"/>
              <next ref = "id5"/>
           </item>
             ….
             ….

Akerkar: Foundations of        © Narosa Publishing House, 2009        17
Semantic Web.
• Example 2.2: Let us consider a document
  containing Rita Mathur’s address. This
  information can be represented as:
           <label>
           <name> Rita Mathur </name>
           <address>
           <street> 12 Jaiprakash nagar, Goregaon </street>
           <city> Mumbai </city>
           <state> Maharashtra </state>
           </address>
           </label>

Akerkar: Foundations of   © Narosa Publishing House, 2009     18
Semantic Web.
• Example 2.3: Attributes are used to
  represent the information.
           <address
           Street = “12 Jaiprakash nagar, Goregaon”
           City = “Mumbai”
           State = “Maharashtra”
           />




Akerkar: Foundations of   © Narosa Publishing House, 2009   19
Semantic Web.
Namespaces
• Namespaces are a simple mechanism for
  creating globally unique names for the elements
  and attributes of your markup language

           xmlns : prefix=”location”

           <xsd:integer>


     A sample namespace declaration:
              <xsd:schema
              xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
Akerkar: Foundations of    © Narosa Publishing House, 2009    20
Semantic Web.
Namespaces
• A default namespace is declared by
  eliminating the prefix from the declaration:

           <html xmlns=”http://www.w3.org/1999/xhtml”>
           <head> <title> Default namespace </title> </head>
           <body> Web Programming </body>
           </html>




Akerkar: Foundations of   © Narosa Publishing House, 2009      21
Semantic Web.
Example 2.5
<?xml version="1.0" standalone="yes"?> ?>
<DATARECORD>
<PERSON>
 <FIRSTNAME>Ram</FIRSTNAME>
 <MEDDLENAME>Manohar</MIDDLENAME>
 <LASTNAME>Patel</LASTNAME>
 <CITY>Pune</CITY>
 <SALARY>Rs. 35000</SALARY>
</PERSON>
<PERSON>                                         <PERSON>
 <FIRSTNAME>Jagan</FIRSTNAME>                     <FIRSTNAME>Raja</FIRSTNAME>
 <MEDDLENAME>Jeevan</MIDDLENAME>                  <MEDDLENAME>Ram</MIDDLENAME>
 <LASTNAME>Rai</LASTNAME>                         <LASTNAME>Venugopal</LASTNAME>
 <CITY>Mumbai</CITY>                              <CITY>Mumbai</CITY>
 <SALARY>Rs. 50000</SALARY>                       <SALARY>Rs. 80000</SALARY>
</PERSON>                                        </PERSON>
<PERSON>                                         <PERSON>
 <FIRSTNAME>Reema</FIRSTNAME>                     <FIRSTNAME>Pankaj</FIRSTNAME>
 <MEDDLENAME>Ravi</MIDDLENAME>                    <MEDDLENAME>Kumar</MIDDLENAME>
 <LASTNAME>Verma</LASTNAME>                       <LASTNAME>Sen</LASTNAME>
 <CITY>Delhi</CITY>                               <CITY>Pune</CITY>
 <SALARY>Rs. 65000</SALARY>                       <SALARY>Rs. 50000</SALARY>
</PERSON>                                        </PERSON>
                                                 <DATARECORD>


Akerkar: Foundations of           © Narosa Publishing House, 2009                  22
Semantic Web.
Document Type Definitions
           <!DOCTYPE name external-id? [internal-decs]?>


Examples 2.6: Suppose we want to represent our
  books, records, CDs and DVDs in a library
  element. The following declaration requires that
  all books are listed before all records:
           <!ELEMENT library (book*, record*, cd*, dvd*)>
              By contrast, the following declaration allows us to list books,
             records, CDs, and DVDs in any order:
           <!ELEMENT library (book | record | cd | dvd)*>


Akerkar: Foundations of    © Narosa Publishing House, 2009                 23
Semantic Web.
Attribute Types
• There are three attribute types:
           attType ::= CDATA | token | enumerated
                –         where CDATA is any quoted string.

• There seven token types:
             token ::=
                  ID | IDREF | IDREFS | ENTITY | ENTITIES |
              NMTOKEN | NMTOKENS




Akerkar: Foundations of         © Narosa Publishing House, 2009   24
Semantic Web.
Entity Declarations
Example 2.8:
  <?xml version = "1.0" standalone = "no"?>
    <!DOCTYPE course SYSTEM "course.dtd"
      [<!ENTITY mt1 "midterm1">
       <!ENTITY mt2 "midterm2">
    ]>
    <course>
      <title> Web Programming </title>
      <semester> Fall 2008 </semester>
      <exams>
        <exam exam-id = "&mt1;" date = "2008-09-12" total = "100"/>
        <exam exam-id = "&mt2;" date = "2008-10-15" total = "100"/>
        <exam exam-id = "final" date = "2008-11-20" total = "200"/>
      </exams>
      <students>
        <student name = "Gopal Sharma" student-id = "A123" grade =


Akerkar: Foundations of   © Narosa Publishing House, 2009             25
Semantic Web.
Entity Declarations
    "A">
          <score exam-ref = "&mt1;" total = "90"/>
          <score exam-ref = "&mt2;" total = "95"/>
          <score exam-ref = "final" total = "182"/>
        </student>
        <student name = "Rita Mathur" student-id = "A124" grade = "B">
          <score exam-ref = "&mt1;" total = "90"/>
          <score exam-ref = "&mt2;" total = "78"/>
          <score exam-ref = "final" total = "155"/>
        </student>
        <student name = "Shila Soman" student-id = "A125" grade = "C">
          <score exam-ref = "&mt1;" total = "70"/>
          <score exam-ref = "&mt2;" total = "70"/>
          <score exam-ref = "final" total = "140"/>
        </student>
        <!-- etc. -->
      </students>
    </course>


Akerkar: Foundations of   © Narosa Publishing House, 2009                26
Semantic Web.
XML Schema
         <?xml version = "1.0"?>
         <xsd:schema
         xmlns:xsd="http://www.w3.org/2001/XMLSchema">
          <!-- global declarations go here -->
         </xsd:schema>


     <xsd:element name = "tag1" type = "Tag1Type"/>
       <xsd:element name = "tag2" type = "Tag2Type"/>
       <xsd:element name = "tag3" type = "Tag3Type"/>



Akerkar: Foundations of   © Narosa Publishing House, 2009   27
Semantic Web.
XML Schema
         xsd:string ::= <char>+
         xsd:boolean ::= false | true
         xsd:decimal ::= (+ | -)?<digit>+(.<digit>*)?
         xsd:double ::= IEEE double precision float
         xsd:float ::= IEEE single precision float
         xsd:integer ::= (+|-)?<digit>+
         xsd:duration ::= P<int>Y<int>M<int>DT<int>H<int>M<int>S
         xsd:time ::= <hours>:<mins>:<secs>
         <hours>, <mins> ::= <int>, <secs> ::= <decimal>
         xsd:date ::= <CCYY>-<MM>-<DD>
         xsd:anyURI ::= <URI>
         xsd:ID ::= <NCName>
         xsd:IDREF ::= <NCName>
         xsd:QName ::= <URI>:<NCName>
         xsd:Name ::= <XMLName>

Akerkar: Foundations of   © Narosa Publishing House, 2009          28
Semantic Web.
XML Schema
         <xsd:complexType name = "Tag1Type">
          <!-- tag1 elements and attributes declared here -->
         </xsd:complexType>
         <xsd:complexType name = "Tag2Type">
          <!-- tag2 elements and attributes declared here -->
         </xsd:complexType>
         <xsd:complexType name = "Tag3Type">
          <!-- tag3 elements and attributes declared here -->
         </xsd:complexType>




Akerkar: Foundations of   © Narosa Publishing House, 2009       29
Semantic Web.
XML Schema
• A default value (content) may also be
  specified:
           <xsd:element name = "tag" type = "TYPE"
                 minOccurs = "N"
                 maxOccurs = "M"
                 default = "J"/>
     where:
           0 <= N <= M <= "unbounded"



Akerkar: Foundations of   © Narosa Publishing House, 2009   30
Semantic Web.
Example 2.9
                                                <review id="100">
<!-- movies.xml -->
                                                  <movie-id>1</movie-id>
<?xml version="1.0"?>
                                                  <stars>5</stars>
<!DOCTYPE movies SYSTEM "movies.dtd">
                                                  <comment>You can't call
<movies>
                                                yourself a geek
 <movie id="1">
                                                  unless you've seen this
   <title>The Matrix</title>
                                                  <b>amazing</b>
 </movie>
                                                movie.</comment>
 <movie id="2">
                                                 </review>
   <title>The Matrix: Reloaded</title>
                                                 <review id="101">
 </movie>
                                                  <movie-id>1</movie-id>
</movies>
                                                  <stars>3</stars>
<!-- movie-reviews.xml -->
                                                  <comment><a href=
<?xml version="1.0"?>
<!DOCTYPE reviews SYSTEM "reviews.dtd">
                                                "http://www.keanunet.com">Kean
<reviews>
                                                u</a>
                                                   can act!</comment>
                                                 </review>
                                                </reviews>
Akerkar: Foundations of   © Narosa Publishing House, 2009                        31
Semantic Web.
XPath
                                                 Root Node




                   Element Node
                                                                          Element Node




    Content Node   Attribute Node     Attribute Node         Attribute Node        Attribute Node




Akerkar: Foundations of             © Narosa Publishing House, 2009                                 32
Semantic Web.
Path Expression
Consider the XML document library.xml:

               <library location =”Kolhapur”>
               <author name=”R. Akerkar”>
                   <book title=”Artificial Intelligence”>
                    <book title=”Building an Intelligent Web”>
                   <book title=”Discrete Mathematics”>
               </author>
                <author name=”P. Winston”>
                     <book title=”Artificial Intelligence”>
                </author>
                  <author name=”V. Rajaraman”>
                   <book title=”Information Technology”>
                   <book title=”Supercomputing”>


Akerkar: Foundations of      © Narosa Publishing House, 2009     33
Semantic Web.
Path Expression
                                                                               V.
                            author                @name
                                                                           Rajaraman




                                                                          Information
                                                   book      @title
                                                                          Technology




                                                   book                   Supercomp
                                                             @title
                                                                            uting




                            author                @name


                                                                           P. Winston




                                                                            Artificial
                                                   book      @title
                                                                          Intelligence

      root       library



                                                  @name                    R. Akerkar




                                                                        Discrete
                            author                 book      @title
                                                                       Mathematics




                                                                           Building an
                                                   book      @title         Intelligent
                                                                               Web




                                                                            Artificial
                                                   book      @title
                                                                          Intelligence




                           @location                                  Kolhapur




Akerkar: Foundations of    © Narosa Publishing House, 2009                                34
Semantic Web.
Tree Representation




Akerkar: Foundations of   © Narosa Publishing House, 2009   35
Semantic Web.
Tree Representation




Akerkar: Foundations of   © Narosa Publishing House, 2009   36
Semantic Web.
XQuery
• Example 2.10: This example searches the
  books.xml document and returns every
  chapter node's title child value.
           document("books.xml")//chapter/title
• Example 2.11: Generates a new element
  <report> for each value for title.
           <report>
           {$b/title}
           </report>
Akerkar: Foundations of   © Narosa Publishing House, 2009   37
Semantic Web.
Example 2.12
• Perform a simple search that returns all books
  published by Narosa Publishers after 1998,
  inclusive of each book year and title.
           <bib>
           {
            for $b in doc("http://book.sample.org/bib.xml")/bib/book
            where $b/publisher = "Narosa Publishers" and $b/@year >
             1998
            return
             <book year="{$b/@year}">
              {$b/title}
             </book>
           }
           </bib>

Akerkar: Foundations of   © Narosa Publishing House, 2009              38
Semantic Web.
Example 2.12
• The result follows:
           <bib>
             <book year="1999">
               <title>Nonlinear Functional Analysis</title>
             </book>
           …
           …
           …
             <book year="2008">
               <title>Foundations of Semantic Web</title>
             </book>
           </bib>


Akerkar: Foundations of    © Narosa Publishing House, 2009    39
Semantic Web.
Example 2.13
• Let us use the function min() to determine the
  minimum price for each book.
     – We generate the <minprice> element, with the book
       title as its attribute.
                <results>
                 {
                   let $doc := doc("prices.xml")
                   for $t in distinct-values($doc//book/title)
                   let $p := $doc//book[title = $t]/price
                   return
                     <minprice title="{$t}">
                      <price>{min($p)}</price>
                     </minprice>
                 }
                </results>

Akerkar: Foundations of       © Narosa Publishing House, 2009    40
Semantic Web.
Suggested Readings
     1.     R. Akerkar and P. Lingras. Building an Intelligent Web: Theory & Practice.
            Johns & Bartlett, 2008.
     2.     P. V. Biron, A. Malhotra (eds.): XML Schema Part 2: Datatypes, W3C
            Working Draft 07 April 2000, http://www.w3.org/TR/2000/WD-xmlschema-
            2-20000407/.
     3.     T. Bray, J. Paoli, and C.M. Sperberg-McQueen (eds.): Extensible Markup
            Language (XML) 1.0, W3C Recommendation 10-February-1998,
            http://www.w3.org/TR/REC-xml.
     4.     T. Bray, D. Hollander, and A. Layman (eds.): Namespaces in XML, World
            Wide Web Consortium Recommendation, 14-January-1999,
            http://www.w3.org/TR/REC-xml-names/.
     5.     J. Clark (ed): XSL Transformations (XSLT), W3C Recommandation 16
            November 1999, http://www.w3.org/TR/xslt.
     6.     J. Davidson: Java API for XML Parsing, Version 1.0 Final Release,
            http://java.sun.com/aboutJava/communityprocess/final/jsr005/index.html.
     7.     XQuery1.0: An XML Query Language, http://www.w3.org/TR/xquery/
     8.     XML Query Use Cases, http://www.w3.org/TR/xmlquery-use-cases
     9.     What is XQuery: Katz, 2004. http://www.gnu.org/software/qexo/XQuery-
            Intro.html.


Akerkar: Foundations of       © Narosa Publishing House, 2009                            41
Semantic Web.

More Related Content

What's hot

Chapter 1 semantic web
Chapter 1 semantic webChapter 1 semantic web
Chapter 1 semantic webR A Akerkar
 
Building a semantic website
Building a semantic websiteBuilding a semantic website
Building a semantic websiteCJ Jenkins
 
Webinar: Semantic web for developers
Webinar: Semantic web for developersWebinar: Semantic web for developers
Webinar: Semantic web for developersSemantic Web Company
 
Hypertextandhypermedia 120320065133-phpapp01
Hypertextandhypermedia 120320065133-phpapp01Hypertextandhypermedia 120320065133-phpapp01
Hypertextandhypermedia 120320065133-phpapp01dhruv patel
 
RDFa in ostala spletna semantika
RDFa in ostala spletna semantikaRDFa in ostala spletna semantika
RDFa in ostala spletna semantikaJure Cuhalev
 
SemanticWeb Nuts 'n Bolts
SemanticWeb Nuts 'n BoltsSemanticWeb Nuts 'n Bolts
SemanticWeb Nuts 'n BoltsRinke Hoekstra
 
Linked data: spreading data over the web
Linked data: spreading data over the webLinked data: spreading data over the web
Linked data: spreading data over the webshellac
 
06 gioca-ontologies
06 gioca-ontologies06 gioca-ontologies
06 gioca-ontologiesnidzokus
 
JSON-LD update DC 2017
JSON-LD update DC 2017JSON-LD update DC 2017
JSON-LD update DC 2017Gregg Kellogg
 
Web Queries: From a Web of Data to a Semantic Web
Web Queries: From a Web of Data to a Semantic WebWeb Queries: From a Web of Data to a Semantic Web
Web Queries: From a Web of Data to a Semantic WebTim Furche
 
Realizing a Semantic Web Application - ICWE 2010 Tutorial
Realizing a Semantic Web Application - ICWE 2010 TutorialRealizing a Semantic Web Application - ICWE 2010 Tutorial
Realizing a Semantic Web Application - ICWE 2010 TutorialEmanuele Della Valle
 
Linked Open Data in Romania
Linked Open Data in RomaniaLinked Open Data in Romania
Linked Open Data in RomaniaVlad Posea
 
Is DITA Simple, Complex or Too Complex
Is DITA Simple, Complex or Too ComplexIs DITA Simple, Complex or Too Complex
Is DITA Simple, Complex or Too ComplexBluestream
 
ePUB 3 and Publishing e-books
ePUB 3 and Publishing e-booksePUB 3 and Publishing e-books
ePUB 3 and Publishing e-booksKerem Karatal
 
Usage of Linked Data: Introduction and Application Scenarios
Usage of Linked Data: Introduction and Application ScenariosUsage of Linked Data: Introduction and Application Scenarios
Usage of Linked Data: Introduction and Application ScenariosEUCLID project
 
Developing A Semantic Web Application - ISWC 2008 tutorial
Developing A Semantic Web Application -  ISWC 2008 tutorialDeveloping A Semantic Web Application -  ISWC 2008 tutorial
Developing A Semantic Web Application - ISWC 2008 tutorialEmanuele Della Valle
 
Linked Data Tutorial
Linked Data TutorialLinked Data Tutorial
Linked Data TutorialSören Auer
 

What's hot (20)

Chapter 1 semantic web
Chapter 1 semantic webChapter 1 semantic web
Chapter 1 semantic web
 
Building a semantic website
Building a semantic websiteBuilding a semantic website
Building a semantic website
 
Webinar: Semantic web for developers
Webinar: Semantic web for developersWebinar: Semantic web for developers
Webinar: Semantic web for developers
 
Hypertextandhypermedia 120320065133-phpapp01
Hypertextandhypermedia 120320065133-phpapp01Hypertextandhypermedia 120320065133-phpapp01
Hypertextandhypermedia 120320065133-phpapp01
 
RDFa in ostala spletna semantika
RDFa in ostala spletna semantikaRDFa in ostala spletna semantika
RDFa in ostala spletna semantika
 
SemanticWeb Nuts 'n Bolts
SemanticWeb Nuts 'n BoltsSemanticWeb Nuts 'n Bolts
SemanticWeb Nuts 'n Bolts
 
Semantic web
Semantic web Semantic web
Semantic web
 
Linked data: spreading data over the web
Linked data: spreading data over the webLinked data: spreading data over the web
Linked data: spreading data over the web
 
06 gioca-ontologies
06 gioca-ontologies06 gioca-ontologies
06 gioca-ontologies
 
Danbri Drupalcon Export
Danbri Drupalcon ExportDanbri Drupalcon Export
Danbri Drupalcon Export
 
JSON-LD update DC 2017
JSON-LD update DC 2017JSON-LD update DC 2017
JSON-LD update DC 2017
 
Web Queries: From a Web of Data to a Semantic Web
Web Queries: From a Web of Data to a Semantic WebWeb Queries: From a Web of Data to a Semantic Web
Web Queries: From a Web of Data to a Semantic Web
 
Realizing a Semantic Web Application - ICWE 2010 Tutorial
Realizing a Semantic Web Application - ICWE 2010 TutorialRealizing a Semantic Web Application - ICWE 2010 Tutorial
Realizing a Semantic Web Application - ICWE 2010 Tutorial
 
Linked Open Data in Romania
Linked Open Data in RomaniaLinked Open Data in Romania
Linked Open Data in Romania
 
Is DITA Simple, Complex or Too Complex
Is DITA Simple, Complex or Too ComplexIs DITA Simple, Complex or Too Complex
Is DITA Simple, Complex or Too Complex
 
ePUB 3 and Publishing e-books
ePUB 3 and Publishing e-booksePUB 3 and Publishing e-books
ePUB 3 and Publishing e-books
 
Usage of Linked Data: Introduction and Application Scenarios
Usage of Linked Data: Introduction and Application ScenariosUsage of Linked Data: Introduction and Application Scenarios
Usage of Linked Data: Introduction and Application Scenarios
 
Developing A Semantic Web Application - ISWC 2008 tutorial
Developing A Semantic Web Application -  ISWC 2008 tutorialDeveloping A Semantic Web Application -  ISWC 2008 tutorial
Developing A Semantic Web Application - ISWC 2008 tutorial
 
Linked Data Tutorial
Linked Data TutorialLinked Data Tutorial
Linked Data Tutorial
 
Semantic Web
Semantic WebSemantic Web
Semantic Web
 

Similar to Chapter 2 semantic web

Similar to Chapter 2 semantic web (20)

Faster Data Integration Pipeline Execution using Spark-Jobserver
Faster Data Integration Pipeline Execution using Spark-JobserverFaster Data Integration Pipeline Execution using Spark-Jobserver
Faster Data Integration Pipeline Execution using Spark-Jobserver
 
Chapter 5 semantic web
Chapter 5 semantic webChapter 5 semantic web
Chapter 5 semantic web
 
DAS. Technical introduction to the Distributed Annotation System.
DAS. Technical introduction to the Distributed Annotation System.DAS. Technical introduction to the Distributed Annotation System.
DAS. Technical introduction to the Distributed Annotation System.
 
XML in software development
XML in software developmentXML in software development
XML in software development
 
Less03 db dbca
Less03 db dbcaLess03 db dbca
Less03 db dbca
 
Xml nisha dwivedi
Xml nisha dwivediXml nisha dwivedi
Xml nisha dwivedi
 
Adding Data into your SOA with WSO2 WSAS
Adding Data into your SOA with WSO2 WSASAdding Data into your SOA with WSO2 WSAS
Adding Data into your SOA with WSO2 WSAS
 
Web page concept Basic
Web page concept  BasicWeb page concept  Basic
Web page concept Basic
 
Web page concept final ppt
Web page concept  final pptWeb page concept  final ppt
Web page concept final ppt
 
Html 5 and css 3
Html 5 and css 3Html 5 and css 3
Html 5 and css 3
 
Callimachus
CallimachusCallimachus
Callimachus
 
Srimanta_Maji_Oracle_DBA
Srimanta_Maji_Oracle_DBASrimanta_Maji_Oracle_DBA
Srimanta_Maji_Oracle_DBA
 
Xml
XmlXml
Xml
 
Xml
XmlXml
Xml
 
Xml 215-presentation
Xml 215-presentationXml 215-presentation
Xml 215-presentation
 
Xml
XmlXml
Xml
 
Unit 10: XML and Beyond (Sematic Web, Web Services, ...)
Unit 10: XML and Beyond (Sematic Web, Web Services, ...)Unit 10: XML and Beyond (Sematic Web, Web Services, ...)
Unit 10: XML and Beyond (Sematic Web, Web Services, ...)
 
Nuxeo JavaOne 2007
Nuxeo JavaOne 2007Nuxeo JavaOne 2007
Nuxeo JavaOne 2007
 
XML notes.pptx
XML notes.pptxXML notes.pptx
XML notes.pptx
 
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
 

More from R A Akerkar

Rajendraakerkar lemoproject
Rajendraakerkar lemoprojectRajendraakerkar lemoproject
Rajendraakerkar lemoprojectR A Akerkar
 
Big Data and Harvesting Data from Social Media
Big Data and Harvesting Data from Social MediaBig Data and Harvesting Data from Social Media
Big Data and Harvesting Data from Social MediaR A Akerkar
 
Can You Really Make Best Use of Big Data?
Can You Really Make Best Use of Big Data?Can You Really Make Best Use of Big Data?
Can You Really Make Best Use of Big Data?R A Akerkar
 
Big data in Business Innovation
Big data in Business Innovation   Big data in Business Innovation
Big data in Business Innovation R A Akerkar
 
What is Big Data ?
What is Big Data ?What is Big Data ?
What is Big Data ?R A Akerkar
 
Connecting and Exploiting Big Data
Connecting and Exploiting Big DataConnecting and Exploiting Big Data
Connecting and Exploiting Big DataR A Akerkar
 
Linked open data
Linked open dataLinked open data
Linked open dataR A Akerkar
 
Semi structure data extraction
Semi structure data extractionSemi structure data extraction
Semi structure data extractionR A Akerkar
 
Big data: analyzing large data sets
Big data: analyzing large data setsBig data: analyzing large data sets
Big data: analyzing large data setsR A Akerkar
 
Description logics
Description logicsDescription logics
Description logicsR A Akerkar
 
artificial intelligence
artificial intelligenceartificial intelligence
artificial intelligenceR A Akerkar
 
Case Based Reasoning
Case Based ReasoningCase Based Reasoning
Case Based ReasoningR A Akerkar
 
Semantic Markup
Semantic Markup Semantic Markup
Semantic Markup R A Akerkar
 
Intelligent natural language system
Intelligent natural language systemIntelligent natural language system
Intelligent natural language systemR A Akerkar
 
Knowledge Organization Systems
Knowledge Organization SystemsKnowledge Organization Systems
Knowledge Organization SystemsR A Akerkar
 
Rational Unified Process for User Interface Design
Rational Unified Process for User Interface DesignRational Unified Process for User Interface Design
Rational Unified Process for User Interface DesignR A Akerkar
 
Unified Modelling Language
Unified Modelling LanguageUnified Modelling Language
Unified Modelling LanguageR A Akerkar
 

More from R A Akerkar (20)

Rajendraakerkar lemoproject
Rajendraakerkar lemoprojectRajendraakerkar lemoproject
Rajendraakerkar lemoproject
 
Big Data and Harvesting Data from Social Media
Big Data and Harvesting Data from Social MediaBig Data and Harvesting Data from Social Media
Big Data and Harvesting Data from Social Media
 
Can You Really Make Best Use of Big Data?
Can You Really Make Best Use of Big Data?Can You Really Make Best Use of Big Data?
Can You Really Make Best Use of Big Data?
 
Big data in Business Innovation
Big data in Business Innovation   Big data in Business Innovation
Big data in Business Innovation
 
What is Big Data ?
What is Big Data ?What is Big Data ?
What is Big Data ?
 
Connecting and Exploiting Big Data
Connecting and Exploiting Big DataConnecting and Exploiting Big Data
Connecting and Exploiting Big Data
 
Linked open data
Linked open dataLinked open data
Linked open data
 
Semi structure data extraction
Semi structure data extractionSemi structure data extraction
Semi structure data extraction
 
Big data: analyzing large data sets
Big data: analyzing large data setsBig data: analyzing large data sets
Big data: analyzing large data sets
 
Description logics
Description logicsDescription logics
Description logics
 
Data Mining
Data MiningData Mining
Data Mining
 
Link analysis
Link analysisLink analysis
Link analysis
 
artificial intelligence
artificial intelligenceartificial intelligence
artificial intelligence
 
Case Based Reasoning
Case Based ReasoningCase Based Reasoning
Case Based Reasoning
 
Semantic Markup
Semantic Markup Semantic Markup
Semantic Markup
 
Intelligent natural language system
Intelligent natural language systemIntelligent natural language system
Intelligent natural language system
 
Data mining
Data miningData mining
Data mining
 
Knowledge Organization Systems
Knowledge Organization SystemsKnowledge Organization Systems
Knowledge Organization Systems
 
Rational Unified Process for User Interface Design
Rational Unified Process for User Interface DesignRational Unified Process for User Interface Design
Rational Unified Process for User Interface Design
 
Unified Modelling Language
Unified Modelling LanguageUnified Modelling Language
Unified Modelling Language
 

Recently uploaded

Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Recently uploaded (20)

Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

Chapter 2 semantic web

  • 1. Chapter 2 XML & Its Impact
  • 2. Introduction • Definition 2.1: XML is used to improve compatibility between the desperate systems of business partners by defining the meaning of data in business documents. • Definition 2.2: XML is a language allowing the exchange of structured data. Akerkar: Foundations of © Narosa Publishing House, 2009 2 Semantic Web.
  • 3. The design goals for XML – XML shall be straightforwardly usable over the Internet. – XML shall support a wide variety of applications. – XML shall be compatible with SGML. – It shall be easy to write programs which process XML documents. – The number of optional features in XML is to be kept to the absolute minimum, ideally zero. – XML documents should be human-legible and reasonably clear. – The XML design should be prepared quickly. – The design of XML shall be formal and concise. – XML documents shall be easy to create. – Terseness in XML markup is of minimal importance. Akerkar: Foundations of © Narosa Publishing House, 2009 3 Semantic Web.
  • 4. W3C Understanding XML • XML is for structuring data • XML looks a bit like HTML • XML is text, but isn’t meant to be read • XML is verbose by design • XML is a family of technologies • XML is new, but not that new • XML leads HTML to XHTML • XML is modular • XML is the basis for Resource Description Format (RDF) and the Semantic Web • XML is license-free, platform-independent and well- supported Akerkar: Foundations of © Narosa Publishing House, 2009 4 Semantic Web.
  • 5. XML Processing • Example 2.1: gopal.xml is an XML document containing Gopal's resume. The document contains educational background, earlier work experience, references, and contact information by markup tags: <resume> <contact-info> ... </contact-info> <education> ... </education> <experience> ... </experience> <references> ... </references> </resume> Akerkar: Foundations of © Narosa Publishing House, 2009 5 Semantic Web.
  • 6. XML Processing XML Processor gopal.xml gopal.html Akerkar: Foundations of © Narosa Publishing House, 2009 6 Semantic Web.
  • 7. HTML & XML <p> The lecture notes on: <br /> <i> Semantic Web. </i> Author of the notes <br /> <b> R. Akerkar. </b> <book_title> Semantic Web </book_title> <author> R. Akerkar </author> <publisher> Narosa Publishing House </publisher> <copydate> 2008 </copydate> Akerkar: Foundations of © Narosa Publishing House, 2009 7 Semantic Web.
  • 8. XML Prolog prolog ::= (declaration, misc*, dtd?, misc*) misc ::= (comment | pi) Here is a sample XML declaration: <?xml version = "1.0" encoding = "UTF-16" standalone = "yes"?> Akerkar: Foundations of © Narosa Publishing House, 2009 8 Semantic Web.
  • 9. XML Comment – An XML comment has the same form as an HTML comment: <!-- this is an XML comment --> – XML processors ignore XML comments. – A processing instruction (PI) provides processing directions in the form of attribute values to a target XML processor. For example, the following PI tells a style sheet processor which style sheet should be used to process this document: <?xml:stylesheet type = "text/xsl" href = "outline.xsl"?> Akerkar: Foundations of © Narosa Publishing House, 2009 9 Semantic Web.
  • 10. Elements element ::= (start-tag, content?, end-tag) | empty-elem-tag start-tag ::= <(name, attribute*)> end-tag ::= </name> empty-elem-tag ::= <(name, attribute+)/> content ::= (text | comment | pi | entity-ref | element)+ <memo> <from> Gopal <to> Gita </from> </to> Dinner tonight? </memo> Akerkar: Foundations of © Narosa Publishing House, 2009 10 Semantic Web.
  • 11. Document Declaration • An XML document consists of a declaration followed by a single element called the root: <?xml version = "1.0"?> <ROOT> CONTENT </ROOT> Akerkar: Foundations of © Narosa Publishing House, 2009 11 Semantic Web.
  • 12. XML Overview XML Concepts Elements & DTDs Namespaces Attributes Akerkar: Foundations of © Narosa Publishing House, 2009 12 Semantic Web.
  • 13. Public Languages • A registry of public languages is maintained by xml.org at: http://www.xml.org/xml/registry.jsp W3C recommendations also include a number of public languages including XHTML, MathML, and SVG. Akerkar: Foundations of © Narosa Publishing House, 2009 13 Semantic Web.
  • 14. Foreign Elements • A LabML report has the format: <experiment date = "..."> <introduction>...</introduction> <equipment-list>...</equipment-list> <procedure>...</procedure> <data>...</data> <analysis>...</analysis> <summary>...</summary> </experiment> Akerkar: Foundations of © Narosa Publishing House, 2009 14 Semantic Web.
  • 15. XML Design Patterns • Document-Oriented <html> ... </html> <report> ... </report> <invoice> ... </invoice> <chapter> ... </chapter> • Data Oriented <employee> ... </employee> <measurement> ... </measurement> <organization> ... </organization> • Command Oriented <deposit> ... </deposit> <transfer> ... </transfer> <invoke> ... </invoke> <render> ... </render> Akerkar: Foundations of © Narosa Publishing House, 2009 15 Semantic Web.
  • 16. Data Structures • Records • <record type = "student"> <field name = "name"> Gopal </field> <field name = "gpa"> 1.2 </field> <field name = "class"> B. Sc. Second Year </field> <!-- etc --> </record> • Or, less generically: • <student> <name> Gopal </name> <gpa> 1.2 </gpa> <class> B. Sc. Second Year </class> <!-- etc --> </student> Akerkar: Foundations of © Narosa Publishing House, 2009 16 Semantic Web.
  • 17. Data Structures • Lists can be implicitly ordered by their position in the document (document order): <items> <item> 100 </item> <item> 200 </item> <item> 300 </item> <item> 400 </item> <item> 500 </item> </items> • Or the order can be made explicit: <items> <item id = "id4"> <data> 400 </data> <prev ref = "id3"/> <next ref = "id5"/> </item> …. …. Akerkar: Foundations of © Narosa Publishing House, 2009 17 Semantic Web.
  • 18. • Example 2.2: Let us consider a document containing Rita Mathur’s address. This information can be represented as: <label> <name> Rita Mathur </name> <address> <street> 12 Jaiprakash nagar, Goregaon </street> <city> Mumbai </city> <state> Maharashtra </state> </address> </label> Akerkar: Foundations of © Narosa Publishing House, 2009 18 Semantic Web.
  • 19. • Example 2.3: Attributes are used to represent the information. <address Street = “12 Jaiprakash nagar, Goregaon” City = “Mumbai” State = “Maharashtra” /> Akerkar: Foundations of © Narosa Publishing House, 2009 19 Semantic Web.
  • 20. Namespaces • Namespaces are a simple mechanism for creating globally unique names for the elements and attributes of your markup language xmlns : prefix=”location” <xsd:integer> A sample namespace declaration: <xsd:schema xmlns:xsd=”http://www.w3.org/2001/XMLSchema”> Akerkar: Foundations of © Narosa Publishing House, 2009 20 Semantic Web.
  • 21. Namespaces • A default namespace is declared by eliminating the prefix from the declaration: <html xmlns=”http://www.w3.org/1999/xhtml”> <head> <title> Default namespace </title> </head> <body> Web Programming </body> </html> Akerkar: Foundations of © Narosa Publishing House, 2009 21 Semantic Web.
  • 22. Example 2.5 <?xml version="1.0" standalone="yes"?> ?> <DATARECORD> <PERSON> <FIRSTNAME>Ram</FIRSTNAME> <MEDDLENAME>Manohar</MIDDLENAME> <LASTNAME>Patel</LASTNAME> <CITY>Pune</CITY> <SALARY>Rs. 35000</SALARY> </PERSON> <PERSON> <PERSON> <FIRSTNAME>Jagan</FIRSTNAME> <FIRSTNAME>Raja</FIRSTNAME> <MEDDLENAME>Jeevan</MIDDLENAME> <MEDDLENAME>Ram</MIDDLENAME> <LASTNAME>Rai</LASTNAME> <LASTNAME>Venugopal</LASTNAME> <CITY>Mumbai</CITY> <CITY>Mumbai</CITY> <SALARY>Rs. 50000</SALARY> <SALARY>Rs. 80000</SALARY> </PERSON> </PERSON> <PERSON> <PERSON> <FIRSTNAME>Reema</FIRSTNAME> <FIRSTNAME>Pankaj</FIRSTNAME> <MEDDLENAME>Ravi</MIDDLENAME> <MEDDLENAME>Kumar</MIDDLENAME> <LASTNAME>Verma</LASTNAME> <LASTNAME>Sen</LASTNAME> <CITY>Delhi</CITY> <CITY>Pune</CITY> <SALARY>Rs. 65000</SALARY> <SALARY>Rs. 50000</SALARY> </PERSON> </PERSON> <DATARECORD> Akerkar: Foundations of © Narosa Publishing House, 2009 22 Semantic Web.
  • 23. Document Type Definitions <!DOCTYPE name external-id? [internal-decs]?> Examples 2.6: Suppose we want to represent our books, records, CDs and DVDs in a library element. The following declaration requires that all books are listed before all records: <!ELEMENT library (book*, record*, cd*, dvd*)> By contrast, the following declaration allows us to list books, records, CDs, and DVDs in any order: <!ELEMENT library (book | record | cd | dvd)*> Akerkar: Foundations of © Narosa Publishing House, 2009 23 Semantic Web.
  • 24. Attribute Types • There are three attribute types: attType ::= CDATA | token | enumerated – where CDATA is any quoted string. • There seven token types: token ::= ID | IDREF | IDREFS | ENTITY | ENTITIES | NMTOKEN | NMTOKENS Akerkar: Foundations of © Narosa Publishing House, 2009 24 Semantic Web.
  • 25. Entity Declarations Example 2.8: <?xml version = "1.0" standalone = "no"?> <!DOCTYPE course SYSTEM "course.dtd" [<!ENTITY mt1 "midterm1"> <!ENTITY mt2 "midterm2"> ]> <course> <title> Web Programming </title> <semester> Fall 2008 </semester> <exams> <exam exam-id = "&mt1;" date = "2008-09-12" total = "100"/> <exam exam-id = "&mt2;" date = "2008-10-15" total = "100"/> <exam exam-id = "final" date = "2008-11-20" total = "200"/> </exams> <students> <student name = "Gopal Sharma" student-id = "A123" grade = Akerkar: Foundations of © Narosa Publishing House, 2009 25 Semantic Web.
  • 26. Entity Declarations "A"> <score exam-ref = "&mt1;" total = "90"/> <score exam-ref = "&mt2;" total = "95"/> <score exam-ref = "final" total = "182"/> </student> <student name = "Rita Mathur" student-id = "A124" grade = "B"> <score exam-ref = "&mt1;" total = "90"/> <score exam-ref = "&mt2;" total = "78"/> <score exam-ref = "final" total = "155"/> </student> <student name = "Shila Soman" student-id = "A125" grade = "C"> <score exam-ref = "&mt1;" total = "70"/> <score exam-ref = "&mt2;" total = "70"/> <score exam-ref = "final" total = "140"/> </student> <!-- etc. --> </students> </course> Akerkar: Foundations of © Narosa Publishing House, 2009 26 Semantic Web.
  • 27. XML Schema <?xml version = "1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <!-- global declarations go here --> </xsd:schema> <xsd:element name = "tag1" type = "Tag1Type"/> <xsd:element name = "tag2" type = "Tag2Type"/> <xsd:element name = "tag3" type = "Tag3Type"/> Akerkar: Foundations of © Narosa Publishing House, 2009 27 Semantic Web.
  • 28. XML Schema xsd:string ::= <char>+ xsd:boolean ::= false | true xsd:decimal ::= (+ | -)?<digit>+(.<digit>*)? xsd:double ::= IEEE double precision float xsd:float ::= IEEE single precision float xsd:integer ::= (+|-)?<digit>+ xsd:duration ::= P<int>Y<int>M<int>DT<int>H<int>M<int>S xsd:time ::= <hours>:<mins>:<secs> <hours>, <mins> ::= <int>, <secs> ::= <decimal> xsd:date ::= <CCYY>-<MM>-<DD> xsd:anyURI ::= <URI> xsd:ID ::= <NCName> xsd:IDREF ::= <NCName> xsd:QName ::= <URI>:<NCName> xsd:Name ::= <XMLName> Akerkar: Foundations of © Narosa Publishing House, 2009 28 Semantic Web.
  • 29. XML Schema <xsd:complexType name = "Tag1Type"> <!-- tag1 elements and attributes declared here --> </xsd:complexType> <xsd:complexType name = "Tag2Type"> <!-- tag2 elements and attributes declared here --> </xsd:complexType> <xsd:complexType name = "Tag3Type"> <!-- tag3 elements and attributes declared here --> </xsd:complexType> Akerkar: Foundations of © Narosa Publishing House, 2009 29 Semantic Web.
  • 30. XML Schema • A default value (content) may also be specified: <xsd:element name = "tag" type = "TYPE" minOccurs = "N" maxOccurs = "M" default = "J"/> where: 0 <= N <= M <= "unbounded" Akerkar: Foundations of © Narosa Publishing House, 2009 30 Semantic Web.
  • 31. Example 2.9 <review id="100"> <!-- movies.xml --> <movie-id>1</movie-id> <?xml version="1.0"?> <stars>5</stars> <!DOCTYPE movies SYSTEM "movies.dtd"> <comment>You can't call <movies> yourself a geek <movie id="1"> unless you've seen this <title>The Matrix</title> <b>amazing</b> </movie> movie.</comment> <movie id="2"> </review> <title>The Matrix: Reloaded</title> <review id="101"> </movie> <movie-id>1</movie-id> </movies> <stars>3</stars> <!-- movie-reviews.xml --> <comment><a href= <?xml version="1.0"?> <!DOCTYPE reviews SYSTEM "reviews.dtd"> "http://www.keanunet.com">Kean <reviews> u</a> can act!</comment> </review> </reviews> Akerkar: Foundations of © Narosa Publishing House, 2009 31 Semantic Web.
  • 32. XPath Root Node Element Node Element Node Content Node Attribute Node Attribute Node Attribute Node Attribute Node Akerkar: Foundations of © Narosa Publishing House, 2009 32 Semantic Web.
  • 33. Path Expression Consider the XML document library.xml: <library location =”Kolhapur”> <author name=”R. Akerkar”> <book title=”Artificial Intelligence”> <book title=”Building an Intelligent Web”> <book title=”Discrete Mathematics”> </author> <author name=”P. Winston”> <book title=”Artificial Intelligence”> </author> <author name=”V. Rajaraman”> <book title=”Information Technology”> <book title=”Supercomputing”> Akerkar: Foundations of © Narosa Publishing House, 2009 33 Semantic Web.
  • 34. Path Expression V. author @name Rajaraman Information book @title Technology book Supercomp @title uting author @name P. Winston Artificial book @title Intelligence root library @name R. Akerkar Discrete author book @title Mathematics Building an book @title Intelligent Web Artificial book @title Intelligence @location Kolhapur Akerkar: Foundations of © Narosa Publishing House, 2009 34 Semantic Web.
  • 35. Tree Representation Akerkar: Foundations of © Narosa Publishing House, 2009 35 Semantic Web.
  • 36. Tree Representation Akerkar: Foundations of © Narosa Publishing House, 2009 36 Semantic Web.
  • 37. XQuery • Example 2.10: This example searches the books.xml document and returns every chapter node's title child value. document("books.xml")//chapter/title • Example 2.11: Generates a new element <report> for each value for title. <report> {$b/title} </report> Akerkar: Foundations of © Narosa Publishing House, 2009 37 Semantic Web.
  • 38. Example 2.12 • Perform a simple search that returns all books published by Narosa Publishers after 1998, inclusive of each book year and title. <bib> { for $b in doc("http://book.sample.org/bib.xml")/bib/book where $b/publisher = "Narosa Publishers" and $b/@year > 1998 return <book year="{$b/@year}"> {$b/title} </book> } </bib> Akerkar: Foundations of © Narosa Publishing House, 2009 38 Semantic Web.
  • 39. Example 2.12 • The result follows: <bib> <book year="1999"> <title>Nonlinear Functional Analysis</title> </book> … … … <book year="2008"> <title>Foundations of Semantic Web</title> </book> </bib> Akerkar: Foundations of © Narosa Publishing House, 2009 39 Semantic Web.
  • 40. Example 2.13 • Let us use the function min() to determine the minimum price for each book. – We generate the <minprice> element, with the book title as its attribute. <results> { let $doc := doc("prices.xml") for $t in distinct-values($doc//book/title) let $p := $doc//book[title = $t]/price return <minprice title="{$t}"> <price>{min($p)}</price> </minprice> } </results> Akerkar: Foundations of © Narosa Publishing House, 2009 40 Semantic Web.
  • 41. Suggested Readings 1. R. Akerkar and P. Lingras. Building an Intelligent Web: Theory & Practice. Johns & Bartlett, 2008. 2. P. V. Biron, A. Malhotra (eds.): XML Schema Part 2: Datatypes, W3C Working Draft 07 April 2000, http://www.w3.org/TR/2000/WD-xmlschema- 2-20000407/. 3. T. Bray, J. Paoli, and C.M. Sperberg-McQueen (eds.): Extensible Markup Language (XML) 1.0, W3C Recommendation 10-February-1998, http://www.w3.org/TR/REC-xml. 4. T. Bray, D. Hollander, and A. Layman (eds.): Namespaces in XML, World Wide Web Consortium Recommendation, 14-January-1999, http://www.w3.org/TR/REC-xml-names/. 5. J. Clark (ed): XSL Transformations (XSLT), W3C Recommandation 16 November 1999, http://www.w3.org/TR/xslt. 6. J. Davidson: Java API for XML Parsing, Version 1.0 Final Release, http://java.sun.com/aboutJava/communityprocess/final/jsr005/index.html. 7. XQuery1.0: An XML Query Language, http://www.w3.org/TR/xquery/ 8. XML Query Use Cases, http://www.w3.org/TR/xmlquery-use-cases 9. What is XQuery: Katz, 2004. http://www.gnu.org/software/qexo/XQuery- Intro.html. Akerkar: Foundations of © Narosa Publishing House, 2009 41 Semantic Web.