220 likes | 320 Views
Learn about RDF, a framework for describing web resources, enabling data exchange among independent parties in a machine-readable format. Understand how RDF captures semantics, processes, and agents in service-oriented computing.
E N D
Chapter 7:Resource Description Framework (RDF) Service-Oriented Computing: Semantics, Processes, Agents– Munindar P. Singh and Michael N. Huhns, Wiley, 2005
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 Service-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 Service-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 Service-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. Service-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) Service-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 Service-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 Serviceis 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. Service-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 EgilRefsnes". • The subject of the statement above is: http://www.w3schools.com/RDF • The predicate is: author • The object is: Jan EgilRefsnes • 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 Service-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 Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and Michael Huhns
RDF Main Elements • The <rdf:RDF> elementis 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. Service-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 Service-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. Service-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 Service-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 Service-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. Service-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 Service-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 Service-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 Service-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> Service-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. Service-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 Service-Oriented Computing: Semantics, Processes, Agents - Munindar Singh and Michael Huhns