Microdata

=GoodRelations and Microdata Syntax=

While many Web vocabularies are tied to a single syntax, GoodRelations can be used in a variety of syntaxes, namely


 * RDFa,
 * Microdata,
 * Turtle (RDF),
 * RDF/XML (RDF),
 * JSON,
 * GData, and
 * OData.

For Web developers, RDFa and Microdata are the most important ones. We do not want to enter the discussion whether one of the two is better on this page, since both can be used in similar ways. In short one can say that
 * RDFa integrates better into the larger W3C Semantic Web technology stack while
 * Microdata has significant advantages from the perspective of adding meta-data to HTML markup.

Overview
The main difference between using GoodRelations in Microdata and in RDFa is that you use just the local part of a property identifier (e.g. legalName for http://purl.org/goodrelations/v1#legalName) when inside the scope of a GoodRelations class as the type of a node.

When using a GoodRelations property within the scope of an external type (e.g. http://schema.org/Offer) or when using an externally defined property within the scope of a GoodRelations type, you must use the full URI (e.g. http://schema.org/telephone).

Microdata does not support "compact" URIs (CURIES) in the form

prefix:local_part

(e.g gr:legalName).

Example:  ACME Bagel Bakery Ltd.    Contact Details: Tel: +49-89-12345678-0 ,

Scenario 1: Using GoodRelations in Microdata syntax
You can use GoodRelations directly in Microdata syntax:

 Hepp Personal SCSI Controller Card The Hepp Personal SCSI is a 16-bit add-on card that allows attaching up to seven SCSI devices to your computer.  Price: $ 99.99     Condition: used EAN/UPC: 1234567890123 MPN: PSCSI Article No. 123-456 Availability:  In-stock

Scenario 2: Using GoodRelations properties to extend schema.org types
You can use GoodRelations elements to extend schema.org types by details that are not covered by schema.org, e.g. shipping charges or eligible countries. In that case you have to use the full URIs for properties that are provided by GoodRelations when used to augment schema.org types. As soon as the type to which you apply the property is again from GoodRelations, you can use the local part of the property names. See the following example in which
 * http://purl.org/goodrelations/v1#hasBusinessFunction is applied to the type http://schema.org/Offer and thus requires a full URI, while
 * eligibleRegions is applied to the type http://purl.org/goodrelations/v1#DeliveryChargeSpecification and can thus have just the local part of the property identifier.

 Hepp Personal SCSI Controller Card The Hepp Personal SCSI is a 16-bit add-on card that allows attaching up to seven SCSI devices to your computer. 

Delivery costs to  Germany: Euro: 10.00    (via UPS)

...

Scenario 3: Using schema.org properties to extend GoodRelations types
You can used schema.org properties and types in combination with GoodRelations types. This is in particular recommended for attaching images, addresses, and geo-location information information, because such will then all come from a single complementing vocabulary instead of from various Web vocabularies (vCard, geo, WGS84, FOAF, ...).

<div itemscope itemtype="http://purl.org/goodrelations/v1#BusinessEntity"> ACME Bagel Bakery Ltd. Contact Details: <div itemscope itemprop="http://schema.org/address" itemtype="http://schema.org/PostalAddress"> Main address: Bagel Street 1234 12345      Munich, Germany

Tel: <span itemprop="http://schema.org/telephone">+49-89-12345678-0 , Fax: <span itemprop="http://schema.org/faxNumber">+49-89-12345678-99 ,

Scenario 4: Using GoodRelations from the schema.org Namespace
We are working with the schema.org sponsors, namely Google, Yahoo, Bing, and Yandex, on the integration of GoodRelations into the schema.org core. This will mean that you can use the full expressivity of GoodRelations directly from the schema.org namespace in Microdata syntax soon. A preview of the resulting markup is here. Stay tuned!

Note: This will be an additional syntactical form of using GoodRelations for your site. GoodRelations will remain an independent vocabulary, and in RDFa and other RDF syntaxes, the original namespace of GoodRelations will remain the primary location.

Links: E-mail: <span itemprop="http://schema.org/email">contact@example.org <link itemprop="http://schema.org/url" href="http://www.acme-bagels.com/" />
 * Public Draft
 * Entry on the W3C Wiki
 * Recipe in the GoodRelations Cookbook

Official Microdata Processing Rules
The official Microdata processing rules for GoodRelations are now part of the GoodRelations specification.

RDF Representation of GoodRelations from Microdata Markup
If you parse GoodRelations data in Microdata syntax, the URIs for all properties should be built by directly attaching the local part of a property (e.g. legalName) to the base URI of the vocabulary (http://purl.org/goodrelations/v1#).

So the URI of the legalName property from the example above should be http://purl.org/goodrelations/v1#legalName.