0% found this document useful (0 votes)
63 views81 pages

RDF: Basic Ideas: Towards Knowledge Network

The document describes the basic concepts of RDF including: 1. RDF represents facts as subject-predicate-object triples called statements. Subjects, predicates, and objects are identified by URIs. 2. Statements assert properties and relationships between resources. An RDF graph is a collection of triples that represents these statements. 3. Resources represent objects that can be described and identified with URIs. Properties describe relationships between resources and are also identified by URIs.

Uploaded by

Raja Waqas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views81 pages

RDF: Basic Ideas: Towards Knowledge Network

The document describes the basic concepts of RDF including: 1. RDF represents facts as subject-predicate-object triples called statements. Subjects, predicates, and objects are identified by URIs. 2. Statements assert properties and relationships between resources. An RDF graph is a collection of triples that represents these statements. 3. Resources represent objects that can be described and identified with URIs. Properties describe relationships between resources and are also identified by URIs.

Uploaded by

Raja Waqas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 81

RDF: Basic Ideas

Towards Knowledge Network


Graph Data Model
• A fact represented this way has three parts: a subject, a
predicate (i.e., verb), and an object

• A fact is expressed as a Subject-Predicate-Object triple,


also known as a statement

• Subjects, predicates, and objects are given as names for


entities, also called resources

• Objects can also be given as text values, called literal


values

• Any expression in RDF is a collection of triples, each


consisting of a subject, a predicate (property that
represents relation) and an object
Basic Ideas of RDF
• Basic building block: object-attribute-value
triple
– It is called a statement
– Sentence about Billington is such a statement
• The fundamental concepts of RDF are:
– resources
– properties
– statements
Resources
• We can think of a resource as an object, a
“thing” we want to talk about
– e.g. authors, books, publishers, places,
people, hotels
• Every resource has a URI, a Universal
Resource Identifier
• A URI can be
– a URL (Web address) or
– some other kind of unique identifier
Properties
• Properties are a special kind of resources
• They describe relations between
resources
– e.g. “written by”, “age”, “title”, etc.
• Properties are also identified by URIs
• Advantages of using URIs:
– Α global, worldwide, unique naming scheme
– Reduces the homonym problem of
distributed data representation
Statements
• Statements assert the properties of
resources
• A statement is an object-attribute-value
triple
– It consists of a resource, a property, and a
value
• Values can be resources or literals
– Literals are atomic values (strings)
Meaning of RDF Graph
• The assertion of an RDF triple says that some
relationship, indicated by the predicate, holds
between the things denoted by subject and
object of the triple

• The assertion of an RDF graph amounts to


asserting all the triples in it, so the meaning of
an RDF graph is the conjunction (logical AND) of
the statements corresponding to all the triples it
contains
• A directed graph with labeled nodes and
arcs
– from the resource (the subject of the
statement)
– to the value (the object of the statement)
A Set of Triples as a Semantic
Net
An RDF Graph Describing Eric
Miller
• individuals, e.g., Eric Miller, identified by
http://www.w3.org/People/EM/contact#me
• kinds of things, e.g., Person, identified by
http://www.w3.org/2000/10/swap/pim/contact#Person
• properties of those things, e.g., mailbox, identified by
http://www.w3.org/2000/10/swap/pim/contact#mailbox
• values of those properties, e.g. mailto:[email protected] as the
value of the mailbox property (RDF also uses character
strings such as "Eric Miller", and values from other
datatypes such as integers and dates, as the values of
properties)
An RDF Graph Describing Eric Miller
Several Statements About the Same
Resource
1. <?xml version="1.0"?>
2. <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
3. xmlns:exterms="http://www.example.org/terms/">

4. <rdf:Description rdf:about="http://www.example.org/index.html">
5. <exterms:creation-date>August 16, 1999</exterms:creation-date>
6. </rdf:Description>

7. </rdf:RDF>
Describing a Web Page's Creation Date
Several Statements About the Same Resource
shows a graph saying "the document
'http://www.w3.org/TR/rdf-syntax-grammar' has a title
'RDF/XML Syntax Specification (Revised)' and has an
editor, the editor has a name 'Dave Beckett' and a home
page 'http://purl.org/net/dajobe/' ".
Exercise: Mark all the
resources and properties on the
page given to you and write in
the form of a statement on the
back side of the page and return
it with your name and
registration number
• Exercise: Write the following information into a set of
statements (triples) and then draw them into and
RDF graph
• The article on giant squids, titled "Architeuthis Dux,"
at http://burningbird.net/articles/monsters3.htm,
written by Shelley Powers, explores the giant's
squid's mythological representation as the legendary
Kraken as well as describing current efforts to
capture images of a live specimen. In addition, the
article also provides descriptions of a giant squid's
physical characteristics. It is part of a four-part
series, described at
http://burningbird.net/articles/monsters.htm and
entitled "A Tale of Two Monsters."
• The article is uniquely identified by its URI,
http://burningbird.net/articles/monsters3.htm.

• The article was written by Shelley Powers—predicate is written by, value is Shelley
Powers.

• The article's title is "Architeuthis Dux"—predicate is title, value is Architeuthis Dux.

• The article is one of a four-part series—predicate is series member, value is


http://burningbird.net/articles/monsters.htm.

• The series is titled "A Tale of Two Monsters"—series predicate is title, value is A Tale
of Two Monsters.

• The article associates the giant squid with the legendary Kraken—predicate is
associates, value is Kraken and giant squid.

• The article provides physical descriptions of the giant squid—predicate is provides, value
is physical description of giant squid.
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:pstcn="http://burningbird.net/postcon/elements/1.0/">

<rdf:Description rdf:about="http://burningbird.net/articles/monsters3.htm">
<pstcn:author>Shelley Powers</pstcn:author>
<pstcn:title>Architeuthis Dux</pstcn:title>
<pstcn:series rdf:resource="http://burningbird.net/articles/monsters.htm" />
<pstcn:contains>Physical description of giant squids</pstcn:contains>
<pstcn:alsoContains>Tale of the Legendary Kraken</pstcn:alsoContains>
</rdf:Description>

<rdf:Description rdf:about="http://burningbird.net/articles/monsters.htm">
<pstcn:seriesTitle>A Tale of Two Monsters</pstcn:seriesTitle>
</rdf:Description>
</rdf:RDF>
Another representation
Nesting one resource description in another
shows the connection between the two more
clearly

<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:pstcn="http://burningbird.net/postcon/elements/1.0/">
<rdf:Description rdf:about="http://burningbird.net/articles/monsters3.htm">
<pstcn:author>Shelley Powers</pstcn:author>
<pstcn:title>Architeuthis Dux</pstcn:title>
<pstcn:series>
<rdf:Description rdf:about=
"http://burningbird.net/articles/monsters.htm">
<pstcn:SeriesTitle>A Tale of Two Monsters</pstcn:SeriesTitle>
</rdf:Description>
</pstcn:series>
<pstcn:contains>Physical description of giant squids</pstcn:contains>
<pstcn:alsoContains>Tale of the Legendary Kraken</pstcn:alsoContains>
</rdf:Description>
</rdf:RDF>
Subjects and predicates occur in layers,

with subjects separated from other subjects by


predicates and predicates separated from other
predicates by subjects.

Subjects are never nested directly within subjects, and


predicates are never nested directly within predicates.
RDF Tags
1. rdf:RDF 9. rdf:Bag
2. rdf:Description 10.rdf:Seq
3. rdf:about 11.rdf:Alt
4. rdf:nodeID 12.rdf:parseType="Coll
5. rdf:ID="item10245“ ection
6. rdf:type 13.rdf:subject
7. rdf:datatype 14.rdf:predicate
8. rdf:resource 15.rdf:object
16.rdf:Statement
The rdf:resource Attribute
• We can denote that two entities are the
same using the rdf:resource attribute
The rdf:resource Attribute
<rdf:Description rdf:about="CIT1111">
<uni:courseName>Discrete
Mathematics</uni:courseName>
<uni:isTaughtBy rdf:resource="949318"/>
</rdf:Description>
<rdf:Description rdf:about="949318">
<uni:name>David Billington</uni:name>
<uni:title>Associate Professor</uni:title>
</rdf:Description>
Nested Descriptions: Example
<rdf:Description rdf:about="CIT1111">
<uni:courseName>Discrete Maths</uni:courseName>
<uni:isTaughtBy>
<rdf:Description rdf:ID="949318">
<uni:name>David Billington</uni:name>
<uni:title>Associate Professor</uni:title>
</rdf:Description>
</uni:isTaughtBy>
</rdf:Description>
Nested Descriptions
• Descriptions may be defined within other
descriptions
• Other courses, such as CIT3112, can still
refer to the new resource with ID 949318
• Although a description may be defined
within another description, its scope is
global
Introducing some Structure to RDF
Documents using the rdf:type Element

<rdf:Description rdf:ID="CIT1111">
<rdf:type rdf:resource="http://www.mydomain.org/uni-
ns#course"/>
<uni:courseName>Discrete Maths</uni:courseName>
<uni:isTaughtBy rdf:resource="#949318"/>
</rdf:Description>
<rdf:Description rdf:ID="949318">
<rdf:type rdf:resource="http://www.mydomain.org/uni-
ns#lecturer"/>
<uni:name>David Billington</uni:name>
<uni:title>Associate Professor</uni:title>
</rdf:Description>
Three Types of Container Elements

• rdf:Bag an unordered container, allowing multiple


occurrences
– E.g. members of the faculty board, documents in a folder
• rdf:Seq an ordered container, which may contain
multiple occurrences
– E.g. modules of a course, items on an agenda, an alphabetized
list of staff members (order is imposed)
• rdf:Alt a set of alternatives
– E.g. the document home and mirrors, translations of a document
in various languages
Example for a Bag

<uni:lecturer rdf:ID="949352" uni:name="Grigoris


Antoniou"
uni:title="Professor">
<uni:coursesTaught>
<rdf:Bag>
<rdf:_1 rdf:resource="#CIT1112"/>
<rdf:_2 rdf:resource="#CIT3116"/>
</rdf:Bag>
</uni:coursesTaught>
</uni:lecturer>
For example, a Bag might be used to describe a group
of part numbers in which the order of entry or
processing of the part numbers does not matter.
A Simple Bag Container Description
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:s="http://example.org/students/vocab#">

<rdf:Description rdf:about="http://example.org/courses/6.001">
<s:students>
<rdf:Bag>
<rdf:li rdf:resource="http://example.org/students/Amy"/>
<rdf:li rdf:resource="http://example.org/students/Mohamed"/>
<rdf:li rdf:resource="http://example.org/students/Johann"/>
<rdf:li rdf:resource="http://example.org/students/Maria"/>
<rdf:li rdf:resource="http://example.org/students/Phuong"/>
</rdf:Bag>
</s:students>
</rdf:Description>
</rdf:RDF>
An Alternative or Alt (a resource having type rdf:Alt)
represents a group of resources or literals that are
alternatives (typically for a single value of a
property).

For example, an Alt might be used to describe


alternative language translations for the title of a
book, or to describe a list of alternative Internet
sites at which a resource might be found.

An application using a property whose value is an


Alt container should be aware that it can choose
any one of the members of the group as
appropriate.
Example for Alternative
<uni:course rdf:ID="CIT1111"
uni:courseName="Discrete Mathematics">
<uni:lecturer>
<rdf:Alt>
<rdf:li rdf:resource="#949352"/>
<rdf:li rdf:resource="#949318"/>
</rdf:Alt>
</uni:lecturer>
</uni:course>
RDF/XML for an Alt Container

<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:s="http://example.org/packages/vocab#">

<rdf:Description rdf:about="http://example.org/packages/X11">
<s:DistributionSite>
<rdf:Alt>
<rdf:li rdf:resource="ftp://ftp.example.org"/>
<rdf:li rdf:resource="ftp://ftp1.example.org"/>
<rdf:li rdf:resource="ftp://ftp2.example.org"/>
</rdf:Alt>
</s:DistributionSite>
</rdf:Description>
</rdf:RDF>
A Sequence or Seq (a resource having type
rdf:Seq) represents a group of resources or
literals, possibly including duplicate members,
where the order of the members is significant.

For example, a Sequence might be used to


describe a group that must be maintained in
alphabetical order.
The students in course 6.001 are Amy, Mohamed, and
Johann
RDF Collections

• RDF provides support for describing


groups containing only the specified
members, in the form of RDF collections
– list structure in the RDF graph
– constructed using a predefined collection
vocabulary: rdf:List, rdf:first, rdf:rest and
rdf:nil
rdf:type
• If we consider our examples so far, we
notice that the descriptions fall into two
categories: courses and lecturers.
• This fact is clear to us humans, but has
not been formally declared anywhere, so
is not accessible to machines.
• In RDF it is possible to make such
statements using the rdf:type element.
RDFS
• RDF is a universal language that lets you
describe resources using your own
vocabulary.
• How can we disallow statements like these
in an RDF database

Discrete Mathematics is taught by Concrete Mathematics.

Room MZH5760 is taught by David Billington.


• RDF does not make assumptions about
any particular application domain, nor
does it define the semantics of any
domain. It is up to the user to do so in
RDF Schema (RDFS).
An extension to RDF

• RDF needs a way to define application-


specific classes and properties
• Application-specific classes and properties
must be defined using extensions to RDF
• One such extension is RDF Schema.
• How do we describe a particular domain?
• First we have to specify the “things” we
want to talk about.
• talk about individual objects (resources),
• second we talk about classes which define
types of objects
• A class can be thought of as a set of
elements. Individual objects that belong to
a class are referred to as instances of that
class.
• An important use of classes is to impose
restrictions on what can be stated in an
RDF document using the schema.
• After all, we would like to disallow
statements such as:
Discrete Mathematics is taught by Concrete Mathematics.

Room MZH5760 is taught by David Billington.


Discrete Mathematics is taught by Concrete Mathematics.

• The statement is non-sensical because we


want courses to be taught by lecturers
only.
• This imposes a restriction on the values of
the property “is taught by”. In
mathematical terms, we restrict the range
of the property.
Room MZH5760 is taught by David Billington.

• The statement is non-sensical because


only courses can be taught.
• This imposes a restriction on the objects to
which the property can be applied.
• In mathematical terms, we restrict the
domain of the property.
Class hierarchies and inheritance
• Once we have classes we would also like to
establish relationships between them.
– staff members
– academic staff members
– professors
– associate professors
– assistant professors
– administrative staff members
– technical support staff members.
• These classes are not unrelated to each
other.
RDF Schema
• RDF Schema provides the framework to
describe application-specific classes and
properties
• Classes are much like OO classes
• Properties define the attributes and
relationships between Classes
RDFS
• Semantic networks on the Web
• Nodes are identified by URIs
• RDFS provides explicit modeling
formalism
– rdfs:Class
– rdfs:subClassOf
– rdfs:Property
– Rdfs:subPropertyOf
– rdf:type
Class Hierarchies
• Classes can be organised in
hierarchies
– A is a subclass of B if every instance of A
is also an instance of B
– Then B is a superclass of A
• A subclass graph need not be a tree
• A class may have multiple superclasses
RDFS-Class hierarchy
Inheritance in Class Hierarchies
• Range restriction: Courses must be taught by
academic staff members only
• Michael Maher is a professor
• He inherits the ability to teach from the class of
academic staff members
• This is done in RDF Schema by fixing the semantics of
“is a subclass of”
– It is not up to an application (RDF processing
software) to interpret “is a subclass of
Inheritance in Class Hierarchies

• Range restriction: Courses must be taught by


academic staff members only
• Michael Maher is a professor
• He inherits the ability to teach from the class of
academic staff members
• This is done in RDF Schema by fixing the semantics of
“is a subclass of”
– It is not up to an application (RDF processing
software) to interpret “is a subclass of
RDFS - Classes and Properties
• Classes, inheritance and properties are, of
course, known in other fields of computing,
for example in object-oriented
programming.
• But while there are many similarities, there
are differences, too. In object-oriented
programming, an object class defines the
properties that apply to it. To add new
properties to a class means to modify the
class.
• However in RDFS properties are defined
globally, that is, they are not encapsulated
as attributes in class definitions.
• It is perfectly possible to define new
properties that apply to an existing class,
without changing that class.
Property hierarchies
• hierarchical relationships between classes
can be defined. The same can be done for
properties.
• For example, “is taught by” is a
subproperty of “involves”. If a course c is
taught by an academic staff member a,
then c also involves a.
• The converse is not necessarily true. For
example, a may be the convener of the
course, or a tutor who marks student
homework, but does not teach c.
• P is a subproperty of Q, if Q(x,y) is true
whenever P(x,y) is true
Property (as relationship)

Property (domain, range)


Properties can have hierarchies

Using rdfs:subPropertyOf
Property (as attribute)

Property (domain, range)


RDF and RDFS layers
Core classes
• rdfs:Resource. It is the class of all
resources.
• rdfs:Class. It is the class of all classes.
• rdfs:Literal. It is the class of all literals
(strings). At present, literals form the only
“data type” of RDF/RDFS.
• rdf:Property. It is the class of all properties.
• rdf:Statement. It is the class of all reified
statements.
• For example, a class lecturer can be
defined as follows:
<rdfs:Class rdf:ID="lecturer">
...
</rdfs:Class>
Core properties for defining
relationships
• rdf:type. It relates a resource to its class. The
resource is declared to be an instance of that
class
• rdfs:subClassOf. It relates a class to one of its
superclasses; all instances of a class are
instances of its superclass. Note that a class
may be subclass of more than one classes. As
an example, the class femaleProfessor can be a
subclass of both female and professor.
• rdfs:subPropertyOf. It relates a property to one
of its superproperties
Example
<rdfs:Class rdf:about="#lecturer">
<rdfs:subClassOf
rdf:resource="#staffMember"/>
</rdfs:Class>
Domain / Range
• Person writes/authors Document.
• Person has name (Literal).
• Document has title (DC:title).
Core properties for restricting
properties
• rdfs:domain. It specifies the domain of a
property P, that is, the class of those
resources which may appear as subjects
in a triple with predicate P. If the domain is
not specified, then any resource can be
the subject.
• rdfs:range. It specifies the range of a
property P, that is, the class of those
resources which may appear as values in
a triple with predicate P.
• Here is an example. It states that phone
applies to staff members only, and that its
value is always a literal.

<rdf:Property rdf:ID="phone">
<rdfs:domain rdf:resource="#staffMember"/>
<rdfs:range rdf:resource=
"http://www.w3.org/2000/01/rdf-schema#Literal"/>
</rdf:Property>

You might also like