Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RDFa content implementation for products

I'm knee deep in the nightmare that is RDFa implementation for product information and am curious if anyone out there can provide some insight.

Google flat out say's not to hide information just for the sake of providing data to machines unless it is information that is specific to machines. I could not find any information on the subject of having empty elements for the sake of providing this data though.

If you take a look at the GoodRelations RDFa generator for commerce, you'll get a mess of nested div's that you're told to put at the bottom of your item page. I'll use one of my favorite sites for example:

<div 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:gr="http://purl.org/goodrelations/v1#"
  xmlns:foaf="http://xmlns.com/foaf/0.1/">

  <div typeof="gr:Offering" about="#offering">
    <div rev="gr:offers" resource="#company"></div>
    <div property="rdfs:label" content="Alpinestars S-MX Plus Racing Boots" xml:lang="en"></div>
    <div property="rdfs:comment" content="Alpinestars’ S-MX Plus racing boot raises performance and safety to new and unmatched levels with its innovative design, structural protection and comfort." xml:lang="en"></div>
    <div property="gr:hasEAN_UCC-13" content="0000000000000" datatype="xsd:string"></div>
    <div rel="foaf:depiction" resource="http://www.motorcycle-superstore.com/ProductImages/300/g17268.jpg"></div>
    <div rel="gr:hasBusinessFunction" resource="http://purl.org/goodrelations/v1#Sell"></div>
    <div rel="gr:hasPriceSpecification">
      <div typeof="gr:UnitPriceSpecification">
        <div property="gr:hasCurrency" content="USD" datatype="xsd:string"></div>
        <div property="gr:hasCurrencyValue" content="349.95" datatype="xsd:float"></div>
        <div property="gr:hasUnitOfMeasurement" content="C62" datatype="xsd:string"></div>
      </div>
    </div>
    <div rel="gr:acceptedPaymentMethods" resource="http://purl.org/goodrelations/v1#PayPal"></div>
    <div rel="gr:acceptedPaymentMethods" resource="http://purl.org/goodrelations/v1#AmericanExpress"></div>
    <div rel="gr:acceptedPaymentMethods" resource="http://purl.org/goodrelations/v1#Discover"></div>
    <div rel="gr:acceptedPaymentMethods" resource="http://purl.org/goodrelations/v1#MasterCard"></div>
    <div rel="gr:acceptedPaymentMethods" resource="http://purl.org/goodrelations/v1#VISA"></div>
    <div rel="foaf:page" resource="http://www.motorcycle-superstore.com/1/1/36/77/ITEM/Alpinestars-S-MX-Plus-Racing-Boots.aspx"></div>
  </div>
</div>

What I find interesting in their implementation — which Best Buy has used with great success — is that there is no actual content in the tags here, rather there is just a content attribute.

My question then is, does anyone have any insight into this type of implementation and whether or not there is a penalty for using an empty div structure that utilizes the content attribute over adding the RDFa structure to the existing markup?

like image 583
S16 Avatar asked Jul 01 '10 17:07

S16


1 Answers

that is RDFa in "snippet style". Full argument & background is here

http://www.ebusiness-unibw.org/tools/rdf2rdfa/

and here:

Hepp, Martin; García, Roberto; Radinger, Andreas: RDF2RDFa: Turning RDF into Snippets for Copy-and-Paste, Technical Report TR-2009-01, 2009. PDF at the bottom of the page above.

Basically, there is a trade-off between a) reusing visible content for data markup and b) separation of concerns. As long as the data structures and the organization of the markup for visible content match almost 1:1, you can easily use RDFa in the traditional style. But otherwise enforcing the structure of the visible markup on the modeling of the rich meta-data creates messy markup, hard to maintain, error-prone.

Best wishes

Martin Hepp

Addition: You can use GoodRelations in RDFa in XHTML, HTML5, and HTML4 templates, despite the different state of the standardization of respective DOCTYPEs. Here are the proper DOCTYPE settings:

  1. XHTML: a) Set DOCTYPE to XHTML+RDFa 1.0: b) Set html version attribute to XHTML+RDFa1.0

  2. HTML5 a) Set DOCTYPE to html b) Set html version attribute to HTML+RDFa1.1

Note that is is only a W3C Working Draft at this stage, but should work nonetheless.

  1. Other HTML markup Either use HTML5 recipe or simply set the html version attribute to HTML+RDFa1.1 or XHTML+RDFa1.0. Most clients will extract RDF from this type. or

See also: http://answers.semanticweb.com/questions/1187/can-i-use-the-html5-doctype-with-rdfa

like image 126
Martin Hepp Avatar answered Oct 14 '22 23:10

Martin Hepp