95-733 Internet Technologies 1 Master of Information System Management Internet Technologies The...
-
date post
21-Dec-2015 -
Category
Documents
-
view
213 -
download
0
Transcript of 95-733 Internet Technologies 1 Master of Information System Management Internet Technologies The...
195-733 Internet Technologies
Master of Information System Management
Internet Technologies
The Resource Description Framework (RDF)
295-733 Internet Technologies
Master of Information System Management
• 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?
RDF
395-733 Internet Technologies
Master of Information System Management
RDF Is All About Making Statements
• An RDF Document contains Statements.
• A statement can be thought of as an ordered triple composed of three items: (resource, property-type, property-value)
• A Resource is anything that can be identified.
• A Predicate is a property name that has a URI. The Predicate may or may not actually be resolvable.
• A Value is another Resource or a literal
• Statements may be represented in RDF XML, abbreviated RDF XML, N-Triples or graphs.
495-733 Internet Technologies
Master of Information System Management
RDF Triples
(resource, property-type, property-value)
It is required that each resource have a URI.
http://www.andrew.cmu.eduhttp://www.andrew.cmu.edu/~mm6/my.xml#root().child(1)mailto:[email protected]:isbn:0764532367
A property is a specific characteristic, attributeor relationship of a resource. Each property has a specific meaningthat can be identified by the property’s name and the associated schema. The schema must actually be pointed to by the property’s namespace.
Using RDF Schema we can describe the property names, values and value ranges that are permitted for the property.
595-733 Internet Technologies
Master of Information System Management
A Simple Description
<RDF> <Description about = "Some URI"> <creator>property value </creator> <title>property value </title> </Description></RDF>
695-733 Internet Technologies
Master of Information System Management
Resource Valued Property<RDF> <Description about = "Some URI"> <creator rdf:resource = "www.andrew.cmu.edu/~mm6"/> </Description>
<Description about = "www.andrew.cmu.edu/~mm6"> <FN>Mike McCarthy</FN> </Description></RDF>
795-733 Internet Technologies
Master of Information System Management
Making Many Statements<RDF> <Description about = "Some URI"> <creator>property value</creator> <title>property value</title> </Description>
<Description about = "Some URI"> <creator>property value</creator> <title>property value</title> </Description> : :</RDF>
895-733 Internet Technologies
Master of Information System Management
Blank Nodes<RDF> <Description about = "Some URI"> <creator> <Description> <FN>Joe Smith</FN> <EMAIL>[email protected]</EMAIL> </Description> </creator> </Description></RDF>
995-733 Internet Technologies
Master of Information System Management
XML Valued Property
<RDF> <Description about = "Some URI"> <generates rdf:parseType="Literal"> <html><body></body></html> </generates> </Description></RDF>
1095-733 Internet Technologies
Master of Information System Management
A Type Property<RDF> <Description about = ”SomeURL"> <rdf:type rdf:resource= "http://www.schemas.org/www/WebPage"/> </Description></RDF>
1195-733 Internet Technologies
Master of Information System Management
An Abbreviated Type Property
<RDF> <TypeName about = "Some URI"> <creator>property value </creator> <title>property value</title> </TypeName></RDF>
1295-733 Internet Technologies
Master of Information System Management
Bag Valued Properties<Description about = "Some URI"> <creator> <Bag> <li>value</li> <li>value</li> </Bag> </creator> <title>property value</title> <type>The resource is of this type</type> </Description>
1395-733 Internet Technologies
Master of Information System Management
Sequence Valued Properties
<Description about = "Some URI"> <creator> <Seq> <li>value</li> <li>value</li> </Seq> </creator> <title>property value</title> <type>The resource is of this type</type> </Description>
1495-733 Internet Technologies
Master of Information System Management
Alternative Valued Properties
<Description about = "Some URI"> <creator> <Alt> <li>value</li> <li>value</li> </Alt> </creator> <title>property value</title> <type>The resource is of this type</type> </Description>
1595-733 Internet Technologies
Master of Information System Management
RDF Notations
• English • RDF XML
• Abbreviated RDF XML
• N-Triples
• Graph
1695-733 Internet Technologies
Master of Information System Management
An Example Document
• Represented in RDF/XML• Describe a web site• From Deitel and Deitel
1795-733 Internet Technologies
Master of Information System Management
<?xml version = "1.0"?>
<!-- Fig. 22.3 : simple.rdf --><!-- Simple usage of RDF -->
<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 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>Deitel and Associates</dc:Creator> </rdf:Description>
</rdf:RDF>
The root element of an RDF document is RDF.
Each property of the resource being describedis a child element of the Description element.
The content of the child is the value of theproperty.
Namespaces are used to distinguish betweenRDF elements and elements in property typesand values.
Describinga web site
1895-733 Internet Technologies
Master of Information System Management
The Dublin Core
A collection of property elements designed to provide a similar structure as thatprovided by a card catalog. For example, the following are elements definedin the Dublin Core namespace:
TITLE The name given to the resourceCREATOR The person or organization that created …SUBJECT The topic of the resource…DESCRIPTION…::
1995-733 Internet Technologies
Master of Information System Management
<?xml version = "1.0"?>
<!-- Fig. 22.3 : simple.rdf --><!-- Simple usage of RDF -->
<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 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>Deitel and Associates</dc:Creator> </rdf:Description>
</rdf:RDF>
A single RDF element can containany number of Description elements.
A Description element can statemore than one property abouta resource.
Some properties may be resource valued. For example,suppose Deitel and Associates has an email address…
2095-733 Internet Technologies
Master of Information System Management
<?xml version = "1.0"?>
<!-- Fig. 22.3 : simple.rdf --><!-- Simple usage of RDF -->
<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 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:Description about = “mailto:[email protected]” > <dc:Title>Deitel and Associates</dc:Title> </rdf:Description> </dc:Creator> </rdf:Description></rdf:RDF>
The Creator becomes a resource rather than a literal. This is a resourcevalued property.
Another way to say the samething is with a resourceattribute…
2195-733 Internet Technologies
Master of Information System Management
<?xml version = "1.0"?>
<!-- Fig. 22.3 : simple.rdf --><!-- Simple usage of RDF -->
<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 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:[email protected]” /> </rdf:Description> <rdf:Description about = “mailto:[email protected]” > <dc:Title>Deitel and Associates</dc:Title> </rdf:Description> </rdf:RDF>
2295-733 Internet Technologies
Master of Information System Management
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 propertiesAlt – a list of alternative properties from which to choose a single one
Let’s look at a more involved example from Deitel and Deitel…
2395-733 Internet Technologies
Master of Information System Management
<?xml version = "1.0"?>
<!-- Fig. 22.5 : links.rdf --><!-- Describing entire Web site -->
<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 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 givethe container an ID.
2495-733 Internet Technologies
Master of Information System Management
<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 aboutEach = "#links_1"> <dc:Description>About our Products</dc:Description></rdf:Description>
The aboutEach attributeapplies to each element in thecontainer.
2595-733 Internet Technologies
Master of Information System Management
<rdf:Description aboutEach = "#links_2"> <dc:Description> Announcements, Oppurtunities and internships at Deitel Associates </dc:Description></rdf:Description>
<rdf:Description aboutEach = "#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>
2695-733 Internet Technologies
Master of Information System Management
<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>
2795-733 Internet Technologies
Master of Information System Management
An RDF Application Composite Capabilities/Preference Profiles
• The CC/PP working group was formed in August 1999.
• Its mission was to develop an RDF-based framework for the management of device profile information. • Now under W3C’s Ubiquitous Web Applications Working Group (UWAWG)
2895-733 Internet Technologies
Master of Information System Management
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 mightinclude:
• 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
2995-733 Internet Technologies
Master of Information System Management
Composite Capability/Preference Profiles (CC/PP)DEVICE PROFILE
CC/PP
RDF
XML
CC/PP provides the equivalentof database fields and associatedmodel for formalizing the device profiles
RDF is language which providesa standard way for using XML torepresent metadata in the form ofproperties and relationships ofitems on the Web.
The device profile and user preferences might be stored in aCC/PP repository. CC/PP is in turn an RDF application.
3095-733 Internet Technologies
Master of Information System Management
• 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)
3195-733 Internet Technologies
Master of Information System Management
Each variant of the document has adocument profile describing the browsersupport it needs to display it
DEVICE PROFILESDOCUMENT PROFILES
NEGOTIATE CORRECTCONTENT FOR DEVICES
If none of the document variants are suitable,existing document may be transformed by stylesheet or tool for the purpose, or new documentgenerated
DEVICES RECEIVE RIGHT MARK-UP
3295-733 Internet Technologies
Master of Information System Management
Processing RDF in Java
• DOM?• SAX?• StAX?• Open source Jena from HP
Research provides another approach
3395-733 Internet Technologies
Master of Information System Management
Jena Example 1
// Modified from HP's Jena Tutorial// ~/mm6/www/95-733/examples/Jena
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";
3495-733 Internet Technologies
Master of Information System Management
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);
}
}
3595-733 Internet Technologies
Master of Information System Management
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#" > <rdf:Description rdf:about="http://somewhere/JohnSmith"> <vcard:FN>John Smith</vcard:FN> </rdf:Description>
</rdf:RDF>
3695-733 Internet Technologies
Master of Information System Management
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();
3795-733 Internet Technologies
Master of Information System Management
// 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));
3895-733 Internet Technologies
Master of Information System Management
// 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() + " ");
3995-733 Internet Technologies
Master of Information System Management
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); }}
4095-733 Internet Technologies
Master of Information System Management
D:\McCarthy\www\95-733\examples\Jena>java Tutorial0316fa474: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#" > <rdf:Description rdf:nodeID="A0"> <vcard:Given>John</vcard:Given> <vcard:Family>Smith</vcard:Family> </rdf:Description> <rdf:Description rdf:about="http://somewhere/JohnSmith"> <vcard:FN>John Smith</vcard:FN> <vcard:N rdf:nodeID="A0"/> </rdf:Description></rdf:RDF>
Notes:16fa… is a blanknode with familyand given properties.The main resource hasa blank node as the value of the N property.The main resource alsohas a FN property witha value.
4195-733 Internet Technologies
Master of Information System Management
Reading OWL with Jenaimport 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();
4295-733 Internet Technologies
Master of Information System Management
// 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.
4395-733 Internet Technologies
Master of Information System Management
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 collectionsof 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 otherusers.
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
4495-733 Internet Technologies
Master of Information System Management
The Semantic Web
The challenge of the Semantic Web is to provide a language that expresses bothdata 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 definethe relations between concepts and specify logical rules for reasoning about them.
Computers will “understand” the meaning of semantic data on a web page byfollowing links to specified ontologies.
Consider the statement “a hex-head bolt is a type of machine bolt”. We could encode thisin RDF.
When writing code against traditional XML data, the programmer must know what thethe document author uses each tag for.
Meaning is expressed by RDF, which encodes it in a set of triples.
4595-733 Internet Technologies
Master of Information System Management
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. Forexample:
“(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, andan 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 toan ontology.
4695-733 Internet Technologies
Master of Information System Management
The Semantic Web
Many automated web based services already exist without semantics, but other programssuch 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 aservice 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.