RDF These slides were built using modified examples
RDF These slides were built using modified examples from “XML How To Program” by Deitel, Nieto, Lin and Sadhu. The slides also make use of material from “XML Bible” by Elliotte Rusty Harold. In what follows, a “resource” might be a web page, an element in a web page, a device, a person and more. Internet Technologies 1
RDF • The Resource Description Framework (RDF) is a W 3 C recommendation for an XML encoding of metadata. • A standard for encoding metadata is important for finding and describing resources. • Card catalogs (with wooden drawers and index cards) have been used for years to record metadata about the collection of materials in the library. An RDF document or element makes statements about resources. A statement can be thought of as an ordered triple composed of three items: (resource, property-type, property-value) Internet Technologies 2
RDF It is required that each resource have a URI. http: //www. andrew. cmu. edu/~mm 6/my. xml#root(). child(1) mailto: mm 6@andrew. cmu. edu urn: isbn: 0764532367 (resource, property-type, property-value) A property is a specific characteristic, attribute or relationship of a resource. Each property has a specific meaning that can be identified by the property’s name and the associated schema. The schema must actually be pointed to by the property’s namespace. The schema describes the values or value ranges that are permitted for the property. Internet Technologies 3
The root element of an RDF document is RDF. <? xml version = "1. 0"? > <!-- Fig. 22. 3 : simple. rdf --> <!-- Simple usage of RDF --> Each property of the resource being described is a child element of the Description element. <rdf: RDF xmlns: rdf = "http: //www. w 3. org/1999/02/22 -rdf-syntax-ns#" xmlns: dc = "http: //purl. org/dc/elements/1. 1/"> Describing a web site <rdf: Description about="http: //www. deitel. com"> <dc: Title>Deitel and Associates, Inc. </dc: Title> <dc: Description> This is the home page of Deitel and Associates, Inc. The content of the child is the value of the </dc: Description> property. <dc: Date>2000 -5 -24</dc: Date> <dc: Format>text/html</dc: Format> <dc: Language>en</dc: Language> <dc: Creator>Deitel and Associates</dc: Creator> </rdf: Description> Namespaces are used to distinguish between RDF elements and elements in property types </rdf: RDF> and values. Internet Technologies 4
The Dublin Core A collection of elements designed to provide a similar structure as that provided by a card catalog. For example, the following are elements defined in the Dublin Core namespace: TITLE The name given to the resource CREATOR The person or organization that created … SUBJECT The topic of the resource… DESCRIPTION… : : In the near future, this Dublin Core “schema” is likely to be encoded with a formal syntax. Perhaps this syntax will be RDF. Internet Technologies 5
<? xml version = "1. 0"? > A single RDF element can contain any number of Description elements. <!-- Fig. 22. 3 : simple. rdf --> <!-- Simple usage of RDF --> <rdf: RDF xmlns: rdf = "http: //www. w 3. org/1999/02/22 -rdf-syntax-ns#" xmlns: dc = "http: //purl. org/dc/elements/1. 1/"> A Description element can state <rdf: Description about="http: //www. deitel. com"> more than one property about <dc: Title>Deitel and Associates, Inc. </dc: Title> a resource. <dc: Description> This is the home page of Deitel and Associates, Inc. </dc: Description> <dc: Date>2000 -5 -24</dc: Date> Some properties may be <dc: Format>text/html</dc: Format> resource valued. For example, <dc: Language>en</dc: Language> suppose Deitel and Associates <dc: Creator>Deitel and Associates</dc: Creator> has an email address… </rdf: Description> </rdf: RDF> Internet Technologies 6
<? xml version = "1. 0"? > <!-- Fig. 22. 3 : simple. rdf --> <!-- Simple usage of RDF --> <rdf: RDF xmlns: rdf = "http: //www. w 3. org/1999/02/22 -rdf-syntax-ns#" xmlns: dc = "http: //purl. org/dc/elements/1. 1/"> <rdf: Description about="http: //www. deitel. com"> <dc: Title>Deitel and Associates, Inc. </dc: Title> The Creator becomes a <dc: Description> resource rather than a This is the home page of literal. This is a resource Deitel and Associates, Inc. valued property. </dc: Description> <dc: Date>2000 -5 -24</dc: Date> <dc: Format>text/html</dc: Format> <dc: Language>en</dc: Language> <dc: Creator> <rdf: Description about = “mailto: webmaster@deitel. com” > <dc: Title>Deitel and Associates</dc: Title> Another way to say the same </rdf: Description> thing is with a resource </dc: Creator> attribute… </rdf: Description> Internet Technologies 7 </rdf: RDF>
<? xml version = "1. 0"? > <!-- Fig. 22. 3 : simple. rdf --> <!-- Simple usage of RDF --> <rdf: RDF xmlns: rdf = "http: //www. w 3. org/1999/02/22 -rdf-syntax-ns#" xmlns: dc = "http: //purl. org/dc/elements/1. 1/"> <rdf: Description about="http: //www. deitel. com"> <dc: Title>Deitel and Associates, Inc. </dc: Title> <dc: Description> This is the home page of Deitel and Associates, Inc. </dc: Description> <dc: Date>2000 -5 -24</dc: Date> <dc: Format>text/html</dc: Format> <dc: Language>en</dc: Language> <dc: Creator rdf: resource = “mailto: webmaster@deitel. com” /> </rdf: Description> <rdf: Description about = “mailto: webmaster@deitel. com” > <dc: Title>Deitel and Associates</dc: Title> </rdf: Description> </rdf: RDF> Internet Technologies 8
RDF Containers An RDF element may describe a resource with multiple properties of the same type. Perhaps a book has several authors or a web page may be found at several sites. RDF defines three types of container objects: Bag – a group of unorderd properties – use li. Seq – a sequence (ordered list) of properties Alt – a list of alternative properties from which to choose a single one Let’s look at a more involved example from Deitel and Deitel… Internet Technologies 9
<? xml version = "1. 0"? > <!-- Fig. 22. 5 : links. rdf --> <!-- Describing entire Web site --> <rdf: RDF xmlns: rdf = "http: //www. w 3. org/1999/02/22 -rdf-syntax-ns#" xmlns: dc = "http: //purl. org/dc/elements/1. 1/"> <rdf: Description about = "www. deitel. com"> <dc: Title>Home page of Deitel products</dc: Title> <dc: Creator>Deitel and Associates, Inc. </dc: Creator> <dc: Subject> <rdf: Bag ID = "links_1"> <rdf: li resource = "http: //www. deitel. com/books/index. htm"/> <rdf: li resource = "http: //www. deitel. com/services/training/index. htm"/> </rdf: Bag> Statements can be made about a container as a whole and so we give the container an ID. Internet Technologies 10
<rdf: Bag ID = "links_2"> <rdf: li resource ="http: //www. deitel. com/announcements/contractors. htm"/> <rdf: li resource ="http: //www. deitel. com/announcements/internships. htm"/> </rdf: Bag> <rdf: Seq ID = "links_3"> <rdf: li resource = "http: //www. deitel. com/intro. htm"/> <rdf: li resource = "http: //www. deitel. com/directions. htm"/> </rdf: Seq> </dc: Subject> </rdf: Description> <!-- description of the common feature of the Bag links_1 --> <rdf: Description about. Each = "#links_1"> <dc: Description>About our Products</dc: Description> </rdf: Description> The about. Each attribute applies to each element in the container. Internet Technologies 11
<rdf: Description about. Each = "#links_2"> <dc: Description> Announcements, Oppurtunities and internships at Deitel Associates </dc: Description> </rdf: Description> <rdf: Description about. Each = "#links_3"> <dc: Description>All about us</dc: Description> </rdf: Description> <!-- further description of each link --> <rdf: Description about = "http: //www. deitel. com/books/index. htm"> <!-- description of page title --> <rdf: Title> Books, Multimedia Cyber Classrooms and Complete Training Courses </rdf: Title> </rdf: Description> <rdf: Description about = "http: //www. deitel. com/services/training/index. htm"> <rdf: Title>Corporate Training Courses</rdf: Title> </rdf: Description> Internet Technologies 12
<rdf: Description about = "http: //www. deitel. com/announcements/contractors. htm"> <rdf: Title>Looking for Training Contractors</rdf: Title> </rdf: Description> <rdf: Description about = "http: //www. deitel. com/announcements/internships. htm"> <rdf: Title> Internships at Deitel and Associates, Inc. </rdf: Title> </rdf: Description> <rdf: Description about = "http: //www. deitel. com/intro. htm"> <rdf: Title> Introduction to Deitel and Associates, Inc. </rdf: Title> </rdf: Description> <rdf: Description about = "http: //www. deitel. com/directions. htm"> <rdf: Title>Our location and how to get there</rdf: Title> </rdf: Description> </rdf: RDF> Internet Technologies 13
The Semantic Web These notes are from an article entitled “The Semantic Web” by Tim Berners-Lee, James Hendler and Ora Lassila appearing in Scientific American, May 2001 By augmenting web pages with data directed at computers and by adding documents solely for computers, we will transform the web into the Semantic Web. Intuitive software will be developed that will allow anyone to create Semantic Web Pages. For the semantic web to function, computers must have access to structured collections of information and sets of inference rules that can be used to conduct automated reasoning. XML has no built-in mechanism to convey the meaning of the user’s new tags to other users. Internet Technologies 14
The Semantic Web The challenge of the Semantic Web is to provide a language that expresses both data and rules for reasoning about the data and that allows rules from an existing knowledge-representation system to be exported unto the Web. Ontologies: Collections of statements written in a language such as RDF that define the relations between concepts and specify logical rules for reasoning about them. Computers will “understand” the meaning of semantic data on a web page by following links to specified ontologies. Consider the statement “a hex-head bolt is a type of machine bolt”. We could encode this in RDF. When writing code against traditional XML data, the programmer must know what the document author uses each tag for. Meaning is expressed by RDF, which encodes it in a set of triples. Internet Technologies 15
The Semantic Web An RDF document makes assertions that particular things (people, web pages, or whatever) have properties (such as “is sister of”, “is the author of”) with certain values (another person, another Web page). We can remove ambiguity by associating each of the three parts with a URI. For example: “(filed 5 in database A) (is a field of type) (zip code)” could be replaced with three URI’s. An ontology is a document or file that formally defines the relations among terms. An ontology may express a rule “If a city code is associated with a state code, and an address uses that city code, then that address has the associated state code. ” A program can then draw conclusions. The meaning of terms or XML codes can be defined by pointers from the page to an ontology. Internet Technologies 16
The Semantic Web Many automated web based services already exist without semantics, but other programs such as agents have no way to locate one that will perform a specific function. Service Discovery will happen only when there is a common language to describe a service in a way that lets other agents “understand” both the function offered and how to take advantage of it. Services can advertise their functions in directories analogous to the Yellow Pages. Devices can advertise their abilities with RDF in the form of CC/PP… Internet Technologies 17
What is CC/PP? A composite capability/preference profile is a collection of information which describes the capabilities, hardware, system software and applications used by someone accessing the web. Information might include: • Preferred language (Spanish, French, etc. ) • Sound (on/off) • Images (on/off) • Class of device (phone, PC, printer, etc. ) • Screen size • Available bandwidth • Version of HTML supported, and so on. Internet Technologies 18
Composite Capability/Preference Profiles (CC/PP) DEVICE PROFILE CC/PP RDF XML CC/PP provides the equivalent of database fields and associated model formalizing the device profiles RDF is language which provides a standard way for using XML to represent metadata in the form of properties and relationships of items on the Web. The device profile and user preferences might be stored in a CC/PP repository. CC/PP is in turn an RDF application. Internet Technologies 19
Composite Capability/Preference Profiles (CC/PP) An example: • The location of the device profile is sent with a request for a Web page. • The CC/PP data is accessed and on the basis of the profile, a Web server can choose the right content. This might be a certain XHTML file or perhaps a suitable document would be generated on the fly. • A document on the server may refer to its own document profile-describing the required capabilities of its client. • The server might match and send or generate and send. Internet Technologies 20
Each variant of the document has a document profile describing the browser support it needs to display it DEVICE PROFILES DOCUMENT PROFILES NEGOTIATE CORRECT CONTENT FOR DEVICES If none of the document variants are suitable, existing document may be transformed by style sheet or tool for the purpose, or new document generated DEVICES RECEIVE RIGHT MARK-UP Internet Technologies 21
Composite Capability/Preference Profiles (CC/PP) The CC/PP working group was formed in August 1999. Its mission is to develop an RDF-based framework for the management of device profile information. Internet Technologies 22
More on RDF The resource description framework is a proposal for representing metadata in XML. Its intended applications include: • • • Providing better search engine capabilities in resource discovery Cataloguing for describing the content and content relationships available at a particular Web site Allowing software agents to share and exchange data The RDF data model is that of a directed edge labeled graph. Nodes are called resources and edge labels are called properties. RDF’s syntax is a convention for representing this model in XML. Internet Technologies 23
person name email age Alan 42 <rdf: description ID=“ 001”> <person> <rdf. description ID=“ 002”> <name>Alan</name> <age>42</age> <email>agb@abc. com</email> </rdf. description> </person> </rdf: description> agb@abc. com This element describes a resource. We are describing two resources in this document with unique ID’s. An edge in RDF is called a statement. Four statements have been made. 1) resource 001 has property person whose value is resource 002. 2) resource 002 has property name with value Alan. 3) resource 002 has property age with value 42. 4) resource 002 has property email with value agb@abc. com. Internet Technologies 24
What is a Resource? A resource can be anything that can have a Uniform Resource Identifier(URI). URIs are a superset of the more common Uniform Resource Locator (URLs), but They can also identify books, elements on a page, television shows, individual People, and more. Thus a resource might be An entire web site (http: //www. cmu. edu) A single web page (http: //www. andrew. cmu. edu/~mm 6/index. html) A specific HTML or XML element on a web page (identified with Xpointer) A book (urn: isbn: 0764532367) A person(mailto: mm 6@andrew. cmu. edu) Internet Technologies 25
The RDF Data Model • RDF provides a model for describing resources • Resources have properties (attributes or characteristics). • RDF defines a resource as any object that is uniquely identifiable by a Uniform Resource Identifier (URI). • The properties associated with resources are identified by property-types. • Property-types have corresponding values. • Property-types express the relationships of values associated with resources. • Values may be atomic in nature (text strings, numbers, etc. ) or other resources. • A collection of properties that refer to the same resource is called a description. Internet Technologies 26
RDF Description Resource 1 Property. Type 2 Resource 2 Property. Type 3 Resource 3 Property. Type 4 “Atomic Value” Internet Technologies 27
Consider the following statements: 1. “The author of Document 1 is John Smith” 2. “John Smith is the author of Document 1” To humans, these statements convey the same meaning (that is, John Smith is the author of a particular document). To a machine, however, these are completely different strings. Whereas humans are extremely adept at extracting meaning from differing syntactic constructs, machines remain grossly inept. Using a triadic model of resources, property-types and corresponding values, RDF attempts to provide an unambiguous method of expressing semantics in a machine-readable encoding. Internet Technologies 28
Resource Property Value Document 1 Author “John Smith” Internet Technologies 29
Resource Property Value Document 1 Author_001 Affiliation Each resource must have a unique identifier. Perhaps we want to keep information about the author. Email Name “Home, Inc. ” “smith@home. com” “John Smith” Internet Technologies 30
An example RDF document (DC is the Dublin Core namespace) Description keyword meaning resource <? xml: namespace ns = “http: //www. w 3. org/RDF/” prefix=“RDF” ? > <? xml: namespace ns = “http: //purl. oclc. org/DC/” prefix = “DC” ? > <RDF: RDF> <RDF: Description RDF: HREF = “http: //uri-od-Document-1”> <DC: Creator>John Smith</DC: Creator> </RDF: Description> </RDF: RDF> A property value A property type Internet Technologies 31
RDF’s data model extends the graph model in several ways: 1) It has containers which can be bags (sets with duplicates) or sequences (lists). 2) It extends the model with higher order statements. The RDF syntax provides the author with the ability to say things like: John says that the email of resources 002 is agb@abc. com. Here the resource is John, the property is “says”, and its value is another statement or The Library of Congress says resource X is authoritative. Internet Technologies 32
- Slides: 32