internet technologies
DESCRIPTION
Internet Technologies. The Semantic Web and The Resource Description Framework (RDF and RDFa). 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 Google ’ s adoption of RDFa and Microformats. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/1.jpg)
+
95-733 Internet Technologies
Internet Technologies
The Semantic Web and The Resource Description Framework
(RDF and RDFa)
![Page 2: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/2.jpg)
+
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 Google’s adoption of RDFa and Microformats.
95-733 Internet Technologies
![Page 3: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/3.jpg)
+ First: Let’s get some RDF
curl --include --location –header "Accept:application/rdf+xml" http://dbpedia.org/resource/Yukihiro_Matsumoto
Can we learn anything from the result?
Is there any other data we can learn from?
95-733 Internet Technologies
![Page 4: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/4.jpg)
+
95-733 Internet Technologies See www.linkeddata.org
Each of these stores many many RDF triples.
![Page 5: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/5.jpg)
+ So, what’s a “triple”?
A triple is a statement in some RDF format.
The next slides shows how we can combine some triples into
Knowledge Graph.
95-733 Internet Technologies
![Page 6: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/6.jpg)
+A Knowledge Graph
95-733 Internet Technologies
![Page 7: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/7.jpg)
+Triples
95-733 Internet Technologies
Start Node Edge Label End Node
vincent_donofrio starred_in law_&_order_cilaw_&_order_ci is_a tv_showthe_thirteenth_floor similar_plot_as the_matrix
![Page 8: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/8.jpg)
+Notation 3 (N3) or Turtle Format
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ex: <http://www.example.org/> .
ex:vincent_donofrio ex:starred_in ex:law_and_order_ci .
ex:law_and_order_ci rdf:type ex:tv_show .
ex:the_thirteenth_floor ex:similar_plot_as ex:the_matrix .
95-733 Internet Technologies
![Page 9: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/9.jpg)
+RDF/XML
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ex="http://www.example.org/">
<rdf:Description rdf:about="http://www.example.org/vincent_donofrio">
<ex:starred_in>
<ex:tv_show rdf:about="http://www.example.org/law_and_order_ci" />
</ex:starred_in>
</rdf:Description>
<rdf:Description rdf:about="http://www.example.org/the_thirteenth_floor">
<ex:similar_plot_as rdf:resource="http://www.example.org/the_matrix" />
</rdf:Description>
</rdf:RDF>
95-733 Internet Technologies
![Page 10: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/10.jpg)
+Another RDF/XML
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:geo="http://www. w3.org/2003/01/geo/wgs84_pos#"
xmlns:edu="http://www.example.org/">
<rdf:Description rdf:about="http://www.princeton.edu">
<geo:lat>40.35</geo:lat>
<geo:long>-74.66</geo:long>
<edu:hasDept rdf:resource="http://www.cs.princeton.edu"
dc:title="Department of Computer Science"/>
</rdf:Description>
</rdf:RDF>
95-733 Internet Technologies
![Page 11: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/11.jpg)
+As A Table
Subject Predicate Object
----------------------------- ----------- --------
<http://www.princeton.edu> edu:hasDept <http://www.cs.princeton.edu>
<http://www.princeton.edu> geo:lat "40.35"
<http://www.princeton.edu> geo:long "-74.66"
<http://www.cs.princeton.edu> dc:title "Department of Computer Science"
95-733 Internet Technologies
![Page 12: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/12.jpg)
+Notation 3
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix geo: <http://www. w3.org/2003/01/geo/wgs84_pos#> .
@prefix edu: <http://www.example.org/> .
<http://www.princeton.edu> geo:lat "40.35" ; geo:long "-74.66" .
<http://www.cs.princeton.edu> dc:title "Department of Computer Science" .
<http://www.princeton.edu> edu:hasDept <http://www.cs.princeton.edu> .
95-733 Internet Technologies
![Page 13: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/13.jpg)
+ RDFa and RDF
RDFa is a lightweight version of RDF for web pages.
RDF stands on its own.
We’ll first look at RDFa and then RDF.
RDFa is being used today by search engines like Google and
sites like Best Buy.
95-733 Internet Technologies
![Page 14: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/14.jpg)
+From the RDFa W3C Primer
95-733 Internet Technologies
“When web data meant for humans is augmented with hintsmeant for computer programs, these programs become significantly more helpful.”
![Page 15: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/15.jpg)
+XHTML Without and With RDFa
All content on this site is licensed under
<a href="http://creativecommons.org/licenses/by/3.0/">
a Creative Commons License
</a>
All content on this site is licensed under
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/">
a Creative Commons License
</a>.
95-733 Internet Technologies
The rel, in a link, describesthe relationship between the current pageand the linked page.
![Page 16: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/16.jpg)
+A Link with a Flavor
95-733 Internet Technologies
![Page 17: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/17.jpg)
+Labeling Title and Author
95-733 Internet Technologies
<div> <h2>The trouble with Bob</h2> <h3>Alice</h3> ...</div>
<div xmlns:dc="http://purl.org/dc/elements/1.1/"> <h2 property="dc:title">The trouble with Bob</h2> <h3 property="dc:creator">Alice</h3> ...</div>
RDFa introduces theproperty attribute.
What kind of title? Atitle of a person or a title to land or a title of a work?
![Page 18: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/18.jpg)
+ In RDFa, all property names are, in fact, URLs.
95-733 Internet Technologies
![Page 19: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/19.jpg)
+Multiple Items Per Page
95-733 Internet Technologies
<div xmlns:dc="http://purl.org/dc/elements/1.1/">
<div about="/alice/posts/trouble_with_bob"> <h2 property="dc:title">The trouble with Bob</h2> <h3 property="dc:creator">Alice</h3> ... </div>
<div about="/alice/posts/jos_barbecue"> <h2 property="dc:title">Jo's Barbecue</h2> <h3 property="dc:creator">Eve</h3> ... </div></div>
RDFa provides @about, an attribute for specifying the exact URL to which the contained RDFa markup applies
![Page 20: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/20.jpg)
+As a Diagram
95-733 Internet Technologies
![Page 21: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/21.jpg)
+Alice Gives Bob Credit
95-733 Internet Technologies
<div about="/alice/posts/trouble_with_bob"> <h2 property="dc:title">The trouble with Bob</h2> The trouble with Bob is that he takes much better photos than I do:
<div about="http://example.com/bob/photos/sunset.jpg"> <img src="http://example.com/bob/photos/sunset.jpg" /> <span property="dc:title">Beautiful Sunset</span> by <span property="dc:creator">Bob</span>. </div> </div>
The inner aboutoverrides the outer about.
![Page 22: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/22.jpg)
+As A Graph
95-733 Internet Technologies
![Page 23: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/23.jpg)
+Blog Contact Info
95-733 Internet Technologies
<div> <p> Alice Birpemswick </p> <p> Email: <a href="mailto:[email protected]">[email protected]</a> </p> <p> Phone: <a href="tel:+1-617-555-7332">+1 617.555.7332</a> </p></div> This is mainly useful
for viewing.
![Page 24: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/24.jpg)
+Blog w/FOAF Contact Info
95-733 Internet Technologies
<div typeof="foaf:Person" xmlns:foaf="http://xmlns.com/foaf/0.1/">
<p property="foaf:name">Alice Birpemswick</p> <p>Email: <a rel="foaf:mbox" href="mailto:[email protected]">
[email protected]</a> </p> <p> Phone: <a rel="foaf:phone" href="tel:+1-617-555-7332">+1 617.555.7332</a> </p></div>
The Dublin core has no vocabulary fordescribing friendships.But foaf does.
The typeof is an RDFa attribute that is specifically meant to declare a new data item with a certain type.
![Page 25: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/25.jpg)
+As A Graph
95-733 Internet Technologies
Alice didn't specify @about like she did when adding blog entry metadata. What is she associating these properties with, then? In fact, the @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 foaf:Person. This node has no URL to identify it, so it is called a blank node.
![Page 26: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/26.jpg)
+Social Networks
95-733 Internet Technologies
<div> <ul> <li> <a href="http://example.com/bob/">Bob</a> </li> <li> <a href="http://example.com/eve/">Eve</a> </li> <li> <a href="http://example.com/manu/">Manu</a> </li> </ul></div>
These people are allfriends of Alice and she Includes them in her normal HTML blog.
![Page 27: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/27.jpg)
+Adding RDFa
95-733 Internet Technologies
<div xmlns:foaf="http://xmlns.com/foaf/0.1/"> <ul> <li typeof="foaf:Person"> <a href="http://example.com/bob/">Bob</a> </li> <li typeof="foaf:Person"> <a href="http://example.com/eve/">Eve</a> </li> <li typeof="foaf:Person"> <a href="http://example.com/manu/">Manu</a> </li> </ul></div>
First,describethese as Persons.
![Page 28: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/28.jpg)
+Add Homepages
95-733 Internet Technologies
<div xmlns:foaf="http://xmlns.com/foaf/0.1/"> <ul> <li typeof="foaf:Person"> <a rel="foaf:homepage" href="http://example.com/bob/">Bob</a> </li> <li typeof="foaf:Person"> <a rel="foaf:homepage" href="http://example.com/eve/">Eve</a> </li> <li typeof="foaf:Person"> <a rel="foaf:homepage" href="http://example.com/manu/">Manu</a> </li> </ul></div>
Use rel for the linkrelationships.
![Page 29: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/29.jpg)
+Describe Text as Names
95-733 Internet Technologies
<div xmlns:foaf="http://xmlns.com/foaf/0.1/"> <ul> <li typeof="foaf:Person"> <a property="foaf:name" rel="foaf:homepage" href="http://example.com/bob/">Bob</a> </li> <li typeof="foaf:Person"> <a property="foaf:name" rel="foaf:homepage" href="http://example.com/eve/">Eve</a> </li> <li typeof="foaf:Person"> <a property="foaf:name" rel="foaf:homepage" href="http://example.com/manu/">Manu</a> </li> </ul></div>
![Page 30: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/30.jpg)
+Claim in Primer
95-733 Internet Technologies
“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.”
![Page 31: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/31.jpg)
+Using foaf:knows
95-733 Internet Technologies
<div xmlns:foaf="http://xmlns.com/foaf/0.1/" about="#me" rel="foaf:knows"> <ul> <li typeof="foaf:Person"> <a property="foaf:name" rel="foaf:homepage" href="http://example.com/bob">Bob</a> </li> <li typeof="foaf:Person"> <a property="foaf:name" rel="foaf:homepage" href="http://example.com/eve">Eve</a> </li> <li typeof="foaf:Person"> <a property="foaf:name" rel="foaf:homepage" href="http://example.com/manu">Manu</a> </li> </ul></div> Alice knows these people with these
names and homepages.
![Page 32: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/32.jpg)
+
95-733 Internet Technologies
![Page 33: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/33.jpg)
+Building Custom Vocabularies
95-733 Internet Technologies
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 XHTML+RDFa with the usual prefix declaration mechanism, e.g. xmlns:photo="http://example.com/photos/vocab#", and typeof="photo:Camera".
![Page 34: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/34.jpg)
+Microformats Compete with RDFa
95-733 Internet Technologies
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.”
Not from a standards body. A grassroots effort since 2004.
![Page 35: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/35.jpg)
+Microformats Compete with RDFa
95-733 Internet Technologies
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?
![Page 36: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/36.jpg)
+Google adopted Microformats and RDFa in 2009
95-733 Internet Technologies
Why? In support of “Rich Snippits”.
See the Rich Snippit Testing Tool at :http://www.google.com/webmasters/tools/richsnippets
“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. “
![Page 37: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/37.jpg)
+Rich Snippits
95-733 Internet Technologies
“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?hl=en&answer=99170
![Page 38: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/38.jpg)
+Examples from Google – A Review of a Pizza Joint
95-733 Internet Technologies
The old way:
<div> L’Amourita 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 </div> :
![Page 39: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/39.jpg)
+Examples from Google – A Review of a Pizza Joint
95-733 Internet Technologies
With RDFa:
<div xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Review"> <span property="v:itemreviewed">L’Amourita Pizza</span> Reviewed by <span property="v:reviewer">Ulysses Grant</span> on <span property="v:dtreviewed" content="2009-01-06">Jan 6</span>. <span property="v:summary">Delicious, tasty pizza on Eastlake!</span> <span property="v:description">L'Amourita serves up traditional wood-fired Neapolitan-style pizza, brought to your table promptly and without fuss. An ideal neighborhood pizza joint. </span> Rating: <span property="v:rating">4.5</span> </div>
Be sure to visit:http://rdf.data-vocabulary.org/rdf.xml
![Page 40: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/40.jpg)
+Examples from Google – A Review of a Pizza Joint
95-733 Internet Technologies
With Microformats:
<div class="hreview"> <span class="item"> <span class="fn">L’Amourita Pizza</span> </span> Reviewed by <span class="reviewer">Ulysses Grant</span> on <span class="dtreviewed"> Jan 6<span class="value-title" title="2009-01-06"> </span> <span class="summary">Delicious, tasty pizza on Eastlake!</span> <span class="description">L'Amourita serves up traditional wood-fired Neapolitan-style pizza, brought to your table promptly and without fuss. An ideal neighborhood pizza joint. </span> Rating: <span class="rating">4.5</span> </div>
![Page 41: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/41.jpg)
+Examples from Google – People
95-733 Internet Technologies
The old way:
<div> My name is Bob Smith, but people call me Smithy. Here is my home page: <a href="http://www.example.com">www.example.com</a>. I live in Albuquerque, NM and work as an engineer at ACME Corp. My friends: <a href="http://darryl-blog.example.com">Darryl</a>, <a href="http://edna-blog.example.com">Edna</a> </div>
![Page 42: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/42.jpg)
+Examples from Google – People
95-733 Internet Technologies
In RDFa:
<div xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Person"> My name is <span property="v:name">Bob Smith</span>, but people call me <span property="v:nickname">Smithy</span>. Here is my homepage: <a href=http://www.example.com rel="v:url"> www.example.com</a>. I live in <span rel="v:address"> <span typeof="v:Address"> <span property="v:locality">Albuquerque</span>, <span property="v:region">NM</span> </span> </span> and work as an <span property="v:title">engineer</span> at <span property="v:affiliation">ACME Corp</span>. My friends: <a href="http://darryl-blog.example.com" rel="v:friend">Darryl</a>, <a href="http://edna-blog.example.com" rel="v:friend">Edna</a> </div>
![Page 43: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/43.jpg)
+Examples from Google – People
95-733 Internet Technologies
In Microformats:
<div class="vcard"> My name is <span class="fn">Bob Smith</span>, but people call me <span class="nickname">Smithy</span>. Here is my home page: <a href=http://www.example.com class="url">www.example.com</a>. I live in <span class="adr"> <span class="locality">Albuquerque</span>, <span class="region">NM</span> </span> and work as an <span class="title">engineer</span> at <span class="org">ACME Corp</span>. My friends: <a href=http://darryl-blog.example.com rel="friend">Darryl</a>, <a href="http://edna-blog.example.com" rel="friend">Edna</a> </div>
![Page 44: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/44.jpg)
+Examples from Google – Events
95-733 Internet Technologies
The old way:
<div> <a href="http://www.example.com/events/spinaltap">Spinal Tap</a> <img src="spinal_tap.jpg" /> 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, 7:00PM—9:00PM Where: Warfield Theatre, 982 Market St, San Francisco, CA Category: Concert </div>
![Page 45: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/45.jpg)
+Examples from Google – Events
95-733 Internet Technologies
In RDFa:
<div xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Event"> <a href="http://www.example.com/events/spinaltap" rel="v:url" property="v:summary"> Spinal Tap</a> <img src="spinal_tap.jpg" rel="v:photo" /> <span property="v:description">After their highly-publicized search for a new drummer, Spinal Tap kicks off their latest comeback tour with a San Francisco show. </span> When: <span property="v:startDate" content="2009-10-15T19:00-08:00">Oct 15, 7:00PM</span> <span property="v:endDate" content="2009-10-15T21:00-08:00">9:00PM</span> Where: <span rel="v:location"> <span typeof="v:Organization"> <span property="v:name">Warfield Theatre</span>,
![Page 46: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/46.jpg)
+Examples from Google – Events
95-733 Internet Technologies
<span rel="v:address"> <span typeof="v:Address"> <span property="v:street-address">982 Market St</span>, <span property="v:locality">San Francisco</span>, <span property="v:region">CA</span> </span> </span> <span rel="v:geo"> <span typeof="v:Geo"> <span property="v:latitude" content="37.774929" ></span> <span property="v:longitude" content="-122.419416" ></span> </span> </span></span></span> Category: <span property="v:eventType">Concert</span> </div>
![Page 47: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/47.jpg)
+Examples from Google – Events
95-733 Internet Technologies
In Microformat:
<div class="vevent"> <a href="http://www.example.com/events/spinaltap" class="url summary">Spinal Tap</a> <img src="spinal_tap.jpg" class="photo" /> <span class="description">After their highly-publicized search for a new drummer, Spinal Tap kicks off their latest comeback tour with a San Francisco show.</span> When: <span class="dtstart"> Oct 15, 7:00PM<span class="value-title" title="2009-10-15T19:00-08:00"></span> </span><span class="dtend"> 9:00PM<span class="value-title" title="2009-10-15T21:00-08:00"></span> </span> Where: <div class="location vcard"> <span class="fn org">Warfield Theatre</span>, <span class="adr"> <span class="street-address">982 Market St</span>, <span class="locality">San Francisco</span>, <span class="region">CA</span> </span>
![Page 48: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/48.jpg)
+Examples from Google – Events
95-733 Internet Technologies
<span class="geo"> <span class="latitude"> <span class="value-title" title="37.774929" ></span> </span> <span class="longitude"> <span class="value-title" title="-122.419416"></span> </span> </span> </div> Category: <span class="category">Concert</span> </div>
![Page 49: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/49.jpg)
+Quiz
95-733 Internet Technologies
For each RDFa document, draw a knowledge graph.
For each RDFa attribute, trace its meaning with the ontology at http://rdf.data-vocabulary.org/#.
![Page 50: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/50.jpg)
+
95-733 Internet Technologies
• 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?
RDF On Its Own
![Page 51: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/51.jpg)
+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.
95-733 Internet Technologies
![Page 52: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/52.jpg)
+RDF Triples
95-733 Internet Technologies
(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.
![Page 53: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/53.jpg)
+A Simple Description
<RDF>
<Description about = "Some URI">
<creator>property value
</creator>
<title>property value
</title>
</Description>
</RDF>
95-733 Internet Technologies
![Page 54: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/54.jpg)
+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>
95-733 Internet Technologies
![Page 55: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/55.jpg)
+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>95-733 Internet Technologies
![Page 56: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/56.jpg)
+Blank Nodes
<RDF>
<Description about = "Some URI">
<creator>
<Description> <!– no about attribute holding a URI
<FN>Joe Smith</FN>
<EMAIL>[email protected]</EMAIL>
</Description>
</creator>
</Description>
</RDF>
95-733 Internet Technologies
![Page 57: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/57.jpg)
+XML Valued Property
<RDF>
<Description about = "Some URI">
<generates rdf:parseType="Literal">
<html><body></body></html>
</generates>
</Description>
</RDF>
95-733 Internet Technologies
![Page 58: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/58.jpg)
+A Type Property
<RDF>
<Description about = ”SomeURL">
<rdf:type rdf:resource=
"http://www.schemas.org/www/WebPage"/>
</Description>
</RDF>
95-733 Internet Technologies
![Page 59: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/59.jpg)
+An Abbreviated Type Property
<RDF>
<TypeName about = "Some URI">
<creator>property value
</creator>
<title>property value</title>
</TypeName>
</RDF>
95-733 Internet Technologies
![Page 60: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/60.jpg)
+RDF has several notations:
• Natural language (English, Spanish,…)
• RDF XML
• Abbreviated RDF XML
• N-Triples
• Graph
95-733 Internet Technologies
![Page 61: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/61.jpg)
+Another RDF Application CC/PP
95-733 Internet Technologies
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.
![Page 62: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/62.jpg)
95-733 Internet Technologies
Composite Capability/Preference Profiles (CC/PP)DEVICE PROFILE
CC/PP
RDF
XML
CC/PP provides a model for formalizing device profiles.
![Page 63: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/63.jpg)
95-733 Internet Technologies
• 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)
![Page 64: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/64.jpg)
95-733 Internet Technologies
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
![Page 65: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/65.jpg)
+Processing RDF in Java
XSLT?
DOM?
SAX?
StAX?
Open source Jena from HP Research provides another approach
95-733 Internet Technologies
![Page 66: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/66.jpg)
+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";
95-733 Internet Technologies
![Page 67: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/67.jpg)
95-733 Internet Technologies
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);
}
}
![Page 68: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/68.jpg)
95-733 Internet Technologies
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>
![Page 69: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/69.jpg)
+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();
95-733 Internet Technologies
![Page 70: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/70.jpg)
95-733 Internet Technologies
// 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));
![Page 71: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/71.jpg)
95-733 Internet Technologies
// 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() + " ");
![Page 72: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/72.jpg)
95-733 Internet Technologies
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); }}
![Page 73: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/73.jpg)
95-733 Internet Technologies
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.
![Page 74: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/74.jpg)
+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();
95-733 Internet Technologies
![Page 75: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/75.jpg)
95-733 Internet Technologies
// 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.
![Page 76: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/76.jpg)
+The Semantic Web
95-733 Internet Technologies
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
![Page 77: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/77.jpg)
+The Semantic Web
95-733 Internet Technologies
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.
![Page 78: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/78.jpg)
+The Semantic Web
95-733 Internet Technologies
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.
![Page 79: Internet Technologies](https://reader031.vdocuments.us/reader031/viewer/2022013011/56812f31550346895d94c511/html5/thumbnails/79.jpg)
+The Semantic Web
95-733 Internet Technologies
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.