0% found this document useful (0 votes)
296 views25 pages

Semantic Web Unit - 3

Ontology is the study of what kinds of things exist and their basic properties. In artificial intelligence, an ontology specifies conceptualizations to help programs and humans share knowledge. Ontologies define representational primitives like classes, attributes, and relationships to model a domain. Ontologies are used to integrate databases and enable interoperability between systems. The Resource Description Framework (RDF) is a standard model for data interchange on the web that uses URIs to name relationships between resources, forming a directed graph structure.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
296 views25 pages

Semantic Web Unit - 3

Ontology is the study of what kinds of things exist and their basic properties. In artificial intelligence, an ontology specifies conceptualizations to help programs and humans share knowledge. Ontologies define representational primitives like classes, attributes, and relationships to model a domain. Ontologies are used to integrate databases and enable interoperability between systems. The Resource Description Framework (RDF) is a standard model for data interchange on the web that uses URIs to name relationships between resources, forming a directed graph structure.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Semantic Web UNIT – 3

Ontology
Ontology is the study of the kinds of things that exist. In AI, the programs and sentences
deal with various kinds of objects, and we study what these kinds are and what their basic
properties are.
In general, ontology is the study or concern about what kinds of things exist -
what entities there are in the universe. It is a branch of Meta physics, the study of first
principles or the essence of things.

In artificial intelligence ( AI ), an ontology is, according to Tom Gruber, an AI specialist at


Stanford University, "the specification of conceptualizations, used to help programs and
humans share knowledge."

In the context of computer and information sciences, ontology defines a set of


representational primitives with which to model a domain of knowledge or discourse.
The representational primitives are typically classes (or sets), attributes (or
properties), and relationships (or relations among class members).

In the context of database systems, ontology can be viewed as a level of abstraction of data
models, analogous to hierarchical and relational models, but intended for modeling
knowledge about individuals, their attributes, and their relationships to other individuals.

Uses:
Ontologies are used for integrating heterogeneous databases, enabling interoperability
among disparate systems, and specifying interfaces to independent, knowledge-based
services. There are now standard languages and a variety of commercial and open source
tools for creating and working with ontologies.

KEY APPLICATIONS
Ontologies are part of the W3C standards stack for the Semantic Web, in which they are used
to Specify standard conceptual vocabularies in which to
 exchange data among systems,
 provide services for answering queries,
 publish reusable knowledge bases,
 and offer services to facilitate interoperability across multiple heterogeneous
systems and databases.
1
Semantic Web UNIT – 3

FOAF
FOAF (an acronym of Friend of a friend) is a machine-readable ontology describing
persons, their activities and their relations to other people and objects. Anyone can use
FOAF to describe him or herself. FOAF allows groups of people to describe social networks
without the need for a centralized database.

FOAF is a descriptive vocabulary expressed using the Resource Description


Framework (RDF) and the Web Ontology Language (OWL). Computers may use these
FOAF profiles to find, for example, all people living in Europe, or to list all people both you
and a friend of yours know. This is accomplished by defining relationships between people.
Each profile has a unique identifier (such as the person's e-mail addresses, a Jabber ID, or
a URI of the homepage or weblog of the person), which is used when defining these
relationships. The FOAF project, which defines and extends the vocabulary of a FOAF profile,
was started in 2000 by Libby Miller and Dan Brickley. It can be considered the first Social
Semantic Web application, in that it combines RDF technology with 'Social Web' concerns.

Example:
The following FOAF profile (written in Turtle format) states that Jimmy Wales is the name of
the person described here. His e-mail address, homepage and depiction are resources, which
means that each can be described using RDF as well. He has Wikimedia as an interest, and
knows Angela Beesley (which is the name of a 'Person' resource).

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .


@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

<#JW>
a foaf:Person ;
foaf:name "Jimmy Wales" ;
foaf:mbox <mailto:[email protected]> ;
foaf:homepage <http://www.jimmywales.com/> ;
foaf:nick "Jimbo" ;
foaf:depiction <http://www.jimmywales.com/aus_img_small.jpg> ;
foaf:interest <http://www.wikimedia.org> ;
foaf:knows [
a foaf:Person ;
foaf:name "Angela Beesley"
2
Semantic Web UNIT – 3

].

<http://www.wikimedia.org>
rdfs:label "Wikipedia" .

Turtle (syntax)
Turtle (Terse RDF Triple Language) is a serialization format for Resource Description
Framework (RDF) graphs. A subset of Tim Berners-Lee and Dan Connolly's Notation3 (N3)
language, it was defined by Dave Beckett, and is a superset of the minimal N-Triples format.
Unlike full N3, Turtle doesn't go beyond RDF's graph model. SPARQL uses a similar N3 subset
to Turtle for its graph patterns, but using N3's brace syntax for delimiting sub graphs. Turtle
was accepted as a first working draft by the World Wide Web Consortium (W3C) RDF
Working Group on 9 August 2011.

Turtle is popular among Semantic Web developers as a human-friendly alternative to


RDF/XML. A significant proportion of RDF toolkits include Turtle parsing and
serializing capability.

Some examples are Redland, Sesame, Jena and RDF Lib.


Example

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .


@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix ex: <http://example.org/stuff/1.0/> .

<http://www.w3.org/TR/rdf-syntax-grammar>
dc:title "RDF/XML Syntax Specification (Revised)" ;
ex:editor [
ex:fullname "Dave Beckett";
ex:homePage <http://purl.org/net/dajobe/>
].

3
Semantic Web UNIT – 3

Uniform Resource Identifier (URI)


In computing, a uniform resource identifier (URI) is a string of characters used
to identify a name or a resource. Such identification enables interaction with
representations of the resource over a network (typically the World Wide Web) using
specific protocols.
Schemes specifying a concrete syntax and associated protocols define each URI.

Diagram of URI scheme categories. Schemes in the URL (locator) and URN (name)
categories form subsets of URI, and also (generally) disjoint sets. Technically URL and URN
function as resource IDs; however, one cannot exactly categorize many schemes as one or the
other: we can treat all URIs as names, and some schemes embody aspects of both categories.

Relationship to URL and URN


URIs can be classified as locators (URLs), as names (URNs), or as both. A uniform resource
name(URN) functions like a person's name, while a uniform resource locator (URL) resembles
that person's street address. In other words: the URN defines an item's identity, while the
URL provides a method for finding it.

The ISBN system for uniquely identifying books provides a typical example of the use of
URNs.ISBN 0-486-27557-4 (urn:isbn:0-486-27557-4) cites, unambiguously, a specific edition
of Shakespeare's play Romeo and Juliet. To gain access to this object and read the book, one
needs its location: a URL address. A typical URL for this book on a Unix-like operating system
would be a file path such as file:///home/username/RomeoAndJuliet.pdf, identifying the
electronic book saved in a file on a local hard disk. So URNs and URLs have complementary
purposes.

Uses of URI references in markup languages


 In HTML, the value of the src attribute of the img element provides a URI reference, as

does the value of the href attribute of a or link element.


 In XML, the system identifier appearing after the SYSTEM keyword in a DTD is a fragment
less URI reference.
 In XSLT, the value of the href attribute of the xsl:import element/instruction is a URI
reference; likewise the first argument to thedocument() function.

4
Semantic Web UNIT – 3

Examples of absolute URIs


 http://example.org/absolute/URI/with/absolute/path/to/resource.txt
 ftp://example.org/resource.txt
 urn:issn:1535-3613
Examples of URI references
 http://en.wikipedia.org/wiki/URI#Examples_of_URI_references ("http" specifies the
'scheme' name, "en.wikipedia.org" is the 'authority', "/wiki/URI" the 'path' pointing to this
article, and "#Examples_of_URI_references" is a 'fragment' pointing to this section.)
 http://example.org/absolute/URI/with/absolute/path/to/resource.txt
 //example.org/scheme-relative/URI/with/absolute/path/to/resource.txt
 /relative/URI/with/absolute/path/to/resource.txt
 relative/path/to/resource.txt
 ../../../resource.txt
 ./resource.txt#frag01
 resource.txt
 #frag01
 (empty string)

Resource Description Framework (RDF)

The Resource Description Framework (RDF) is a family of World Wide Web Consortium
(W3C) specifications originally designed as a metadata data model. RDF is a standard model
for data interchange on the Web. RDF has features that facilitate data merging even if the
underlying schemas differ, and it specifically supports the evolution of schemas over time without
requiring all the data consumers to be changed.

RDF extends the linking structure of the Web to use URIs to name the relationship
between things as well as the two ends of the link (this is usually referred to as a “triple”).
Using this simple model, it allows structured and semi-structured data to be mixed, exposed,
and shared across different applications.

This linking structure forms a directed, labeled graph, where the edges
represent the named link between two resources, represented by the graph nodes.
This graph view is the easiest possible mental model for RDF and is often used in easy-
to-understand visual explanations.

5
Semantic Web UNIT – 3

The RDF data model is similar to classic conceptual modeling approaches such
as entity-relationship or class diagrams, as it is based upon the idea of
making statements about resources (in particular Web resources) in the form of subject-
predicate-object expressions. These expressions are known as triples in RDF
terminology. The subject denotes the resource, and the predicate denotes traits or aspects of
the resource and expresses a relationship between the subject and the object. For example,
one way to represent the notion "The sky has the color blue" in RDF is as the triple:
a subject denoting "the sky", a predicate denoting "has the color", and an object denoting
"blue". Therefore RDF swaps object for subject that would be used in the classical notation of
an Entity–attribute–value model within Object oriented design; object (sky), attribute
(color) and value (blue). RDF is an abstract model with several serialization formats (i.e., file
formats), and so the particular way in which a resource or triple is encoded varies from
format to format.

A collection of RDF statements intrinsically represents a labeled, directed multi-graph.


As such, an RDF-based data model is more naturally suited to certain kinds of knowledge
representation than the relational model and other ontological models. However, in practice,
RDF data is often persisted in relational database or native representations also
called Triplestores, or Quad stores if context (i.e. the named graph) is also persisted for each
RDF triple. As RDFS and OWL demonstrate, additional ontology languages can be built upon
RDF.

6
Semantic Web UNIT – 3

Example:

RDF Vocabulary
The vocabulary defined by the RDF specification is as follows:
Classes
rdf
 rdf:XMLLiteral - the class of XML literal values
 rdf:Property - the class of properties
 rdf:Statement - the class of RDF statements
 rdf:Alt, rdf:Bag, rdf:Seq - containers of alternatives, unordered containers, and ordered
containers (rdfs:Container is a super-class of the three)
 rdf:List - the class of RDF Lists
 rdf:nil - an instance of rdf:List representing the empty list

rdfs
 rdfs:Resource - the class resource, everything
 rdfs:Literal - the class of literal values, e.g. strings and integers
 rdfs:Class - the class of classes
7
Semantic Web UNIT – 3

 rdfs:Datatype - the class of RDF datatypes


 rdfs:Container - the class of RDF containers
 rdfs:ContainerMembershipProperty - the class of container membership
properties, rdf:_1, rdf:_2, ..., all of which are sub-properties of rdfs:member

Properties
rdf
 rdf:type - an instance of rdf:Property used to state that a resource is an instance of a class
 rdf:first - the first item in the subject RDF list
 rdf:rest - the rest of the subject RDF list after rdf:first
 rdf:value - idiomatic property used for structured values
 rdf:subject - the subject of the subject RDF statement
 rdf:predicate - the predicate of the subject RDF statement
 rdf:object - the object of the subject RDF statement
rdf:Statement, rdf:subject, rdf:predicate, rdf:object are used for reification (see below).

rdfs
 rdfs:subClassOf - the subject is a subclass of a class
 rdfs:subPropertyOf - the subject is a subproperty of a property
 rdfs:domain - a domain of the subject property
 rdfs:range - a range of the subject property
 rdfs:label - a human-readable name for the subject
 rdfs:comment - a description of the subject resource
 rdfs:member - a member of the subject resource
 rdfs:seeAlso - further information about the subject resource
 rdfs:isDefinedBy - the definition of the subject resource

8
Semantic Web UNIT – 3

This vocabulary is used as a foundation for RDF Schema where it is extended.


Serialization formats
RDF/XML serialization

Filename extension .rdf

Internet media type application/rdf+xml

Developed by World Wide Web Consortium

Concepts and Abstract Syntax February 10,


Standard(s)
2004; 8 years ago

Open format? Yes

Two common serialization formats are in use.


The first is an XML format. This format is often called simply RDF because it was introduced
among the other W3C specifications defining RDF. However, it is important to distinguish the
XML format from the abstract RDF model itself. Its MIME media type, application/rdf+xml,
was registered by RFC 3870. It recommends RDF documents to follow the new 2004
specifications.

In addition to serializing RDF as XML, the W3C introduced Notation 3 (or N3) as a non-XML
serialization of RDF models designed to be easier to write by hand, and in some cases easier
to follow. Because it is based on a tabular notation, it makes the underlying triples encoded in
the documents more easily recognizable compared to the XML serialization. N3 is closely
related to the Turtle and N-Triples formats. Triples may be stored in a triplestore.

Resource identification
The subject of an RDF statement is either a Uniform Resource Identifier (URI) or a blank
node, both of which denote resources. Resources indicated by blank nodes are called
anonymous resources. They are not directly identifiable from the RDF statement. The

9
Semantic Web UNIT – 3

predicate is a URI which also indicates a resource, representing a relationship. The object is a
URI, blank node or a Unicode string literal.

In Semantic Web applications, and in relatively popular applications of RDF


like RSS and FOAF (Friend of a Friend), resources tend to be represented by URIs that
intentionally denote, and can be used to access, actual data on the World Wide Web. But RDF,
in general, is not limited to the description of Internet-based resources. In fact, the URI that
names a resource does not have to be de reference able at all. For example, a URI that begins
with "http:" and is used as the subject of an RDF statement does not necessarily have to
represent a resource that is accessible via HTTP, nor does it need to represent a tangible,
network-accessible resource — such a URI could represent absolutely anything. However,
there is broad agreement that a bare URI (without a # symbol) which returns a 300-level
coded response when used in an HTTP GET request should be treated as denoting the
internet resource that it succeeds in accessing.

Therefore, producers and consumers of RDF statements must agree on the semantics
of resource identifiers. Such agreement is not inherent to RDF itself, although there are some
controlled vocabularies in common use, such as Dublin Core Metadata, which is partially
mapped to a URI space for use in RDF. The intent of publishing RDF-based ontologies on the
Web is often to establish, or circumscribe, the intended meanings of the resource identifiers
used to express data in RDF. For example, the URI http://www.w3.org/TR/2004/REC-owl-
guide-20040210/wine#Merlot is intended by its owners to refer to the class of all Merlot red
wines by vintner (i.e., instances of http://www.w3.org/TR/2004/REC-owl-guide-
20040210/wine#Merlot each represent the class of all wine produced by a single vintner), a
definition which is expressed by the OWL ontology — itself an RDF document — in which it
occurs. Without careful analysis of the definition, one might erroneously conclude that an
instance of http://www.w3.org/TR/2004/REC-owl-guide-20040210/wine#Merlot was
something physical, instead of a type of wine.
Note that this is not a 'bare' resource identifier, but is rather a URI reference, containing the
'#' character and ending with a fragment identifier.

RDF Design Goals


The design of RDF is intended to meet the following goals:
 having a simple data model
 having formal semantics and provable inference
 using an extensible URI-based vocabulary
10
Semantic Web UNIT – 3

 using an XML-based syntax


 supporting use of XML schema data types
 allowing anyone to make statements about any resource

Query and inference languages


The predominant query language for RDF graphs is SPARQL. SPARQL is an SQL-like language,
and a recommendation of the W3C as of January 15, 2008.
An example of a SPARQL query to show country capitals in Africa, using a fictional ontology.

PREFIX abc: <nul://sparql/exampleOntology#> .


SELECT ?capital ?country
WHERE {
?x abc:cityname ?capital ;
abc:isCapitalOf ?y.
?y abc:countryname ?country ;
abc:isInContinent abc:Africa.
}

Other ways to query RDF graphs include:


 RDQL, precursor to SPARQL, SQL-like
 Versa, compact syntax (non–SQL-like), solely implemented in 4Suite (Python)
 RQL, one of the first declarative languages for uniformly querying RDF schemas and
resource descriptions, implemented in RDFSuite.
 SeRQL, part of Sesame
 XUL has a template element in which to declare rules for matching data in RDF. XUL uses
RDF extensively for data binding.

#############################################################
Examples
[edit]Example 1: RDF Description of a person named Eric Miller[17]
The following example is taken from the W3C website[17] describing a resource with
statements "there is a Person identified byhttp://www.w3.org/People/EM/contact#me,
whose name is Eric Miller, whose email address is [email protected], and whose title is Dr.".

11
Semantic Web UNIT – 3

An RDF Graph Describing Eric Miller

The resource "http://www.w3.org/People/EM/contact#me" is the subject.


The objects are:
 "Eric Miller" (with a predicate "whose name is"),
[email protected] (with a predicate "whose email address is"), and
 "Dr." (with a predicate "whose title is").
The subject is a URI.
The predicates also have URIs. For example, the URI for each predicate:
 "whose name is" is http://www.w3.org/2000/10/swap/pim/contact#fullName,
 "whose email address is" is http://www.w3.org/2000/10/swap/pim/contact#mailbox,
 "whose title is" is http://www.w3.org/2000/10/swap/pim/contact#personalTitle.
In addition, the subject has a type (with URI http://www.w3.org/1999/02/22-rdf-syntax-
ns#type), which is person (with
URI http://www.w3.org/2000/10/swap/pim/contact#Person), and a mailbox (with
URIhttp://www.w3.org/2000/10/swap/pim/contact#mailbox.)
Therefore, the following "subject, predicate, object" RDF triples can be expressed:
 http://www.w3.org/People/EM/contact#me, http://www.w3.org/2000/10/swap/pim/
contact#fullName, "Eric Miller"
12
Semantic Web UNIT – 3

 http://www.w3.org/People/EM/contact#me, http://www.w3.org/2000/10/swap/pim/
contact#personalTitle, "Dr."
 http://www.w3.org/People/EM/contact#me, http://www.w3.org/1999/02/22-rdf-
syntax-ns#type,http://www.w3.org/2000/10/swap/pim/contact#Person
 http://www.w3.org/People/EM/contact#me, http://www.w3.org/2000/10/swap/pim/
contact#mailbox, [email protected]

Example 2: The postal abbreviation for New York


Certain concepts in RDF are taken from logic and linguistics, where subject-predicate and
subject-predicate-object structures have meanings similar to, yet distinct from, the uses of
those terms in RDF. This example demonstrates:
In the English language statement 'New York has the postal abbreviation NY' , 'New
York' would be the subject, 'has the postal abbreviation' the predicate and 'NY' the object.
Encoded as an RDF triple, the subject and predicate would have to be resources named by
URIs. The object could be a resource or literal element. For example, in the Notation 3 form of
RDF, the statement might look like:
<urn:x-states:New%20York> <http://purl.org/dc/terms/alternative> "NY" .
In this example, "urn:x-states:New%20York" is the URI for a resource that denotes the U.S.
state New York, "http://purl.org/dc/terms/alternative" is the URI for a predicate (whose
human-readable definition can be found at here [18]), and "NY" is a literal string. Note that the
URIs chosen here are not standard, and don't need to be, as long as their meaning is known to
whatever is reading them.
N-Triples is just one of several standard serialization formats for RDF. The triple above can
also be equivalently represented in the standard RDF/XML format as:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dcterms="http://purl.org/dc/terms/">
<rdf:Description rdf:about="urn:x-states:New%20York">
<dcterms:alternative>NY</dcterms:alternative>
</rdf:Description>
</rdf:RDF>
However, because of the restrictions on the syntax of QNames (such
as dcterms:alternative above), there are some RDF graphs that are not representable with
RDF/XML.

13
Semantic Web UNIT – 3

[edit]Example 3: A Wikipedia article about Tony Benn


In a like manner, given that "http://en.wikipedia.org/wiki/Tony_Benn" identifies a particular
resource (regardless of whether that URI could be traversed as a hyperlink, or whether the
resource is actually the Wikipedia article about Tony Benn), to say that the title of this
resource is "Tony Benn" and its publisher is "Wikipedia" would be two assertions that could
be expressed as valid RDF statements. In the N-Triples form of RDF, these statements might
look like the following:
<http://en.wikipedia.org/wiki/Tony_Benn> <http://purl.org/dc/elements/1.1/title> "Tony
Benn" .
<http://en.wikipedia.org/wiki/Tony_Benn> <http://purl.org/dc/elements/1.1/publisher>
"Wikipedia" .
And these statements might be expressed in RDF/XML as:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<rdf:Description rdf:about="http://en.wikipedia.org/wiki/Tony_Benn">
<dc:title>Tony Benn</dc:title>
<dc:publisher>Wikipedia</dc:publisher>
</rdf:Description>
</rdf:RDF>
To an English-speaking person, the same information could be represented simply as:
The title of this resource, which is published by Wikipedia, is 'Tony Benn'
However, RDF puts the information in a formal way that a machine can understand. The
purpose of RDF is to provide an encoding and interpretation mechanism so
that resources can be described in a way that particular software can understand it; in other
words, so that software can access and use information that it otherwise couldn't use.
Both versions of the statements above are wordy because one requirement for an RDF
resource (as a subject or a predicate) is that it be unique. The subject resource must be
unique in an attempt to pinpoint the exact resource being described. The predicate needs to
be unique in order to reduce the chance that the idea of Title or Publisher will be ambiguous
to software working with the description. If the software
recognizes http://purl.org/dc/elements/1.1/title (a specific definition for the concept of a title
established by the Dublin CoreMetadata Initiative), it will also know that this title is different
from a land title or an honorary title or just the letters t-i-t-l-e put together.

14
Semantic Web UNIT – 3

The following example shows how such simple claims can be elaborated on, by combining
multiple RDF vocabularies. Here, we note that the primary topic of the Wikipedia page is a
"Person" whose name is "Tony Benn":
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<rdf:Description rdf:about="http://en.wikipedia.org/wiki/Tony_Benn">
<dc:title>Tony Benn</dc:title>
<dc:publisher>Wikipedia</dc:publisher>
<foaf:primaryTopic>
<foaf:Person>
<foaf:name>Tony Benn</foaf:name>
</foaf:Person>
</foaf:primaryTopic>
</rdf:Description>
</rdf:RDF>
[edit]Applications
 Sigma - Application from DERI in National University of Ireland, Galway(NUIG).
 Creative Commons - Uses RDF to embed license information in web pages and mp3 files.
 DOAC (Description of a Career) - supplements FOAF to allow the sharing
of résumé information.
 Enterprise Architect: MDG Technology for ODM (ODM supports RDF and OWL).
 FOAF (Friend of a Friend) - designed to describe people, their interests and
interconnections.
 Haystack client - Semantic web browser from MIT CS & AI lab.[19]
 IDEAS Group - developing a formal 4D Ontology for Enterprise Architecture using RDF as
the encoding.[20]
 Microsoft shipped a product, Connected Services Framework,[21] which provides RDF-
based Profile Management capabilities.
 MusicBrainz - Publishes information about Music Albums.[22]
 NEPOMUK, an open-source software specification for a Social Semantic desktop uses RDF
as a storage format for collected metadata. NEPOMUK is mostly known because of its
integration into the KDE SC 4 desktop environment.

15
Semantic Web UNIT – 3

 RDF Site Summary - one of several "RSS" languages for publishing information about
updates made to a web page; it is often used for disseminating news article summaries
and sharing weblog content.
 ResumeRDF - developed to express information contained in a personal Resume or
Curriculum Vitae (CV) on the Semantic Web. This includes information about work and
academic experience, skills, etc.
 Simple Knowledge Organization System (SKOS) - a KR representation intended to support
vocabulary/thesaurus applications
 SIOC (Semantically-Interlinked Online Communities) - designed to describe online
communities and to create connections between Internet-based discussions from
message boards, weblogs and mailing lists.[23]
 Smart-M3 - provides an infrastructure for using RDF and specifically uses the ontology
agnostic nature of RDF to enable heterogeneous mashing-up of information[24]
 Many other RDF schemas are available by searching SchemaWeb.[25]
Some uses of RDF include research into social networking. This is important because it could
help governments keep track of undesirables. It will also help people in business fields
understand better their relationships with members of industries that could be of use for
product placement.[26] It will also help scientists understand how people are connected to one
another.
RDF is being used to have a better understanding of traffic patterns. This is because the
information regarding traffic patterns is on different websites, and RDF is used to integrate
information from different sources on the web. Before, the common methodology was using
keyword searching, but this method is problematic because it does not consider synonyms.
This is why ontologies are useful in this situation. But one of the issues that comes up when
trying to efficiently study traffic is that to fully understand traffic, concepts related to people,
streets, and roads must be well understood. Since these are human concepts, they require the
addition of fuzzy logic. This is because values that are useful when describing roads, like
slipperiness, are not precise concepts and cannot be measured. This would imply that the
best solution would incorporate both fuzzy logic and ontology.[27]

RDF Schema
RDF Schema (variously abbreviated as RDFS, RDF(S), RDF-S, or RDF/S) is a set of classes
with certain properties using the RDF extensible representation language, providing basic
elements for the description of ontologies, otherwise called RDF vocabularies, intended to

16
Semantic Web UNIT – 3

structure RDF resources. These resources can be saved in a triple store to reach them with
the query language SPARQL.

Main RDFS constructs


RDFS constructs are the RDFS classes, associated properties and utility properties built on the
limited vocabulary of RDF.
[edit]Classes
 rdfs:Resource is the class of everything. All things described by RDF are resources.
 rdfs:Class declares a resource as a class for other resources.

A typical example of an rdfs:Class is foaf:Person in the Friend of a Friend (FOAF) vocabulary.


An instance of foaf:Person is a resource that is linked to the class foaf:Person using
the rdf:type property, such as in the following formal expression of the natural language
sentence : 'John is a Person'.
ex:John rdf:type foaf:Person
The definition of rdfs:Class is recursive: rdfs:Class is the rdfs:Class of any rdfs:Class.
The other classes described by the RDF and RDFS specifications are:
 rdfs:Literal – literal values such as strings and integers. Property values such as textual
strings are examples of RDF literals. Literals may be plain or typed.
 rdfs:Datatype – the class of datatypes. rdfs:Datatype is both an instance of and a subclass
of rdfs:Class. Each instance of rdfs:Datatype is a subclass of rdfs:Literal.
 rdf:XMLLiteral – the class of XML literal values. rdf:XMLLiteral is an instance of
rdfs:Datatype (and thus a subclass of rdfs:Literal).
 rdf:Property – the class of properties.
[edit]Properties
Properties are instances of the class rdf:Property and describe a relation between subject
resources and object resources. When used as such a property is a predicate (see also RDF:
reification).
 rdfs:domain of an rdf:predicate declares the class of the subject in a triple whose second
component is the predicate.
 rdfs:range of an rdf:predicate declares the class or datatype of the object in a triple
whose second component is the predicate.

17
Semantic Web UNIT – 3

For example, the following declarations are used to express that the
property ex:employer relates a subject, which is of typefoaf:Person, to an object, which is of
type foaf:Organization:
ex:employer rdfs:domain foaf:Person
ex:employer rdfs:range foaf:Organization

Given the previous two declarations, the following triple requires that ex:John is necessarily
a foaf:Person, and ex:CompanyX is necessarily a foaf:Organization:
ex:John ex:employer ex:CompanyX
 rdf:type is a property used to state that a resource is an instance of a class.
 rdfs:subClassOf allows to declare hierarchies of classes.

For example, the following declares that 'Every Person is an Agent':


foaf:Person rdfs:subClassOf foaf:Agent
Hierarchies of classes support inheritance of a property domain and range (see definitions in
next section) from a class to its subclasses.
 rdfs:subPropertyOf is an instance of rdf:Property that is used to state that all resources
related by one property are also related by another.
 rdfs:label is an instance of rdf:Property that may be used to provide a human-readable
version of a resource's name.
 rdfs:comment is an instance of rdf:Property that may be used to provide a human-
readable description of a resource.

[edit]Utility Properties
 rdfs:seeAlso is an instance of rdf:Property that is used to indicate a resource that might
provide additional information about the subject resource.
 rdfs:isDefinedBy is an instance of rdf:Property that is used to indicate a resource
defining the subject resource. This property may be used to indicate an RDF vocabulary in
which a resource is described.
[edit]RDFS Entailment
An entailment regime defines by RDFs (,OWL, etc.) not only which entailment relation is used,
but also which queries and graphs are well-formed for the regime. The RDFS entailment is a
standard entailment relations in the semantic web.

18
Semantic Web UNIT – 3

For example, the following declares that 'Dog is an animal','Cat1 is a cat', 'Zoos host animals'
and 'Zoo1 hosts the Cat2' :

ex:dog1 rdf:type ex:animal


ex:cat1 rdf:type ex:cat
zoo:host rdfs:range ex:animal
ex:zoo1 zoo:host ex:cat2

But this graph is not well formed because the system can not guess that a cat is an animal. We
have to add 'Cats are animals' to do a well-formed graph with :

ex:cat rdfs:subClassOf ex:animal

Voila, the correct example:

In english The graph

 Dog1 is an animal
 Cat1 is a cat
 Cats are animals
 Zoos host animals
 Zoo1 hosts the Cat2

RDF/turtle

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .


@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ex: <http://example.org/> .
@prefix zoo: <http://example.org/zoo/> .
ex:dog1 rdf:type ex:animal .
ex:cat1 rdf:type ex:cat .
ex:cat rdfs:subClassOf ex:animal .
zoo:host rdfs:range ex:animal .
ex:zoo1 zoo:host ex:cat2 .

If your triplestore (or RDF database) implements the regime entailment of RDF and RDFS,
the SPARQL query as follows (the keyword "a" is equivalent to rdf:type in SPARQL):
PREFIX ex: <http://example.org/>
SELECT ?animal

19
Semantic Web UNIT – 3

WHERE
{ ?animal a ex:animal . }
Give the following result with cat2 because the Cat's type inherits of Animal's type:

animal

<http://example.org/dog1>

<http://example.org/cat1>

<http://example.org/cat2>

RDFS Example
The following example demonstrates some of the RDFS facilities:
<?xml version="1.0"?>

<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xml:base="http://www.animals.fake/animals#">

<rdf:Description rdf:ID="animal">
<rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
</rdf:Description>

<rdf:Description rdf:ID="horse">
<rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
<rdfs:subClassOf rdf:resource="#animal"/>
</rdf:Description>

</rdf:RDF>

Example Abbreviated
Since an RDFS class is an RDF resource we can abbreviate the example above by using
rdfs:Class instead of rdf:Description, and drop the rdf:type information:
<?xml version="1.0"?>

<rdf:RDF

20
Semantic Web UNIT – 3

xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xml:base="http://www.animals.fake/animals#">

<rdfs:Class rdf:ID="animal" />

<rdfs:Class rdf:ID="horse">
<rdfs:subClassOf rdf:resource="#animal"/>
</rdfs:Class>

</rdf:RDF>

XML Schema
An XML Schema describes the structure of an XML document.

XML Schema Example


<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>

</xs:schema>

XML Schema is an XML-based alternative to DTD.

An XML schema describes the structure of an XML document.

The XML Schema language is also referred to as XML Schema Definition (XSD).

21
Semantic Web UNIT – 3

What is an XML Schema?


The purpose of an XML Schema is to define the legal building blocks of an XML document, just like a
DTD.

An XML Schema:

 defines elements that can appear in a document


 defines attributes that can appear in a document
 defines which elements are child elements
 defines the order of child elements
 defines the number of child elements
 defines whether an element is empty or can include text
 defines data types for elements and attributes
 defines default and fixed values for elements and attributes

XML Schemas are the Successors of DTDs


We think that very soon XML Schemas will be used in most Web applications as a replacement for DTDs.
Here are some reasons:

 XML Schemas are extensible to future additions


 XML Schemas are richer and more powerful than DTDs
 XML Schemas are written in XML
 XML Schemas support data types
 XML Schemas support namespaces

XML Schemas are much more powerful than DTDs.

XML Schemas Support Data Types


One of the greatest strength of XML Schemas is the support for data types.

With support for data types:

 It is easier to describe allowable document content


 It is easier to validate the correctness of data
 It is easier to work with data from a database
 It is easier to define data facets (restrictions on data)
 It is easier to define data patterns (data formats)
 It is easier to convert data between different data types

XML Schemas use XML Syntax


Another great strength about XML Schemas is that they are written in XML.

Some benefits of that XML Schemas are written in XML:

22
Semantic Web UNIT – 3

 You don't have to learn a new language


 You can use your XML editor to edit your Schema files
 You can use your XML parser to parse your Schema files
 You can manipulate your Schema with the XML DOM
 You can transform your Schema with XSLT

XML Schemas Secure Data Communication


When sending data from a sender to a receiver, it is essential that both parts have the same
"expectations" about the content.

With XML Schemas, the sender can describe the data in a way that the receiver will understand.

A date like: "03-11-2004" will, in some countries, be interpreted as 3.November and in other countries
as 11.March.

However, an XML element with a data type like this:

<date type="date">2004-03-11</date>

ensures a mutual understanding of the content, because the XML data type "date" requires the format
"YYYY-MM-DD".

XML Schemas are Extensible


XML Schemas are extensible, because they are written in XML.

With an extensible Schema definition you can:

 Reuse your Schema in other Schemas


 Create your own data types derived from the standard types
 Reference multiple schemas in the same document

Well-Formed is not enough


A well-formed XML document is a document that conforms to the XML syntax rules, like:

 it must begin with the XML declaration


 it must have one unique root element
 start-tags must have matching end-tags
 elements are case sensitive
 all elements must be closed
 all elements must be properly nested
 all attribute values must be quoted
 entities must be used for special characters

Even if documents are well-formed they can still contain errors, and those errors can have serious
consequences.

XML documents can have a reference to a DTD or to an XML Schema.

23
Semantic Web UNIT – 3

A Simple XML Document


Look at this simple XML document called "note.xml":

<?xml version="1.0"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>

A DTD File
The following example is a DTD file called "note.dtd" that defines the elements of the XML document
above ("note.xml"):

<!ELEMENT note (to, from, heading, body)>


<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>

The first line defines the note element to have four child elements: "to, from, heading, body".

Line 2-5 defines the to, from, heading, body elements to be of type "#PCDATA".

An XML Schema
The following example is an XML Schema file called "note.xsd" that defines the elements of the XML
document above ("note.xml"):

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3schools.com"
xmlns="http://www.w3schools.com"
elementFormDefault="qualified">

<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>

</xs:schema>
24
Semantic Web UNIT – 3

The note element is a complex type because it contains other elements. The other elements (to, from,
heading, body) are simple types because they do not contain other elements. You will learn more about
simple and complex types in the following chapters.

A Reference to a DTD
This XML document has a reference to a DTD:

<?xml version="1.0"?>

<!DOCTYPE note SYSTEM


"http://www.w3schools.com/dtd/note.dtd">

<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>

A Reference to an XML Schema


This XML document has a reference to an XML Schema:

<?xml version="1.0"?>

<note
xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com note.xsd">
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>

25

You might also like