Web Sematics Mid
Web Sematics Mid
QUESTION1a,1b)
<!DOCTYPE student [
<!ELEMENT id (#PCDATA)>
<student>
<id>543</id>
<name>Ravi</name>
<age>21</age>
<addr>Guntur</addr>
<email>[email protected]</email>
<ph>9855555</ph>
<gender>male</gender>
</student>
) External DTD.
“student.dtd”
<!ELEMENT id (#PCDATA)>
Save the above code as “student.dtd” and prepare “student.xml” as follows... “student.xml”
<student>
<id>543</id>
<name>Ravi</name>
<age>21</age>
<addr>Guntur</addr>
<email>[email protected]</email>
</student>
In the above example we are using <!DOCTYPE student SYSTEM "student.dtd"> which is used to
provide “student.dtd” code in our “student.xml” file. If the above xml code follows the exact rules
defined in DTD then we can conclude that our xml document is a valid document. Otherwise it is an
invalid document.
<xsd:element name="bookstore">
<xsd:complexType>
<xsd:sequence>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
The following example shows the employe xml document or xml instance for the above
ebookstore schema. bookstore.xml
<?xml version="1.0"?>
<bookstore xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespacSchemaLocation="./bookstore.xsd">
<name>Readers' Haven</name>
<location>Hyderabad</location>
<email>[email protected]</email>
</bookstore>
An XML parser is a software library or package that provides interfaces for client
XML parser validates the document and check that the document is well formatted. The Parser could
be categorized as validating and non-validating
Validating Parser: It needs a Document type Declaration to parse and gives an error if the
respective document doesn’t match with DTD and constraints.
Non-Validating: This Parser eliminates DTD and the parser checks for the well-formed document.
Types of Parsers:There are three common ways to parse an XML document: by using the Simple API
for XML (SAX), by building a Document Object Model (DOM), and by employing a new technique
called pull parsing.
SAX is a style of parsing called event-based parsing where each information class in the instance
document generates a corresponding event in the parser as the document is traversed.
SAX parsers are useful for parsing very large XML documents or in low-memory
environments.
Pull parsing is a new technique that aims for both low-memory consumption and high performance.
Pull parsing is also an event-based parsing technique; however, the events are read by the
application (pulled) and not automatically triggered as in SAX.
The Document Object Model (DOM) is a language-neutral data model and application
programming interface (API) for programmatic access and manipulation of XML and HTML.
DOMs can be loaded from XML documents, saved to XML documents, or dynamically generated by a
program.
The DOM has provided a standard set of classes and APIs for browsers and
The DOM is represented as a set of interfaces with specific language bindings to those interfaces.
Unlike XML instances and XML schemas, which reside in files on disk, the DOM is an in-memory
representation of a document.
Object-oriented programming introduces two key data modelling concepts: classes and objects.
A class is a definition or template describing the characteristics and behaviors of a realworld entity
or concept.
From this description, an in- memory instance of the class can be constructed, which is called an
object.
SET 3 (1C)
The following example shows the employe schema for employee details.
employee.xsd
1. <?xml version="1.0"?>
3. <xsd:element name="employee">
4. <xsd:complexType>
5. <xsd:sequence>
9. </xsd:sequence>
10. </xsd:complexType>
11. </xsd:element>
12. </xsd:schema>
The following example shows the employe xml document or xml instance for the above employee
schema. employee.xml
1. <?xml version="1.0"?>
2. <employee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3. xsi:noNamespacSchemaLocation="./employee.xsd">
4. <firstname>vimal</firstname>
5. <lastname>jaiswal</lastname>
6. <email>[email protected]</email>
7. </employee>
What is semantic web? and explain about the levels of W3C with neat diagram?
“The first step is putting data on the Web in a form that machines can naturally understand, or
converting it to that form. This creates a Semantic Web—a web of data that can be processed
The Semantic Web as a logical extension of the current Web instead of a distant possibility.
According to the vision of Tim Berners-Lee we can define the Semantic Web as a machine
We can also further define smart data as data that is application-independent, composable,
The World Wide Web Consortium (W3C) has established an Activity dedicated to
implementing the vision of the Semantic Web.The following diagram shows an example of
The World Wide Web, commonly known as the web, has become an integral part of modern
society. It has revolutionized the way we communicate, work, and access information. However,
the web we know today has evolved significantly since its inception in 1989. In this section we are
going to see an overview of the evolution of the web, from its early days to the current era of web
4.0.
In the first-generation web technology, we can read and share information on web pages.
The web as we know it today began in 1989 when Tim Berners-Lee, a British computer
scientist, proposed a new system for sharing information over the internet.
This system, which he called the World Wide Web, was based on a simple set of protocols
that allowed users to access and share information using hypertext links. The first website,
which was created by Berners-Lee, went live in 1991.
In the early days of the web, websites were primarily static pages that provided information
to users.
These pages were created using HTML (Hypertext Markup Language), a markup language
that allowed developers to structure web pages using tags. Websites were primarily created
by developers and were often difficult for users to navigate.
In the second-generation web, we can read, write, and interact with each other. This web
2.0 dynamic page and user-generated content replace the static pages.
The next stage in the evolution of the web was the emergence of Web 2.0 in the early
2000s. This era was characterized by the emergence of user-generated content and social
media platforms.
The term Web 2.0 was coined by Tim O’Reilly, a technology entrepreneur and writer, to
describe a new generation of web-based applications that were more interactive and
dynamic.
Web 2.0 was characterized by the emergence of social media platforms such
These platforms allowed users to create and share content with each other, and they
became a central part of everyday life for many people.
The emergence of Web 2.0 also saw the rise of e-commerce, with companies such as
Amazon and eBay becoming dominant players in the online retail space
machines can think of information rather than humans.This web 3.0 is also known as the
semantic web.
The next stage in the evolution of the web is Web 3.0, also known as the Semantic Web.
The Semantic Web is characterized by a shift from the current web, which is focused on
content, to a web that is focused on meaning.
The Semantic Web aims to create a more intelligent web that can understand and interpret
the meaning of information, making it easier for users to find what they are looking for.
The Semantic Web is based on a set of technologies and standards, including RDF
(Resource Description Framework) and OWL (Web Ontology Language), which allow data to be
represented in a machine-readable format.
This allows machines to understand the meaning of information and to make intelligent
decisions based on that information.
Web 4.0: The Intelligent Web
In the fourth-generation web is also known as the Symbiotic web. With this, humans and machines
can interact with each other. Web 4.0, also known as the Intelligent Web, is the next stage in the
evolution of the web.
This era is characterized by the emergence of artificial intelligence (AI) and machine
learning (ML) technologies, which are being used to create more intelligent and
personalized web experiences for users.
The Intelligent Web is already being used in a variety of industries, including healthcare, finance, and
e-commerce. For example, healthcare companies are using AI and ML to analyse patient data and to
develop personalized treatment plans.
What Is XML?
XML has become the universal syntax and framework for exchanging data between organizations. By
agreeing on a standard schema, organization can produce these text documents that can be
validated, transmitted, and parsed by any application regardless of hardware or operating system.
XML provides universal accepted language for creating semantically rich new markup languages in a
particular domain.
Any language created via the rules of XML, like the Math Markup Language
(MathML), CML (Chemical Markup Language) are called the applications of XML.
A markup language’s primary concern is how to add semantic information about the raw content in a
document; thus, the vocabulary of a markup language is the external “marks” to be attached or
embedded in a document.
XML Syntax:
<?xml version="1.0"?>
<contact_info>
<name>Rajesh</name>
<company>TCS</company>
<phone>9333332354</phone>
</contact_info>
You can notice there are two kinds of information in the above example:
The following diagram depicts the syntax rules to write different types of markups and text in
an XML document.
XML DTD: (Document Type Definition)
An XML document validated against a DTD is both "Well Formed" and "Valid".
A "Valid" XML document is a "Well Formed" XML document, which also conforms to the rules of a
DTD.
The purpose of a DTD is to define the structure of an XML document. It defines the structure with a
list of legal elements.
A document type definition defines the rules and the legal elements and attributes for an XML
document.
<!DOCTYPE book [
(#PCDATA)> ]>
!DOCTYPE book defines that the root element of the document is book
!ELEMENT book defines that the book element must contain the elements:
2) External DTD.
<!DOCTYPE student [
<student>
<id>543</id>
<name>Ravi</name>
<age>21</age>
<addr>Guntur</addr>
<email>[email protected]</email>
<ph>9855555</ph>
<gender>male</gender>
</student>
) External DTD.
“student.dtd”
<!ELEMENT id (#PCDATA)>
Save the above code as “student.dtd” and prepare “student.xml” as follows... “student.xml”
<student>
<id>543</id>
<name>Ravi</name>
<age>21</age>
<addr>Guntur</addr>
<email>[email protected]</email>
</student>
In the above example we are using <!DOCTYPE student SYSTEM "student.dtd"> which is used to
provide “student.dtd” code in our “student.xml” file. If the above xml code follows the exact rules
defined in DTD then we can conclude that our xml document is a valid document. Otherwise it is an
invalid document.
XSD: