RDF - PowerPoint PPT Presentation

Loading...

PPT – RDF PowerPoint presentation | free to download - id: 604768-YjNhO



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

RDF

Description:

Internet Technologies The Semantic Web and The Resource Description Framework (RDF and RDFa) 95-733 Internet Technologies ... – PowerPoint PPT presentation

Number of Views:63
Avg rating:3.0/5.0
Slides: 80
Provided by: MichaelM219
Category:
Tags: rdf | barbecue

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: RDF


1

Internet Technologies
The Semantic Web and The Resource Description
Framework (RDF and RDFa)
2
RDF and RDFa
  • Notes from three articles on course schedule
    What is RDF by Tim Bray and Joshua Tauberer,
    the RDFa Primer from W3C and from Googles
    adoption of RDFa and Microformats.

3
First Lets get some RDF
  • curl --include --location header
    "Acceptapplication/rdfxml" http//dbpedia.org/re
    source/Yukihiro_Matsumoto
  • Can we learn anything from the result?
  • Is there any other data we can learn from?

4
Each of these stores many many RDF
triples.
See www.linkeddata.org
5
So, whats a triple?
  • A triple is a statement in some RDF format.
  • The next slides shows how we can combine some
    triples into
  • Knowledge Graph.

6
A Knowledge Graph
7
Triples
Start Node Edge Label End
Node vincent_donofrio starred_in
law__order_ci law__order_ci is_a
tv_show the_thirteenth_floor similar_plot_as
the_matrix
8
Notation 3 (N3) or Turtle Format
  • _at_prefix rdf lthttp//www.w3.org/1999/02/22-rdf-syn
    tax-nsgt .
  • _at_prefix ex lthttp//www.example.org/gt .
  • exvincent_donofrio exstarred_in
    exlaw_and_order_ci .
  • exlaw_and_order_ci rdftype extv_show .
  • exthe_thirteenth_floor exsimilar_plot_as
    exthe_matrix .

9
RDF/XML
  • ltrdfRDF xmlnsrdf"http//www.w3.org/1999/02/22-r
    df-syntax-ns"
  • xmlnsex"http//www.example.org/"gt
  • ltrdfDescription rdfabout"http//www.example
    .org/vincent_donofrio"gt
  • ltexstarred_ingt
  • ltextv_show rdfabout"http//www.exam
    ple.org/law_and_order_ci" /gt
  • lt/exstarred_ingt
  • lt/rdfDescriptiongt
  • ltrdfDescription rdfabout"http//www.example
    .org/the_thirteenth_floor"gt
  • ltexsimilar_plot_as rdfresource"http//w
    ww.example.org/the_matrix" /gt
  • lt/rdfDescriptiongt
  • lt/rdfRDFgt

10
Another RDF/XML
  • ltrdfRDF xmlnsrdf"http//www.w3.org/1999/02/22-r
    df-syntax-ns"
  • xmlnsdc"http//purl.org/dc/elements/1.1/"
  • xmlnsgeo"http//www. w3.org/2003/01/geo/wgs8
    4_pos"
  • xmlnsedu"http//www.example.org/"gt
  • ltrdfDescription rdfabout"http//www.princet
    on.edu"gt
  • ltgeolatgt40.35lt/geolatgt
  • ltgeolonggt-74.66lt/geolonggt
  • lteduhasDept rdfresource"http//www.cs.p
    rinceton.edu"
  • dctitle"Department of Computer
    Science"/gt
  • lt/rdfDescriptiongt
  • lt/rdfRDFgt

11
As A Table
  • Subject Predicate Object
  • ----------------------------- -----------
    --------
  • lthttp//www.princeton.edugt eduhasDept
    lthttp//www.cs.princeton.edugt
  • lthttp//www.princeton.edugt geolat
    "40.35"
  • lthttp//www.princeton.edugt geolong
    "-74.66"
  • lthttp//www.cs.princeton.edugt dctitle
    "Department of Computer Science"

12
Notation 3
  • _at_prefix rdf lthttp//www.w3.org/1999/02/22-rdf-syn
    tax-nsgt .
  • _at_prefix dc lthttp//purl.org/dc/elements/1.1/gt .
  • _at_prefix geo lthttp//www. w3.org/2003/01/geo/wgs84
    _posgt .
  • _at_prefix edu lthttp//www.example.org/gt .
  • lthttp//www.princeton.edugt geolat "40.35"
    geolong "-74.66" .
  • lthttp//www.cs.princeton.edugt dctitle
    "Department of Computer Science" .
  • lthttp//www.princeton.edugt eduhasDept
    lthttp//www.cs.princeton.edugt .

13
RDFa and RDF
  • RDFa is a lightweight version of RDF for web
    pages.
  • RDF stands on its own.
  • Well first look at RDFa and then RDF.
  • RDFa is being used today by search engines like
    Google and
  • sites like Best Buy.

14
From the RDFa W3C Primer
When web data meant for humans is augmented with
hints meant for computer programs, these programs
become significantly more helpful.
15
XHTML Without and With RDFa
  • All content on this site is licensed under
  • lta href"http//creativecommons.org/licenses/by/3.
    0/"gt
  • a Creative Commons License
  • lt/agt
  • All content on this site is licensed under
  • lta rel"license" href"http//creativecommons.org/
    licenses/by/3.0/"gt
  • a Creative Commons License
  • lt/agt.

The rel, in a link, describes the relationship
between the current page and the linked page.
16
A Link with a Flavor
17
Labeling Title and Author
ltdivgt lth2gtThe trouble with Boblt/h2gt
lth3gtAlicelt/h3gt ... lt/divgt ltdiv
xmlnsdc"http//purl.org/dc/elements/1.1/"gt
lth2 property"dctitle"gtThe trouble with
Boblt/h2gt lth3 property"dccreator"gtAlicelt/h3gt
... lt/divgt
RDFa introduces the property attribute.
What kind of title? A title of a person or a
title to land or a title of a work?
18
In RDFa, all property names are, in fact, URLs.
19
Multiple Items Per Page
RDFa provides _at_about, an attribute for
specifying the exact URL to which the
contained RDFa markup applies
ltdiv xmlnsdc"http//purl.org/dc/elements/1.1/"gt
ltdiv about"/alice/posts/trouble_with_bob"gt
lth2 property"dctitle"gtThe trouble with
Boblt/h2gt lth3 property"dccreator"gtAlicelt/h3
gt ... lt/divgt ltdiv about"/alice/posts
/jos_barbecue"gt lth2 property"dctitle"gtJo's
Barbecuelt/h2gt lth3 property"dccreator"gtEve
lt/h3gt ... lt/divgt lt/divgt
20
As a Diagram
21
Alice Gives Bob Credit
ltdiv about"/alice/posts/trouble_with_bob"gt
lth2 property"dctitle"gtThe trouble with
Boblt/h2gt The trouble with Bob is
that he takes much better photos than I do
ltdiv about"http//example.com/bob/photos/sunset
.jpg"gt ltimg src"http//example.com/bob/ph
otos/sunset.jpg" /gt ltspan
property"dctitle"gtBeautiful Sunsetlt/spangt
by ltspan property"dccreator"gtBoblt/spangt.
lt/divgt lt/divgt
The inner about overrides the outer about.
22
As A Graph
23
Blog Contact Info
ltdivgt ltpgt Alice Birpemswick lt/pgt
ltpgt Email lta href"mailtoalice_at_example.com"
gtalice_at_example.comlt/agt lt/pgt ltpgt Phone
lta href"tel1-617-555-7332"gt1
617.555.7332lt/agt lt/pgt lt/divgt
This is mainly useful for viewing.
24
Blog w/FOAF Contact Info
The Dublin core has no vocabulary for describing
friendships. But foaf does.
ltdiv typeof"foafPerson"
xmlnsfoaf"http//xmlns.com/foaf/0.1/"gt
ltp property"foafname"gtAlice Birpemswicklt/pgt
ltpgtEmail lta rel"foafmbox"
href"mailtoalice_at_example.com"gt
alice_at_example.comlt/a
gt lt/pgt ltpgt Phone lta
rel"foafphone"
href"tel1-617-555-7332"gt1 617.555.7332lt/agt
lt/pgt lt/divgt
The typeof is an RDFa attribute that is
specifically meant to declare a new data item
with a certain type.
25
As A Graph
Alice didn't specify _at_about like she did when
adding blog entry metadata. What is she
associating these properties with, then? In
fact, the _at_typeof on the enclosing div
implicitly sets the subject of the properties
marked up within that div. The name, email
address, and phone number are associated with a
new node of type foafPerson. This node has no
URL to identify it, so it is called a blank node.
26
Social Networks
ltdivgt ltulgt ltligt lta
href"http//example.com/bob/"gtBoblt/agt
lt/ligt ltligt lta href"http//example.c
om/eve/"gtEvelt/agt lt/ligt ltligt
lta href"http//example.com/manu/"gtManult/agt
lt/ligt lt/ulgt lt/divgt
These people are all friends of Alice and she
Includes them in her normal HTML blog.
27
Adding RDFa
First,describe these as Persons.
ltdiv xmlnsfoaf"http//xmlns.com/foaf/0.1/"gt
ltulgt ltli typeof"foafPerson"gt lta
href"http//example.com/bob/"gtBoblt/agt
lt/ligt ltli typeof"foafPerson"gt lta
href"http//example.com/eve/"gtEvelt/agt
lt/ligt ltli typeof"foafPerson"gt lta
href"http//example.com/manu/"gtManult/agt
lt/ligt lt/ulgt lt/divgt
28
Add Homepages
Use rel for the link relationships.
ltdiv xmlnsfoaf"http//xmlns.com/foaf/0.1/"gt
ltulgt ltli typeof"foafPerson"gt lta
rel"foafhomepage" href"http//example.com/bob/"
gtBoblt/agt lt/ligt ltli typeof"foafPerson
"gt lta rel"foafhomepage"
href"http//example.com/eve/"gtEvelt/agt
lt/ligt ltli typeof"foafPerson"gt lta
rel"foafhomepage" href"http//example.com/manu/
"gtManult/agt lt/ligt lt/ulgt lt/divgt
29
Describe Text as Names
ltdiv xmlnsfoaf"http//xmlns.com/foaf/0.1/"gt
ltulgt ltli typeof"foafPerson"gt lta
property"foafname"
rel"foafhomepage" href"http//example.com/bob/"
gtBoblt/agt lt/ligt ltli typeof"foafPerson
"gt lta property"foafname"
rel"foafhomepage" href"http//example.com/eve/"
gtEvelt/agt lt/ligt ltli typeof"foafPerson
"gt lta property"foafname"
rel"foafhomepage" href"http//example.com/manu/
"gtManult/agt lt/ligt lt/ulgt lt/divgt
30
Claim in Primer
Alice is ecstatic that, with so little
additional markup, she's able to fully express
both a pleasant human-readable page and a
machine-readable dataset.
31
Using foafknows
ltdiv xmlnsfoaf"http//xmlns.com/foaf/0.1/"
about"me" rel"foafknows"gt ltulgt ltli
typeof"foafPerson"gt lta
property"foafname" rel"foafhomepage"
href"http//example.com/bob"gtBoblt/agt
lt/ligt ltli typeof"foafPerson"gt lta
property"foafname" rel"foafhomepage"
href"http//example.com/eve"gtEvelt/agt
lt/ligt ltli typeof"foafPerson"gt lta
property"foafname" rel"foafhomepage"
href"http//example.com/manu"gtManult/agt
lt/ligt lt/ulgt lt/divgt
Alice knows these people with these names and
homepages.
32
(No Transcript)
33
Building Custom Vocabularies
1. Selecting a URL where the vocabulary will
reside, e.g. http//example.com/photos/vocab.
2. Distributing an RDF document, at that URL,
which defines the classes and properties
that make up the vocabulary. For example, Alice
may want to define classes Photo and
Camera, as well as the property takenWith that
relates a photo to the camera with which it
was taken. 3. Using the vocabulary in
XHTMLRDFa with the usual prefix declaration
mechanism, e.g. xmlnsphoto"http//exampl
e.com/photos/vocab", and typeof"photoCamera".
34
Microformats Compete with RDFa
Not from a standards body. A grassroots effort
since 2004.
hCard Business card data XFN
Friends and contacts hCalendar Events
hReview Review movies, books, etc..
When web data meant for humans is augmented with
hints meant for computer programs, these
programs become significantly more helpful.
35
Microformats Compete with RDFa
As an exercise, visit http//microformats.org
and build an hCard and an hCalendar. Use hCard
creator and hCalendar creator. Quiz. What
information is requested by the XFN tool?
36
Google adopted Microformats and RDFa in 2009
Why? In support of Rich Snippits.
Google Rich Snippets provides structured data in
Google search result snippets. Webmasters can
provide this structured data by using
microformats or RDFa to mark up their web pages.

See the Rich Snippit Testing Tool at
http//www.google.com/webmasters/tools/richsnipp
ets
37
Rich Snippits
This kind of markup is designed for sites
containing specific types of structured data.
Google currently supports the following
information types reviews, people profiles,
business listings, and events.
From http//www.google.com/support/webmasters/bin
/answer.py?hlenanswer99170
38
Examples from Google A Review of a Pizza Joint
The old way ltdivgt LAmourita Pizza Reviewed by
Ulysses Grant on Jan 6. Delicious, tasty pizza
on Eastlake! L'Amourita serves up traditional
wood-fired Neapolitan-style pizza, brought to
your table promptly and without fuss. An ideal
neighborhood pizza joint. Rating 4.5 lt/divgt
39
Examples from Google A Review of a Pizza Joint
With RDFa ltdiv xmlnsv"http//rdf.data-vocabula
ry.org/" typeof"vReview"gt ltspan
property"vitemreviewed"gtLAmourita Pizzalt/spangt
Reviewed by ltspan property"vreviewer"gtUlysses
Grantlt/spangt on ltspan property"vdtreviewe
d" content"2009-01-06"gtJan 6lt/spangt. ltspan
property"vsummary"gtDelicious, tasty pizza on
Eastlake!lt/spangt ltspan property"vdescription"
gtL'Amourita serves up traditional wood-fired
Neapolitan-style pizza, brought to your table
promptly and without fuss. An ideal
neighborhood pizza joint. lt/spangt Rating
ltspan property"vrating"gt4.5lt/spangt lt/divgt
Be sure to visit http//rdf.data-vocabulary.org/r
df.xml
40
Examples from Google A Review of a Pizza Joint
With Microformats ltdiv class"hreview"gt
ltspan class"item"gt ltspan
class"fn"gtLAmourita Pizzalt/spangt lt/spangt
Reviewed by ltspan class"reviewer"gtUlysses
Grantlt/spangt on ltspan
class"dtreviewed"gt Jan 6ltspan class"value-title"
title"2009-01-06"gt lt/spangt ltspan
class"summary"gtDelicious, tasty pizza on
Eastlake!lt/spangt ltspan class"description"gtL'A
mourita serves up traditional wood-fired
Neapolitan-style pizza, brought to your table
promptly and without fuss. An ideal
neighborhood pizza joint. lt/spangt
Rating ltspan class"rating"gt4.5lt/spangt lt/divgt
41
Examples from Google People
The old way ltdivgt My name is Bob Smith, but
people call me Smithy. Here is my home page lta
href"http//www.example.com"gtwww.example.comlt/agt.
I live in Albuquerque, NM and work as an
engineer at ACME Corp. My friends lta
href"http//darryl-blog.example.com"gtDarryllt/agt,
lta href"http//edna-blog.example.com"gtEdnalt/agt
lt/divgt
42
Examples from Google People
In RDFa ltdiv xmlnsv"http//rdf.data-vocabulary
.org/" typeof"vPerson"gt My name is ltspan
property"vname"gtBob Smithlt/spangt, but people
call me ltspan property"vnickname"gtSmithylt/spa
ngt. Here is my homepage lta
hrefhttp//www.example.com rel"vurl"gt
www.example.comlt/agt. I live in ltspan
rel"vaddress"gt ltspan typeof"vAddress"gt
ltspan property"vlocality"gtAlbuquerquelt
/spangt, ltspan property"vregion"gtNMlt/sp
angt lt/spangt lt/spangt and work as an
ltspan property"vtitle"gtengineerlt/spangt at
ltspan property"vaffiliation"gtACME Corplt/spangt.
My friends lta href"http//darryl-blog.exampl
e.com" rel"vfriend"gtDarryllt/agt, lta
href"http//edna-blog.example.com"
rel"vfriend"gtEdnalt/agt lt/divgt
43
Examples from Google People
In Microformats ltdiv class"vcard"gt My name is
ltspan class"fn"gtBob Smithlt/spangt, but
people call me ltspan class"nickname"gtSmithylt
/spangt. Here is my home page lta
hrefhttp//www.example.com class"url"gtwww.exampl
e.comlt/agt. I live in ltspan class"adr"gt
ltspan class"locality"gtAlbuquerquelt/spangt,
ltspan class"region"gtNMlt/spangt
lt/spangt and work as an ltspan
class"title"gtengineerlt/spangt at
ltspan class"org"gtACME Corplt/spangt. My
friends lta hrefhttp//darryl-blog.example.com
rel"friend"gtDarryllt/agt, lta
href"http//edna-blog.example.com"
rel"friend"gtEdnalt/agt lt/divgt
44
Examples from Google Events
The old way ltdivgt lta href"http//www.example.c
om/events/spinaltap"gtSpinal Taplt/agt ltimg
src"spinal_tap.jpg" /gt After their
highly-publicized search for a new drummer,
Spinal Tap kicks off their latest comeback tour
with a San Francisco show. When Oct 15,
700PM900PM Where Warfield Theatre, 982
Market St, San Francisco, CA Category Concert
lt/divgt
45
Examples from Google Events
In RDFa ltdiv xmlnsv"http//rdf.data-vocabulary
.org/" typeof"vEvent"gt    lta
href"http//www.example.com/events/spinaltap"
rel"vurl" property"vsummary"gt Spinal
Taplt/agt     ltimg src"spinal_tap.jpg"
rel"vphoto" /gt     ltspan property"vdescripti
on"gtAfter their highly-publicized search for a
new drummer, Spinal Tap kicks off their latest
comeback tour with a San Francisco show.
lt/spangt   When     ltspan property"vstartDate"
content"2009-10-15T1900-0800"gtOct 15,
700PMlt/spangt   ltspan property"vendDate"
content"2009-10-15T2100-0800"gt900PMlt/spangt
   Where     ltspan rel"vlocation"gt     
ltspan typeof"vOrganization"gt       
ltspan property"vname"gtWarfield Theatrelt/spangt,
      
46
Examples from Google Events
ltspan rel"vaddress"gt          ltspan
typeof"vAddress"gt            ltspan
property"vstreet-address"gt982 Market
Stlt/spangt,         ltspan property"vlocality"gtSa
n Franciscolt/spangt,         ltspan
property"vregion"gtCAlt/spangt      lt/spangt     
 lt/spangt  ltspan rel"vgeo"gt          ltspan
typeof"vGeo"gt             ltspan
property"vlatitude" content"37.774929"
gtlt/spangt            ltspan
property"vlongitude" content"-122.419416"
gtlt/spangt lt/spangt lt/spangt lt/spangt lt/sp
angt   Category ltspan property"veventType"gt
Concertlt/spangt lt/divgt
47
Examples from Google Events
In Microformat
ltdiv class"vevent"gt lta href"http//www.example.
com/events/spinaltap" class"url summary"gtSpinal
Taplt/agt ltimg src"spinal_tap.jpg" class"photo"
/gt ltspan class"description"gtAfter their
highly-publicized search for a new drummer,
Spinal Tap kicks off their latest comeback tour
with a San Francisco show.lt/spangt When ltspan
class"dtstart"gt Oct 15, 700PMltspan
class"value-title" title"2009-10-15T1900-0800"
gt lt/spangt lt/spangt ltspan class"dtend"gt
900PMltspan class"value-title"
title"2009-10-15T2100-0800"gt lt/spangt lt/spangt
Where ltdiv class"location vcard"gt ltspan
class"fn org"gtWarfield Theatrelt/spangt, ltspan
class"adr"gt ltspan class"street-address"gt982
Market Stlt/spangt, ltspan class"locality"gtSan
Franciscolt/spangt, ltspan class"region"gtCAlt/spangt
lt/spangt
48
Examples from Google Events
ltspan class"geo"gt ltspan class"latitude"gt
ltspan class"value-title" title"37.774929"
gt lt/spangt lt/spangt ltspan class"longitude"gt ltspan
class"value-title" title"-122.419416"gt lt/spangt
lt/spangt lt/spangt lt/divgt Category ltspan
class"category"gtConcertlt/spangt lt/divgt
49
Quiz
For each RDFa document, draw a knowledge
graph. For each RDFa attribute, trace its
meaning with the ontology at http//rdf.data-voca
bulary.org/.
50
RDF On Its Own
  • RDFa is RDF in XHTML.
  • 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?

51
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.

52
RDF Triples
It is required that each resource have a URI.
http//www.andrew.cmu.edu http//www.andrew.cmu.ed
u/mm6/my.xmlroot().child(1) mailtomm6_at_andrew.cm
u.edu urnisbn0764532367
(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 propertys name and the
associated schema. The schema must actually be
pointed to by the propertys namespace. Using
RDF Schema we can describe the property names,
values and value ranges that are permitted for
the property.
53
A Simple Description
  • ltRDFgt
  • ltDescription about "Some URI"gt
  • ltcreatorgtproperty value
  • lt/creatorgt
  • lttitlegtproperty value
  • lt/titlegt
  • lt/Descriptiongt
  • lt/RDFgt

54
Resource Valued Property
  • ltRDFgt
  • ltDescription about "Some URI"gt
  • ltcreator rdfresource
  • "www.andrew.cmu.edu/
    mm6"/gt
  • lt/Descriptiongt
  • ltDescription about "www.andrew.cmu.edu/mm6"gt
  • ltFNgtMike McCarthylt/FNgt
  • lt/Descriptiongt
  • lt/RDFgt

55
Making Many Statements
  • ltRDFgt
  • ltDescription about "Some URI"gt
  • ltcreatorgtproperty valuelt/creatorgt
  • lttitlegtproperty valuelt/titlegt
  • lt/Descriptiongt
  • ltDescription about "Some URI"gt
  • ltcreatorgtproperty valuelt/creatorgt
  • lttitlegtproperty valuelt/titlegt
  • lt/Descriptiongt
  • lt/RDFgt

56
Blank Nodes
  • ltRDFgt
  • ltDescription about "Some URI"gt
  • ltcreatorgt
  • ltDescriptiongt lt! no about
    attribute holding a URI ?
  • ltFNgtJoe Smithlt/FNgt
  • ltEMAILgtjoes_at_mycom.comlt/EMAILgt
  • lt/Descriptiongt
  • lt/creatorgt
  • lt/Descriptiongt
  • lt/RDFgt

57
XML Valued Property
  • ltRDFgt
  • ltDescription about "Some URI"gt
  • ltgenerates rdfparseType"Literal"gt
  • lthtmlgtltbodygtlt/bodygtlt/htmlgt
  • lt/generatesgt
  • lt/Descriptiongt
  • lt/RDFgt

58
A Type Property
  • ltRDFgt
  • ltDescription about SomeURL"gt
  • ltrdftype rdfresource
  • "http//www.schemas.org/www/WebPage"/
    gt
  • lt/Descriptiongt
  • lt/RDFgt

59
An Abbreviated Type Property
  • ltRDFgt
  • ltTypeName about "Some URI"gt
  • ltcreatorgtproperty value
  • lt/creatorgt
  • lttitlegtproperty valuelt/titlegt
  • lt/TypeNamegt
  • lt/RDFgt

60
RDF has several notations
  • Natural language (English, Spanish,)
  • RDF XML
  • Abbreviated RDF XML
  • N-Triples
  • Graph

61
Another RDF Application 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.

62
Composite Capability/Preference Profiles (CC/PP)
DEVICE PROFILE
CC/PP provides a model for formalizing device
profiles.
CC/PP
RDF
XML
63
Composite Capability/Preference Profiles
(CC/PP)
  • 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.

64
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
65
Processing RDF in Java
  • XSLT?
  • DOM?
  • SAX?
  • StAX?
  • Open source Jena from HP Research provides
    another approach

66
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"

67
public static void main (String args)
// create an empty model (An empty RDF graph)
Model model ModelFactory.createDefaultMode
l() // create the resource
Resource johnSmith model.createResource(personUR
I) // add the property
johnSmith.addProperty(VCARD.FN, fullName)
model.write(System.out)
68
D\McCarthy\www\95-733\examples\Jenagtjava
Tutorial01 ltrdfRDF xmlnsrdf"http//www.w3.
org/1999/02/22-rdf-syntax-ns"
xmlnsvcard"http//www.w3.org/2001/vcard-rdf/3.0
" gt ltrdfDescription rdfabout"http//somewh
ere/JohnSmith"gt ltvcardFNgtJohn
Smithlt/vcardFNgt lt/rdfDescriptiongt lt/rdfRDFgt
69
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/Jo
    hnSmith"
  • String givenName "John"
  • String familyName "Smith"
  • String fullName givenName " "
    familyName
  • // create an empty model
  • Model model ModelFactory.createDefaultMo
    del()

70
// create the resource // and
add the properties cascading style
Resource johnSmith model.createResource(personU
RI)
.addProperty(VCARD.FN, fullName)

.addProperty(VCARD.N,
model.createResource
()
.addProperty(VCARD.Given,
givenName)
.addProperty(VCARD.Fa
mily, familyName))
71
// 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() " ")
72
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)

73
D\McCarthy\www\95-733\examples\Jenagtjava
Tutorial03 16fa474fd074695f6-8000
http//www.w3.org/2001/vcard-rdf/3.0Given
"John" . http//somewhere/JohnSmith
http//www.w3.org/2001/vcard-rdf/3.0FN "John
Smith" . 16fa474fd074695f6-8000
http//www.w3.org/2001/vcard-rdf/3.0Family
"Smith" . http//somewhere/JohnSmith
http//www.w3.org/2001/vcard-rdf/3.0N
16fa474fd074695f6-8000 . ltr
dfRDF xmlnsrdf"http//www.w3.org/1999/02/22
-rdf-syntax-ns" xmlnsvcard"http//www.w3.or
g/2001/vcard-rdf/3.0" gt ltrdfDescription
rdfnodeID"A0"gt ltvcardGivengtJohnlt/vcardGive
ngt ltvcardFamilygtSmithlt/vcardFamilygt
lt/rdfDescriptiongt ltrdfDescription
rdfabout"http//somewhere/JohnSmith"gt
ltvcardFNgtJohn Smithlt/vcardFNgt ltvcardN
rdfnodeID"A0"/gt lt/rdfDescriptiongt lt/rdfRDFgt
Notes 16fa is a blank node with family and
given properties. The main resource has a blank
node as the value of the N property. The main
resource also has a FN property with a value.
74
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.createOntolo
    gyModel()

75
// read the wine.xml file either way
model.read("fileD/McCarthy/www/95-733/example
s/Jena/wine.xml")
//model.read("http//www.andrew.cmu.edu/user/mm6/o
ntology/wine.xml") // write
it to standard out model.write(System.out
)
The next step is to use Jena to make or verify
deductions.
76
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 users new
tags to other users.
77
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.

78
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 URIs. 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.
79
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.
About PowerShow.com