Warning:
This wiki has been archived and is now read-only.

RDFa

From Open Annotation Community Group
Jump to: navigation, search

Modified example

This is the latest version of the starting example below in this page.

See thread: http://lists.w3.org/Archives/Public/public-openannotation/2014Jan/0082.html

Changes from previous version:

  • updated the Target section to reflect current OA specs:
    • modified the 'blockquote to represent a SpecificResource
    • included a 'details' section for including the document source 'hasSource'
    • added a 'div' element for representing the TextQuoteSelector
    • included prefix and suffix as 'meta' tags to fully describe the selector
  • updated the textual body to include the Content in RDF properties (with prefix cnt)
    • Comment (Ivan): I wonder whether there are no alternatives to 'cnt' that would make this simpler.

 <aside vocab="http://www.w3.org/ns/oa#" typeof="Annotation">
      <p>
        <a property="annotatedBy" href="http://example.com/people/shepazu" typeof="foaf:Person">
           <span property="foaf:name">Shepazu</span>
         </a>
      </p>
      <time property="annotatedAt" datetime="2014-01-14T01:28:22-0500">
        <a href="http://example.com/annotations/shepazu-1389680902"
           title="1:28 AM - 14 Jan 2014">A few minutes ago</a>
      </time>

     <blockquote property="hasTarget"
            typeof="SpecificResource" cite="http://example.com/sourcedoc.html" >
            <details>
                <summary>Source</summary>
                <a property="hasSource" resource="http://example.com/sourcedoc.html" href="http://example.com/sourcedoc.html">http://example.com/sourcedoc.html</a>
            </details>
            <div property="hasSelector" typeof="TextQuoteSeletor">
                <meta property="prefix" content="essential feature of the memex.">
                <p property="exact">The process of tying two items together is the important thing.</p>
                <meta property="suffix" content="When the user is building a tra">
            <div>
            <footer>
              - <cite>
                     <a href="http://en.wikipedia.org/wiki/Vannevar_Bush">
                        <span>Vannevar Bush</span>
                     </a>
                </cite>
            </footer>
      </blockquote>
      <p property="hasBody" prefix="cnt:http://www.w3.org/2011/content#" typeof="cnt:ContentAsText"><span property="cnt:chars">Annotations are at the Web's core.</span></p>
  </aside>

Resulting JSON-LD


{
   "@type": "Annotation", 
   "hasBody": {
      "@type": "cnt:ContentAsText", 
      "cnt:chars": "Annotations are at the Web's core."
   }, 
   "hasTarget":  {
      "@type": "SpecificResource", 
      "hasSource": "http://example.com/sourcedoc.html", 
      "hasSelector": {
         "@type": "TextQuoteSeletor", 
         "exact": "The process of tying two items together is the important thing.", 
         "prefix": "essential feature of the memex.", 
         "suffix": "When the user is building a tra"
      }
   },  
   "annotatedBy": {
      "@id": "http://example.com/people/shepazu", 
      "@type": "foaf:Person", 
      "foaf:name": "Shepazu"
   }, 
   "annotatedAt": "2014-01-14T01:28:22-0500"
}

Starting example (Obsolete)

From http://lists.w3.org/Archives/Public/public-openannotation/2014Jan/0038.html


 <aside vocab="http://www.w3.org/ns/oa#" typeof="Annotation">
      <p>
        <a property="annotatedBy" href="http://example.com/people/shepazu" typeof="foaf:Person">
           <span property="foaf:name">Shepazu</span>
         </a>
      </p>
      <time property="annotatedAt" datetime="2014-01-14T01:28:22-0500">
        <a href="http://example.com/annotations/shepazu-1389680902"
           title="1:28 AM - 14 Jan 2014">A few minutes ago</a>
      </time>

      <blockquote property="hasTarget"
                  resource="http://example.com/sourcedoc.html"
                  cite="http://example.com/sourcedoc.html"
                  data-prefix="essential feature of the memex. "
                  data-suffix=" When the user is building a tra" typeof="">
        <p>The process of tying two items together is the important thing.</p>
        <footer>
          - <cite>
                 <a href="http://en.wikipedia.org/wiki/Vannevar_Bush">
                    <span>Vannevar Bush</span>
                 </a>
            </cite>
        </footer>
      </blockquote>
      <p property="hasBody" typeof=""><span property="rdf:value">Annotations are at the Web's core.</span></p>
      <ul property="hasBody" typeof="SemanticTag">
         <li property="rdf:value">annotations</li>
         <li property="rdf:value">web</li>
         <li property="rdf:value">standards</li>
      </ul>
  </aside>

Resulting JSON-LD (you can verify yourself by using the RDFa 1.1 distiller


{
    "@context": "http://www.w3.org/ns/oa.json",
    "@type": "Annotation",
    "annotatedAt": "2014-01-14T01:28:22-0500",
    "annotatedBy": {
        "@id": "http://example.com/people/shepazu",
        "name": "Shepazu",
        "@type" : "Person"
    },
    "hasBody": [
        {
            "value" : "Annotations are at the Web's core."
        },
        {
            "@type": "SemanticTag",
            "value": [
                "web",
                "standards",
                "annotations"
            ]
        }
    ],
    "hasTarget": "http://example.com/sourcedoc.html"

}