GoodRelations Recipe 8

From Wiki of the E-Business and Web Science Research Group
Jump to: navigation, search
gr_banner_small.png
GoodRelations is a standardized vocabulary for product, price, and company data that can be embedded into existing static and dynamic Web pages.

Project Main Page
Vocabulary
Documentation
Developer's Wiki
GoodRelations Cookbook

Publishing GoodRelations Data on the Web

This page describes how to publish GoodRelations data on the Web.

Option 1: Publishing RDFa (RDF embedded inside HTML or XHTML)

Step 1: Insert the additional mark-up into your XHTML/HTML Web page

First, insert the additional mark-up into your XHTML/HTML Web page. There are two basic styles of RDFa usage, i.e.

  • reusing existing content: inserting RDFa attributes directly where the original content is located in the page and
  • snippet style: inserting an independent block of invisible RDFa directly before the closing "body" element of your page.

The first minimizes redundancy of data and is more suited for simple data structures on static Web pages, because updating the visible part will automatically update the rich meta-data. The downside of this approach is that the mark-up gets quickly unreadable if the data structures and the presentation diverge, which is very common.

The second approach avoids those limitations. For dynamic Web pages, i.e. when inserting RDFa at the template level, there are no real disadvantages. For static Web pages, a slight disadvantage is that in case of changes, you must update data at two locations, but still within the same file.

We provide a tool called RDF2RDFa that can turn any RDF/XML file into handy RDFa snippets for simple copy-and-paste.

For background information, please see: Hepp, Martin; García, Roberto; Radinger, Andreas: RDF2RDFa: Turning RDF into Snippets for Copy-and-Paste, in: Poster and Demo Proceedings of the 8th International Semantic Web Conference (ISWC 2009), Washington, DC, USA, October 25-29, 2009.

Step 2: Updating the XHTML/HTML page header

As a minimal solution, add a "xmlns" attribute with the value "http://www.w3.org/1999/xhtml" and a "version" attribute with the value "HTML+RDFa 1.0" to the <html> element of your document:

<xml><html xmlns="http://www.w3.org/1999/xhtml" version="HTML+RDFa 1.0" xml:lang="en"></xml>

This is enough for basic access to your rich meta-data.

Your data is, however, much more visible and useful if your page is compliant with the XHTML 1.0 strict specification. If you meet that requirement, you should instead update the page header as follows:

1. Change the DOCTYPE in the header to "XHTML+RDFa"

<xml> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"> </xml>

2. Add a "xmlns" attribute with the value "http://www.w3.org/1999/xhtml"  and a "version" attribute with the value "XHTML+RDFa 1.0" to the <html> element of your document:

<xml><html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.0" xml:lang="en"></xml>

3. Check that the <head> element includes the proper content type and encoding for HTML:

<xml><head>

   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
   <title>Your page title blabla...</title>

</head></xml>

For more information on this, see http://www.ebusiness-unibw.org/wiki/GoodRelationsAnnotator.

Step 3: Tell the World!

Now, notify the key Web of Linked Data crawlers to load and use your data. To do so, simply paste the URI of the page that contains the snippet (likely http://example.org/) into the respective fields of the following submission pages:

   * a) Sindice: http://sindice.com/main/submit
   * b) Yahoo SearchMonkey: http://siteexplorer.search.yahoo.com/submit (this requires free registration with Yahoo)

Also, you should tell the URIBurner service of your new data. To do so, simply enter the following URI into your browser once you have published your updated page:

   * http://linkeddata.uriburner.com/about/html/<your page>

Example: If your augmented Web page is at http://www.mmmeeja.com/, then invoke the following URI:

   * http://linkeddata.uriburner.com/about/html/http://www.mmmeeja.com/

Option 2: Publishing RDF/XML (Separate File)

  1. Save the RDF/XML file under the filename
    semanticweb.rdf
    in the root directory of your Web server so that it becomes available as
    http://example.org/semanticweb.rdf
  2. Add a link element pointing to this file to the header of your main Web page (or other pages, too):
    <html lang="en">
    <head>
    <title></title>
    <link rel="meta" type="application/rdf+xml" title="RDF/XML data for ***your company name***" href="http://www.example.org/semanticweb.rdf" />
    </head>
    ...
  3. Notify Semantic Web search engines and crawlers of your data
    To do so, simply paste the URI
    http://example.org/semanticweb.rdf
    into the respective fields of the following submission pages:
  4. Yahoo SearchMonkey
    Yahoo SearchMonkey currently considers RDF data only if either submitted via the (proprietary) DataRSS feed format or if embedded inside XHTML pages via RDFa. In other words, pure RDF/XML files are currently not included in Yahoo SearchMonkey without some extra effort. As a solution, we have developed a conversion tool RDF2DataRSS which generates DataRSS feeds from any RDF/XML file. The result can then be submitted to Yahoo SearchMonkey directly.
    The RDF2DataRSS tool will be released shortly. Please contact us if you have any questions in the meantime.
  5. Server Configuration
    Make sure your server uses the proper media type (content type) "application/rdf+xml" when returning the semanticweb.rdf file. You can check this using either the "curl" tool on the command line or online services like

    http://www.webmaster-toolkit.com/http-header-viewer.shtml

    If that shows "Content-Type: application/rdf+xml", you are all set. If not, ask your hosting service to fix that. If you have sufficient privileges and if your site is hosted on an Apache server, you can also simply add the following lines to the .htaccess file (make sure you mind the dot when uploading the file!): 
    #Directive to ensure *.rdf files served as appropriate content type,
  6. if not present in main apache config

AddType application/rdf+xml .rdf


Additional Resources

  • The new draft "httpbis" RFC supports adding cache headers to a 303 response, in addition to the cache headers on the 200 responses so that users do not have to repeatedly
    check whether the 303 response redirects to the same location. (Thanks to Peter Ansell!)

Publishing RDF/XML Data on MS IIS Platforms

This document will be extended. In the meantime, we recommend the following document:
Cool URIs for the Semantic Web, W3C Interest Group Note 03 December 2008
http://www.w3.org/TR/cooluris/