Chapter 7: Resource Description Framework (RDF)
description
Transcript of Chapter 7: Resource Description Framework (RDF)
Chapter 7:Resource Description Framework (RDF)
Service-Oriented Computing: Semantics, Processes, Agents– Munindar P. Singh and Michael N. Huhns, Wiley, 2005
Chapter 7 2Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
RDF RDF stands for Resource Description
Framework Provides a basis for knowledge representation
Supports inferencing Simple language to capture assertions
(statements), which help capture knowledge, e.g., about resources
Combines old Knowledge Representation (KR) ideas (frames, Object-Oriented (OO) modeling) but uses the Web to enhance their range and avoid some longstanding problems
Chapter 7 3Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
RDF RDF is a framework for describing resources on the
web RDF provides a model for data, and a syntax so
that independent parties can exchange and use it RDF is designed to be read and understood by
computers RDF is not designed for being displayed to people RDF is written in XML RDF is a part of the W3C's Semantic Web Activity RDF is a W3C Recommendation
Chapter 7 4Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
RDF - Examples of Use Describing properties for shopping items,
such as price and availability Describing time schedules for web events Describing information about web pages,
such as content, author, created and modified date
Describing content and rating for web pictures
Describing content for search engines Describing electronic libraries
Chapter 7 5Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
Why RDF? XML can present the content but not
meaning. Gives us a document tree Doesn’t identify the content represented by a
document, where content means Concepts the document is about Relationships among them
Enables multiple representations for the same content
RDF expresses the content itself The motivation of RDF is to provide a
language to present semantics of a resource.
Chapter 7 6Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
RDF Rules RDF identifies things using Web identifiers
(URIs), and describes resources with properties and property values.
Explanation of Resource, Property, and Property value:
A Resource is anything that can have a URI, such as "http://www.w3schools.com/RDF"
A Property is a Resource that has a name, such as "author" or "homepage"
A Property value is the value of a Property, such as "Jan Egil Refsnes" or "http://www.w3schools.com" (note that a property value can be another resource)
Chapter 7 7Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
Resources and Literals RDF captures descriptions of resources A resource is an “addressable” object
Of which a description can be given Identified via a URI (Universal Resource Identifier)
A literal is something simpler A value, e.g., string or integer Cannot be given a description
RDF is based on a simple grammar An RDF document is just a set of statements
or triples
Chapter 7 8Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
Statements or Triples Each statement consists of
Subject: a resource Object: a resource or a literal Predicate: a resource, the property of the given triple
Resource examples are entities on the Web such as documents, images, video clips, and services.
RDF properties are two-place predicates. Predicates with two arguments (subject, object) form a statement.
Comes with RDFS, a vocabulary to create vocabularies
W3C's RDF Validation Service is useful when learning RDF. Here you can experiment with RDF files.
The Dublin Core Metadata Initiative (DCMI) has created some predefined properties for describing documents.
Chapter 7 9Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
RDF Statements The combination of a Resource, a Property, and a
Property value forms a Statement (known as the subject, predicate and object of a Statement).
Let's look at some example statements to get a better understanding:
Statement: "The author of http://www.w3schools.com/RDF is Jan Egil Refsnes".
The subject of the statement above is: http://www.w3schools.com/RDF
The predicate is: author The object is: Jan Egil Refsnes
Statement: "The homepage of http://www.w3schools.com/RDF is http://www.w3schools.com".
The subject of the statement above is: http://www.w3schools.com/RDF
The predicate is: homepage The object is: http://www.w3schools.com
Chapter 7 10Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
Example in XML (Using Dublin Core)
<?xml version='1.0' encoding='UTF-8'?><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://www.wiley.com/SOC"> <dc:title>Service-Oriented
Computing</dc:title> <dc:creator>Munindar</dc:creator> <dc:creator>Michael</dc:creator> <dc:publisher>Wiley</dc:publisher> </rdf:Description></rdf:RDF>
rdf:Description gathers statements about one subject
Chapter 7 11Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
RDF Main Elements The <rdf:RDF> element is the root element
of an RDF document. It defines the XML document to be an RDF document.
The <rdf:Description> element identifies a resource with the about attribute.
The property elements can also be defined as attributes.
The property elements can also be defined as resources.
Chapter 7 12Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
RDF Container Elements RDF statements can involve three
components. To allow involving more than 3 components, RDF provides a means to define structured containers of resources.
Containers enable the representation of a relationship where more than one resource may be required to participate.
Function as containers rdf:Bag is an unodered collection. rdf:Sequence is an ordered collection. rdf:Alt (choice) captures a disjoint union.
Accompanied by properties to extract elements
Schematically represented as rdf:li, and so on
Chapter 7 13Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
RDF Container Elements<rdf:Bag ID = "group1"> <rfd:li>One</rdf:li> <rfd:li>Two</rdf:li> <rfd:li>Three</rdf:li></rdf:Bag><rdf:Seq ID = "sequence1"> <rfd:li>First</rdf:li> <rfd:li>Second</rdf:li> <rfd:li>Third</rdf:li></rdf:Seq><rdf:Alt ID = "alt1"> <rfd:li>default choice</rdf:li> <rfd:li>another choice</rdf:li> <rfd:li>yet another choice</rdf:li></rdf:Alt> RDF collections are used to describe groups that contains ONLY
the specified members.
Chapter 7 14Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
Rendering RDF in XML RDF is not about the surface syntax but the
content it captures We will use the XML serialization of RDF
RDF is not tied to XML Standard XML namespace syntax Namespaces defined by the RDF standard
Typically abbreviated rdf and rdfs
Chapter 7 15Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
Example in N-Triples Notation<http://www.wiley.com/SOC> <http://purl.org/dc/elements/1.1/title> "Service-Oriented Computing" .<http://www.wiley.com/SOC> <http://purl.org/dc/elements/1.1/creator> "Munindar" .<http://www.wiley.com/SOC> <http://purl.org/dc/elements/1.1/creator> "Michael" .<http://www.wiley.com/SOC> <http://purl.org/dc/elements/1.1/publisher> "Wiley” .
Could also write individual statements in the XML syntax, but the rdf:Description element simplifies the notation
Chapter 7 16Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
Key Primitives: Reification, Model
To reify a concept is to enable it to be referenced. The process is called reification.
The essential idea behind reification is to covert statements into a resource.
RDF provides an information model based on graphs.
Each edge corresponds to a statement. The label of the edge is a predicate. The source vertex of the edge is a subject.
Chapter 7 17Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
Reification of Statements Reify: to make referenceable, essential for
quoting statements to Agree or disagree with them Assert modalities: possible, desirable, …
Make a statement into a resource; then talk about it
rdf:Statement is the class whose rdf:type the given statement (object) is; additional properties such as rdf:subject, rdf:object, and rdf:predicate
Chapter 7 18Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
Exercise Graphs represent binary relationships
naturally The vendor ships SKU-99
Express a three-party relationship The vendor ships SKU-99 quickly Hint: think of gerunds from natural language
grammar
Chapter 7 19Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
RDF Schema RDF statements can be readily stored in a
relational database or in an object database. Analogous to an object-oriented type system
built on top of RDF. Defines rdfs:Class, rdfs:subClassOf rdfs:Resource, rdfs:Literal rdfs:Property, rdfs:subPropertyOf rdfs:range, rdfs:domain rdfs:label, rdfs:comment, rdfs:seeAlso
Applications of RDF Schema deferred to OWL (Web Ontology Language), which greatly enhances the above
Chapter 7 20Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
RDF Schema<?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#">
<rdfs:Class rdf:ID="animal" /> <rdfs:Class rdf:ID="horse"> <rdfs:subClassOf rdf:resource="#animal"/> </rdfs:Class> </rdf:RDF>
Chapter 7 21Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
RDF Schema versus XML Schema
Both help define custom vocabularies An XML Schema document gives us syntactic details An RDF Schema document gives us meaning An OWL document (next chapter) captures richer
meaning Jena (http://jena.sourceforge.net/) is an open
source RDF and RDFS toolkit.
Chapter 7 22Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and
Michael Huhns
Chapter 7 Summary RDF captures deeper structure than XML
RDF captures graphs in general Meaning depends on the graph, not the
document that represents a graph RDF is based on an simple linguistic
representation: subject, predicate, object But “webified” via URIs
RDF comes with RDF Schema In essence, an object-oriented type system: a
vocabulary to create new vocabularies Used for important vocabularies (FOAF, DC,
Mozilla extensions) Provides a basis for OWL