Syntaxes4GoodRelations

GoodRelations-compliant data can be published in a variety of syntactial variants. The most popular choice is RDFa in HTML/XHTML Web content and RDF/XML for data dump files.
However, it is easily possible to use any of the following formats depending on your needs and middleware:

  • RDFa in HTML
  • RDF/XML
  • Microdata
  • Turtle
  • JSON-LD
  • dataRSS
  • NTriples
  • OData
  • GData

Below, please find simple examples for syntactical variants. We do not yet have those for OData and GData, but this is just because there is currently no tooling available to generate that automatically.
A lot of conversion work can be simplified using the following tools:


RDFa in HTML/XHTML

RDF/XML

   ``
       ``Hepp Space Ventures``
       ``Your preferred supplier for space adventures.``
       ``
   ``

Microdata

Hepp Space Ventures

Your preferred supplier for space adventures.

Hot deal: 16-bit SCSI Controller``

JSON-LD

tbd, http://rdfa.digitalbazaar.com/specs/source/json-ld/

Turtle

@prefix gr: <http://purl.org/goodrelations/v1#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
<http://www.heppnetz.de/searchmonkey/#business> rdf:type gr:BusinessEntity ;
    gr:legalName "Hepp Space Ventures" ;
    rdfs:comment "Your preferred supplier for space adventures." ;
    gr:offers <http://www.heppnetz.de/searchmonkey/#myoffer> .

NTriples

<http://www.heppnetz.de/searchmonkey/#business> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/goodrelations/v1#BusinessEntity> .
<http://www.heppnetz.de/searchmonkey/#business> <http://purl.org/goodrelations/v1#legalName> "Hepp Space Ventures" .
<http://www.heppnetz.de/searchmonkey/#business> <http://www.w3.org/2000/01/rdf-schema#comment> "Your preferred supplier for space adventures." .
<http://www.heppnetz.de/searchmonkey/#business> <http://purl.org/goodrelations/v1#offers> <http://www.heppnetz.de/searchmonkey/#myoffer> .

dataRSS

xmlns:y="http://search.yahoo.com/datarss/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2005/Atom ../latest/xsd/datarss.xsd"> http://www.heppnetz.de/searchmonkey/ 2010-05-28T10:33:09+02:00 GR RDF2DataRSS Converterhttp://www.ebusiness-unibw.org/tools/rdf2datarss/ GR RDF2DataRSS Converterhttp://www.ebusiness-unibw.org/tools/rdf2datarss/ http://www.heppnetz.de/projects/goodrelations/goodrelations-logo-small.gif

<p>Converted rdf to DataRSS data for Yahoo SearchMonkey</p>

http://www.heppnetz.de/searchmonkey/

<p>Converted RDF data from <a href="http://www.heppnetz.de/searchmonkey/" class="uri">http://www.heppnetz.de/searchmonkey/</a></p>

   ``Hepp Space Ventures``
   ``Your preferred supplier for space adventures.``
   ``

OData

It is possible to represent GoodRelations data in OData syntax. Kingsley Idehen from OpenLink Software created the following example for the book "Beautiful Data" from Amazon.

Original:

Example:

   ``http://idehen.net/sparql?default-graph-uri=http%3A%2F%2Flinkeddata.uriburner.com%2Fabout%2Fid%2Fentity%2Fhttp%2Fwww.amazon.com%2Fo%2FASIN%2F0596157118&should-sponge=&query=define+get%3Asoft+%22replace%22%0D%0A%0D%0Adescribe+%3Chttp%3A%2F%2Flinkeddata.uriburner.com%2Fabout%2Fid%2Fentity%2Fhttp%2Fwww.amazon.com%2Fo%2FASIN%2F0596157118%23Offer_1%3E%0D%0Afrom+%3Chttp%3A%2F%2Flinkeddata.uriburner.com%2Fabout%2Fid%2Fentity%2Fhttp%2Fwww.amazon.com%2Fo%2FASIN%2F0596157118%3E&format=application%2Fatom%2Bxml&debug=on&timeout=
   ``2010-05-31T09:15:35.000001Z``
   ``
   

<p>OData Service and Descriptor Document</p>

   ``
       ``http://linkeddata.uriburner.com/about/id/entity/http/www.amazon.com/o/ASIN/0596157118#Offer_1
       ``
       ``
       ``
       ``
       ``
       ``
       ``
       

<p>Beautiful Data: The Stories Behind Elegant Data Solutions</p>

       ``2010-05-31T09:15:35.000001Z``
       ``
       ``
           ``
               ``xhCVoQADceY4Q3QnrRPYkowicRkxCfn0tS57nAKrTepqP67JOIeqTY5OtDxq4ax1B%2F3KCtIgci4Y9yEiOQvuuJny8Dl33OgKVvA4%2BXGgqcNFmSkLjn41mOpp1wHQuBc9spsNqoOMFTg6erp0TsKnPw%3D%3D``
               ``9780596157111``
               ``New``
               ``Brand NEW over 200k titles In Stock..100% Money Back Guarantee..Tracking and Delivery Notification sent to your email``
               ``Usually ships in 1-2 business days``
               ``2010-05-30 19:52:32.000001``
               ``A2OMGVG4337Z2A``
               ``Beautiful Data: The Stories Behind Elegant Data Solutions``
           ``

       ``

   ``

GData

It is possible to represent GoodRelations data in GData syntax, but we have not yet done this.