0% found this document useful (0 votes)
56 views

Semantic Web (RDF)

RDF is the basic building block for supporting the Semantic Web. RDF describes information contained in web resources using a subject-predicate-object expression where the subject is the resource, the predicate expresses a property of the resource, and the object contains the property value. An RDF document uses XML syntax to express statements about resources in terms of URIs, properties, and property values.

Uploaded by

Mayank Aggarwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

Semantic Web (RDF)

RDF is the basic building block for supporting the Semantic Web. RDF describes information contained in web resources using a subject-predicate-object expression where the subject is the resource, the predicate expresses a property of the resource, and the object contains the property value. An RDF document uses XML syntax to express statements about resources in terms of URIs, properties, and property values.

Uploaded by

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

Semantic Web

(RDF)
What is RDF
• A typical Web page in the Semantic • The answer to the second question leads to the concept
Web world looks like the one of RDF (Resource Description Framework); to create a
shown in figure. markup file, one can use RDF language. RDF is the
language which is used to construct these metadata
• Two key questions we will have to files; we therefore realize the importance of RDF.
address are as follows: First, what
is this special file? Second, how is
it created?

• The special file is the Markup


documents that describes some
facts about the underlying Web
page. It defines metadata about the
Web page; it is a metadata file. To
some extent, the Semantic Web is
all about metadata.

Figure: A Web page in the Semantic Web environment.


What is RDF
• RDF is the basic building block for supporting the Semantic Web.

• RDF is to the Semantic Web what HTML has been to the Web.

• RDF is an XML-based language for describing information contained in a Web resource. A Web
resource can be a Web page, an entire Web site, or any item on the Web that contains information in
some form.

• RDF is a language recommended by W3C , and it is all about metadata.

• RDF is capable of describing any fact (resource) independent of any domain.

• RDF provides a basis for coding, exchanging, and reusing structured metadata.

• RDF is structured; i.e., it is machine-understandable. Machines can do useful operations with the
knowledge expressed in RDF.
RDF DATA MODEL: THE BASIC ELEMENTS
OF RDF
• RESOURCE

• PROPERTY

• STATEMENT
RESOURCE

• The first key element is the resource. RDF is a standard for metadata.
• RDF offers a standard way of specifying data about something. This something can be
anything, and in the RDF world we call this something as resource

• A resource is identified by a uniform resource identifier (URI), and this URI is used as the
name of the resource. Why do we have to use a URI as the name of the resource? The
reason is summarized in the following rule:
• Rule #1: The name of a resource must be global. In other words, if you have a doubt that
someone else might also use the same name to refer to something else, then you cannot
use that name.

• The following URI uniquely identifies a resource:


http://www.yuchen.net/photography/SLR#Nikon-D70
RESOURCE

• Here is an example. The following URI uniquely identifies a resource:


http://www.yuchen.net/photography/SLR#Nikon-D70

1. This resource is a real-world object, i.e., a Nikon D70 camera; it is a single lens reflex (SLR)
camera.
2. URL “http://www.yuchen.net/photography/SLR” is used as the first part of the URI. More
precisely, it is used as a namespace to guarantee that the underlying resource is uniquely
identified; this URL may or may not exist.
3. At the end of the namespace, “#” is used as the fragment identifier symbol to separate the
namespace from the local resource name, i.e., Nikon-D70.
4. Now the namespace + “#” + localResourceName gives us the final URI for the resource; it is
globally named.
PROPERTY

• Property is a resource that has a name and can be used as a property; i.e., it can be
used to describe some specific aspect, characteristic, attribute, or relation of the
given resource.

• The following is an example of a property:


http://www.yuchen.net/photography/SLR#weight

• This property describes the weight of the D70 camera

• The property value can be a string literal or a resource


STATEMENT

• An RDF statement is used to describe properties of resources. It has the following format:
• resource(subject) + property(predicate) + property value (object)

• Therefore, in general, an RDF statement indicates that a resource (the subject) is linked to another
resource (the object) via an arc labeled by a relation (the predicate). It can be interpreted as
follows:
<subject> has a property <predicate>, whose value is <object>
STATEMENT
• For example:
http://www.yuchen.net/photography/SLR#Nikon-D70 has a
http://www.yuchen.net/photography/SLR#weight whose value is 1.4 lb.

• This is certainly clear, but the drawback is that it is too long. Let us define the following
namespace:
xmlns:mySLR=http://www.yuchen.net/photography/SLR#

• The statement can be rewritten in a much shorter form:


mySLR:Nikon-D70 has a mySLR:weight whose value is 1.4 lb.

• Rule #2: Knowledge (or information) is expressed as a statement in the form of subject, predicate,
and object, and this order should never be changed.
• TABLE 1 : An RDF Triple Expressed in a Table Format
Subject Predicate Object
mySLR:Nikon-D70 mySLR:weight 1.4 lb

FIGURE: RDF graph model.

TABLE 2 : A Set of RDF Statements


Subject Predicate Object
mySLR:Nikon-D70 mySLR:weight 1.4 lb
mySLR:Nikon-D70 mySLR:pixel 6.1 M
mySLR:Nikon-D50 mySLR:weight 1.3 lb
RDF TRIPLES: KNOWLEDGE THAT MACHINES CAN USE
• Let us assume that we have the following statements (again, use mySLR namespace).
Subject Predicate Object
mySLR:Nikon-D70 mySLR:weight 1.4 lb
mySLR:Nikon-D70 mySLR:pixel 6.1 M
mySLR:Nikon-D50 mySLR:weight 1.3 lb
• Now, let us ask the machine the following question: What properties did we define in order to
describe Nikon D70?
• We can express the question using the following RDF format:
question.subject = mySLR:Nikon-D70
question.predicate = mySLR:*;
• Note that mySLR:* is used as a wild card.

• This code will present the following answer:


mySLR:weight
mySLR:pixel
Pseudocode Used by the Computer to Draw Inferences Based on Table 2

// format my question
question.subject = mySLR:Nikon-D70
question.predicate = mySLR:*;
// read all the RDF statements and store them in some array
rdfStatement[0].subject = mySLR:Nikon-D70;
rdfStatement[0].predicate = mySLR:weight;
rdfStatement[1].subject = mySLR:Nikon-D70;
rdfStatement[1].predicate = mySLR:pixel;
rdfStatement[2].subject = mySLR:Nikon-D50;
rdfStatement[2].predicate = mySLR:weight;

// answer the question!


foreach s in rdfStatement[]
{
if ( (s.subject==question.subject || question.subject=='*') &&
s.predicate==question.predicate || question.predicate =='*') )
{
System.out.println(s.predicate.toString());
}
};
RDF: BASIC SYNTAX AND EXAMPLES
RDF have a small set of vocabulary. RDF vocabulary consists of the following names:

• Syntax names: RDF, Description, ID, about, parseType, resource, nodeID, datatype.

• Class names: Seq, Bag, Alt, Statement, Property, XMLLiteral, List

• Property names: subject, predicate, object, type, value, first, rest_n


RDF Document
• Refer back to our earlier example, “Nikon-D70 has a weight of value 1.4 lb.” This simple document describes a resource
(Nikon-D70 camera) in RDF format.
TABLE 1 : An RDF Triple Expressed in a Table Format
Subject Predicate Object
mySLR:Nikon-D70 mySLR:weight 1.4 lb

• First Example of an RDF Document


1: <?xml version="1.0"?>
2: <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.yuchen.net/photography/Camera#">
3: <SLR rdf:ID="Nikon-D70">
4: <weight>1.4 lbs</weight>
5: </SLR>
6: </rdf:RDF>

• We can interpret this RDF code as : The RDF document describes a resource whose name is Nikon-D70; it is an instance of
the class SLR, and its weight is 1.4 lb.

You might also like