XML

 


COIN78 - XML Lesson 11: Semantic Web and RDFa


Semantic Web

While the Semantic Web has been around for years, it has yet to live up to the audacious promises that heralded its introduction to the world. What is the Semantic Web?

Here's the definition from Wikipedia:

Humans are capable of using the Web to carry out tasks such as finding the Finnish word for "monkey", reserving a library book, and searching for a low price for a DVD. However, a computer cannot accomplish the same tasks without human direction because web pages are designed to be read by people, not machines. The semantic web is a vision of information that is understandable by computers, so that they can perform more of the tedious work involved in finding, sharing, and combining information on the web.

In short, the Semantic Web is about more "meaningful" content. We've perfected the art of scanning text and creating massive distributed indexes that produce highly relevant search results, but when you type in "Swine Flu" you are really still dealing with an inefficient indexing approach that doesn't know about the meaning of the text being parsed and indexed. Moving toward the Semantic Web will allow our searching technologies to become more intelligent and will set the stage for the next revolution in which computing systems can become more aware of the "meaningfulness of data". (Radar O'Reilly Article by Timothy M. O'Brien)


Introduction to the Semantic Web

 

RDFa

What is RDFa?

From the W3C RDFa in XHTML Specification:

The current Web is primarily made up of an enormous number of documents that have been created using HTML. These documents contain significant amounts of structured data, which is largely unavailable to tools and applications. When publishers can express this data more completely, and when tools can read it, a new world of user functionality becomes available, letting users transfer structured data between applications and web sites, and allowing browsing applications to improve the user experience: an event on a web page can be directly imported into a user's desktop calendar; a license on a document can be detected so that users can be informed of their rights automatically; a photo's creator, camera setting information, resolution, location and topic can be published as easily as the original photo itself, enabling structured search and sharing.

RDFa Basics


For a long time now, RDF has shown great promise as a flexible format for storing, aggregating, and using metadata but it is complex to use. Now the W3C is developing a new, simpler syntax called RDFa that is easy enough to create and to use in applications. Since simple RDF/XML doesn't fit well into XHTML, causing browsers and other applications designed around HTML to 'choke' on it, RDFa has been designed to make it easy to embed it into XHTML. This gives it an important potential role in the grand plan for the Semantic Web, in which web page data is readable not only by human eyes but by automated processes that can aggregate data and associated metadata and then perform tasks that are much more sophisticated than those that typical screen scraping applications can do now.

RDFa uses the existing XHTML 1 attributes href, content, rel, rev, and datatype, and it uses the new about, role and property attributes from XHTML 2's Metainformation Attributes module which allows you to add metadata to a web page without affecting a browser's display of that page.

RDF often uses a subject, predicate, object combination called a triple to specify an attribute name/value pair about a particular resource. For example, a triple could specify that the resource with ID http://example.com/artwork#fountain has an author value of "Richard Mutt."

There are two basic cases: triples that have a literal string as their object and triples that have a URI as their object. (When possible, it's better to have a URI as an object, because it lets the same value serve as the object of some triples and the subject of others. This makes it easier to connect triples and find new information through inferencing.)

The RDFa Primer uses the Alice example to describe RDFa. Click here to see the rendered page. Below is the code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" 
                      "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
      xmlns:cc="http://creativecommons.org/ns#"
      xmlns:dc="http://purl.org/dc/elements/1.1/"
      xmlns:foaf="http://xmlns.com/foaf/0.1/">

  <head profile="http://www.w3.org/1999/xhtml/vocab">
      <title>Alice in Semantic Wonderland</title>
      <base href="http://example.com/alice"></base>
      <link rel="stylesheet" type="text/css" 
            href="http://www.w3.org/TR/2008/NOTE-xhtml-rdfa-primer-20081014/style.css" />
  </head>

  <body>
      <h1>Alice in Semantic Wonderland</h1>

<div id="meta"> <a href="http://www.w3.org/2007/08/pyRdfa/extract?uri=http%3A%2F%2Fwww.w3.org%2F/ TR/2008%2FNOTE-xhtml-rdfa-primer-20081014%2Falice-example.html&amp; format=turtle&amp;warnings=false&amp;parser=strict&amp; space-preserve=true&amp;submit=Go%21"> <img src="http://www.w3.org/Icons/SW/Buttons/sw-rdfa-gray.png" alt="get metadata in RDF Turtle"/> </a> </div> <div about="/posts/trouble_with_bob"> <h2 property="dc:title">The trouble with Bob</h2> <h3 property="dc:creator">Alice</h3> <p>The trouble with Bob is that he takes much better photos than I do:</p> <!-- note that the image is from http://www.pdphoto.org/PictureDetail.php?pg=5627&mat=pdef, available as http://creativecommons.org/licenses/publicdomain/ --> <div class="imgbox" about="http://www.w3.org/TR/2008/NOTE-xhtml-rdfa-primer-20081014/sunset.jpg"> <img src="http://www.w3.org/TR/2008/NOTE-xhtml-rdfa-primer-20081014/sunset.jpg" alt="sunset" /> <div> <span property="dc:title">Beautiful Sunset</span> by <span property="dc:creator">Bob</span>. </div> </div> </div> <div about="/posts/jos_barbecue"> <h2 property="dc:title">Jo's Barbecue</h2> <h3 property="dc:creator">Eve</h3> <p>...</p> </div> <div class="socialnet" about="#me" typeof="foaf:Person"> <p property="foaf:name">Alice Birpemswick</p> <p>Email: <a rel="foaf:mbox" href="mailto:alice@example.com">alice@example.com</a> </p> <p>Phone: <a rel="foaf:phone" href="tel:+1-617-555-7332">+1 617.555.7332</a></p> <p>My buddies:</p> <ul rel="foaf:knows"> <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> <div id="footer"> <p>The content on this site is licensed under <a rel="cc:license" href="http://creativecommons.org/licenses/by/3.0/"> a Creative Commons License</a>. </p> <div class="validrdfa"> <a href="http://validator.w3.org/check?uri=referer"> <img src="http://www.w3.org/Icons/valid-xhtml-rdfa" alt="Valid XHTML+RDFa"/></a> </div> </div> </body> </html>

 

References

Up Arrow Top