Presentation is loading. Please wait.

Presentation is loading. Please wait.

Internet Technologies1 RDF Bibliography: “XML How To Program” by Deitel, Deitel, Nieto, Lin and Sadhu. “XML Bible” by Elliotte Rusty Harold. HP’s Jena.

Similar presentations


Presentation on theme: "Internet Technologies1 RDF Bibliography: “XML How To Program” by Deitel, Deitel, Nieto, Lin and Sadhu. “XML Bible” by Elliotte Rusty Harold. HP’s Jena."— Presentation transcript:

1 Internet Technologies1 RDF Bibliography: “XML How To Program” by Deitel, Deitel, Nieto, Lin and Sadhu. “XML Bible” by Elliotte Rusty Harold. HP’s Jena Tutorial. The Resource Description Framework

2 Internet Technologies2 Some notes on RDF The Resource Description Framework (RDF) is a W3C recommendation for an XML encoding of metadata. A standard for encoding metadata is important for finding and describing resources. A “resource” is anything with a URI. This would include people, books, devices and so on. Card catalogs, for example, have been used for years to record metadata about the collection of materials in libraries. Is Google the card catalogue for the web? Are we done? All OWL documents are RDF documents. All RDF documents are OWL Full documents.

3 Internet Technologies3 Some Notes On RDF(2) 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)

4 Internet Technologies4 Some Notes on RDF(3) (resource, property-type, property-value) It is required that each resource have a URI. http://www.andrew.cmu.edu http://www.andrew.cmu.edu/~mm6/my.xml#root().child(1) mailto:mm6@andrew.cmu.edu urn:isbn:0764532367 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.

5 Internet Technologies5 <rdf:RDF xmlns:rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc = "http://purl.org/dc/elements/1.1/"> Deitel and Associates, Inc. This is the home page of Deitel and Associates, Inc. 2000-5-24 text/html en Deitel and Associates The root element of an RDF document is RDF. Each property of the resource being described is a child element of the Description element. The content of the child is the value of the property. Namespaces are used to distinguish between RDF elements and elements in property types and values. Describing a web site

6 Internet Technologies6 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… :

7 Internet Technologies7 <rdf:RDF xmlns:rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc = "http://purl.org/dc/elements/1.1/"> Deitel and Associates, Inc. This is the home page of Deitel and Associates, Inc. 2000-5-24 text/html en Deitel and Associates A single RDF element can contain any number of Description elements. A Description element can state more than one property about a resource. Some properties may be resource valued. For example, suppose Deitel and Associates has an email address…

8 Internet Technologies8 <rdf:RDF xmlns:rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc = "http://purl.org/dc/elements/1.1/"> Deitel and Associates, Inc. This is the home page of Deitel and Associates, Inc. 2000-5-24 text/html en Deitel and Associates The Creator becomes a resource rather than a literal. This is a resource valued property. Another way to say the same thing is with a resource attribute…

9 Internet Technologies9 <rdf:RDF xmlns:rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc = "http://purl.org/dc/elements/1.1/"> Deitel and Associates, Inc. This is the home page of Deitel and Associates, Inc. 2000-5-24 text/html en Deitel and Associates

10 Internet Technologies10 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…

11 Internet Technologies11 <rdf:RDF xmlns:rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc = "http://purl.org/dc/elements/1.1/"> Home page of Deitel products Deitel and Associates, Inc. Statements can be made about a container as a whole and so we give the container an ID.

12 Internet Technologies12 About our Products The aboutEach attribute applies to each element in the container.

13 Internet Technologies13 Announcements, Oppurtunities and internships at Deitel Associates All about us Books, Multimedia Cyber Classrooms and Complete Training Courses <rdf:Description about = "http://www.deitel.com/services/training/index.htm"> Corporate Training Courses

14 Internet Technologies14 <rdf:Description about = "http://www.deitel.com/announcements/contractors.htm"> Looking for Training Contractors <rdf:Description about = "http://www.deitel.com/announcements/internships.htm"> Internships at Deitel and Associates, Inc. Introduction to Deitel and Associates, Inc. Our location and how to get there

15 Internet Technologies15 An RDF Application 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.

16 Internet Technologies16 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. An RDF Application CC/PP

17 Internet Technologies17 Composite Capability/Preference Profiles (CC/PP) DEVICE PROFILE CC/PP RDF XML CC/PP provides the equivalent of database fields and associated model for 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.

18 Internet Technologies18 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. Composite Capability/Preference Profiles (CC/PP)

19 Internet Technologies19 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

20 Internet Technologies20 More Notes on RDF 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.

21 Internet Technologies21 person name age email Alan 42 agb@abc.com This element describes a resource. We are describing two resources in this document with unique ID’s. Alan 42 agb@abc.com 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.

22 Internet Technologies22 Resource 1 Resource 2 Resource 3 PropertyType1 PropertyType3 PropertyType 2PropertyType 4 “Atomic Value” RDF Data Model

23 Internet Technologies23 Document 1 Author Resource /Property /Value Author_001 Affiliation Name Email “Home, Inc.” “John Smith” “smith@home.com”

24 Internet Technologies24 Processing RDF in Java DOM? SAX? Jena from HP Research provides another approach

25 Internet Technologies25 Jena Example 1 // Modified from HP's Jena Tutorial import com.hp.hpl.jena.rdf.model.*; import com.hp.hpl.jena.vocabulary.*; public class Tutorial01 extends Object { // some definitions static String personURI = "http://somewhere/JohnSmith"; static String fullName = "John Smith";

26 Internet Technologies26 public static void main (String args[]) { // create an empty model (An empty RDF graph) Model model = ModelFactory.createDefaultModel(); // create the resource Resource johnSmith = model.createResource(personURI); // add the property johnSmith.addProperty(VCARD.FN, fullName); model.write(System.out); }

27 Internet Technologies27 D:\McCarthy\www\95-733\examples\Jena>java Tutorial01 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#" > John Smith

28 Internet Technologies28 A Resource Valued Predicate // Modified from HP's Jena Tutorial import com.hp.hpl.jena.rdf.model.*; import com.hp.hpl.jena.vocabulary.*; public class Tutorial03 extends Object { public static void main (String args[]) { String personURI = "http://somewhere/JohnSmith"; String givenName = "John"; String familyName = "Smith"; String fullName = givenName + " " + familyName; // create an empty model Model model = ModelFactory.createDefaultModel();

29 Internet Technologies29 // create the resource // and add the properties cascading style Resource johnSmith = model.createResource(personURI).addProperty(VCARD.FN, fullName).addProperty(VCARD.N, model.createResource().addProperty(VCARD.Given, givenName).addProperty(VCARD.Family, familyName));

30 Internet Technologies30 // list the statements in the graph StmtIterator iter = model.listStatements(); // print out the predicate, subject and object of each statement while (iter.hasNext()) { Statement stmt = iter.nextStatement(); // get next statement Resource subject = stmt.getSubject(); // get the subject Property predicate = stmt.getPredicate(); // get the predicate RDFNode object = stmt.getObject(); // get the object System.out.print(subject.toString()); System.out.print(" " + predicate.toString() + " ");

31 Internet Technologies31 if (object instanceof Resource) { System.out.print(object.toString()); } else { // object is a literal System.out.print(" \"" + object.toString() + "\""); } System.out.println("."); } // end while System.out.println("==================="); model.write(System.out); }

32 Internet Technologies32 D:\McCarthy\www\95-733\examples\Jena>java Tutorial03 16fa474:fd074695f6:-8000 http://www.w3.org/2001/vcard-rdf/3.0#Given "John". http://somewhere/JohnSmith http://www.w3.org/2001/vcard-rdf/3.0#FN "John Smith". 16fa474:fd074695f6:-8000 http://www.w3.org/2001/vcard-rdf/3.0#Family "Smith". http://somewhere/JohnSmith http://www.w3.org/2001/vcard-rdf/3.0#N 16fa474:fd074695f6:-8000. =================== <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#" > John Smith John Smith

33 Internet Technologies33 Reading OWL with Jena import com.hp.hpl.jena.rdf.model.*; import com.hp.hpl.jena.ontology.*; import java.io.*; import java.net.*; public class ReadWineOntology extends Object { public static void main (String args[]) throws Exception { // create an empty model OntModel model = ModelFactory.createOntologyModel();

34 Internet Technologies34 // read the wine.xml file either way model.read("file:D:/McCarthy/www/95-733/examples/Jena/wine.xml"); //model.read("http://www.andrew.cmu.edu/user/mm6/ontology/wine.xml"); // write it to standard out model.write(System.out); } The next step is to use Jena to make or verify deductions.

35 Internet Technologies35 The Semantic Web 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. 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

36 Internet Technologies36 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 the document author uses each tag for. Meaning is expressed by RDF, which encodes it in a set of triples.

37 Internet Technologies37 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.

38 Internet Technologies38 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.


Download ppt "Internet Technologies1 RDF Bibliography: “XML How To Program” by Deitel, Deitel, Nieto, Lin and Sadhu. “XML Bible” by Elliotte Rusty Harold. HP’s Jena."

Similar presentations


Ads by Google