Personal tools

From Common Tag

Jump to: navigation, search

Contents

Introduction

Common Tags are defined using RDFa, a standard format for expressing structured data within HTML. This guide was designed to help you get started using the Common Tag format even if you don't know RDFa. The examples can be used as simple cut-and-paste recipes to tag your content using the Common Tag format. Common Tags are not only useful for identifying the concepts covered in your content, but if you reference content elsewhere on the web, Common Tags can be used to indicate the concepts covered in that external content as well. This is useful for better describing and organizing the content of external resources from within your own content. For example, you could use Common Tags to publish bookmarks to identify the concepts described by a link, or you could use them categorize image collections stored elsewhere on the web.


The Common Tag format uses the URIs of concepts defined on the web as a way of anchoring the meaning of Tag objects (Tags). The URIs used with the Common Tag format should be those that refer to machine-readable repositories of structured data. This allows applications to understand the relationships between Tags without any effort on the part of the individual or system creating the Tag. These URIs should also refer to structured RDF-enabled content, which allows for the development of new types of applications that can enhance the value of existing content without requiring any integration effort on the part of the content developer.

The two databases of structured content used in the examples below are:

  • Freebase - A community managed database of concepts
  • DBPedia - A machine readable version of Wikipedia

For the full technical specification of Common Tag, visit the Specification section of the site.

As you learn more about RDFa you should feel free to make use of RDFa's flexibility to extend the expressiveness of the Common Tag format.


Quick Start

Tagging whole documents

While Common Tags allow you identify the concepts within individual blocks of content, the easiest way to get started is to provide Tags indicating what concepts are covered in the current document as a whole.

Unambiguously identifying the concepts covered in a document

At a minimum, you should use Tags to identify the concepts described in the document.

For example, to indicate that the document is about the band U2

<body xmlns:ctag="http://commontag.org/ns#" rel="ctag:tagged">
    <span typeof="ctag:Tag" rel="ctag:means" 
         resource="http://rdf.freebase.com/ns/en.u2"/>
</body>

Note: While this example places the Tag in a body element and a subsequent span element, the markup can be placed in any parent/child elements within the document.

Including a human readable label for a Tag

Tags can optionally include a human readable label that can be used when displaying a list of the concepts covered in a document.

To add a display label indicating that the document is about the band U2:

<body xmlns:ctag="http://commontag.org/ns#" rel="ctag:tagged">
    <span typeof="ctag:Tag" 
              rel="ctag:means" resource="http://rdf.freebase.com/ns/en.u2" 
              property="ctag:label" content="U2"/>
    </span>
</body>

Mutiple Tags for the same document

You can create as many Tags as necessary to describe the contents of a document. Each Tag should describe one concept and optionally provide one human label for the concept.

Two Tags indicating that the document is about the band U2 and their ZooTV Tour:

<body xmlns:ctag="http://commontag.org/ns#" rel="ctag:tagged"> 
    <span typeof="ctag:Tag" 
              rel="ctag:means" resource="http://rdf.freebase.com/ns/en.u2" 
              property="ctag:label" content="U2"/>
              
    <span typeof="ctag:Tag" 
              rel="ctag:means" resource="http://rdf.freebase.com/ns/en/zoo_tv_tour" 
              property="ctag:label" content="ZooTV"/>
</body>

Defining Tags for documents (other than the one the Tag is defined in)

In all of the previous examples, we have created Tags that describe the document the Tags occur in. But the Common Tag format can be used to indicate the concepts described by documents located anywhere on the web. To tag content outside the current document you simply need to specify the full URL for the location of the document you wish to tag in an "about" attribute.

For instance if you wanted to tag President Obama's Inaugural Address in a blog post you were creating, to indicate that the speech discussed "social responsibility" you could use this markup:

<div xmlns:ctag="http://commontag.org/ns#"
         about="http://www.whitehouse.gov/blog/inaugural-address/" rel="ctag:tagged">  
    <span typeof="ctag:Tag" 
         rel="ctag:means" resource="http://rdf.freebase.com/ns/en.social_responsibility"/>
</div>

Defining Tags for sections of content

Just as you can tag content in other documents by making reference to the URL for the content prior to the rel="ctag:tagged" attribute, you can use the same mechanism for referencing any section of content by referencing the "id" attribute for the DOM element containing the content in the URL.

For instance, if you had a document which contained two paragraphs using the markup:

<p id="first">Star Wars set a new standard for visual effects in space drama. </p>
<p id="second">Luke's interest in his heritage made him vulerable to the Dark Side.  </p>

To indicate that the second paragraph is about Luke Skywalker and not some other Luke, you could tag the content of the second paragraph with the following markup (which could appear anywhere in the document.)

<div xmlns:ctag="http://commontag.org/ns#"
         about="#second" rel="ctag:tagged">  
    <span typeof="ctag:Tag" 
         rel="ctag:means" resource="http://dbpedia.org/resource/Luke_Skywalker"/>
</div>

Note: By using an absolute URL you could tag the second paragraph from another document.

Interleaving Tag Definition with other markup

You can make use of the anchor text within an HTML anchor tag to supply the human label for a Tag.

<div xmlns:ctag="http://commontag.org/ns#" rel="ctag:tagged">
   NASA's <a typeof="ctag:Tag" rel="ctag:means"
               href="http://rdf.freebase.com/ns/en.phoenix_mars_mission"
               property="ctag:label">Phoenix Mars Lander</a> has deployed its robotic arm. 
</div>


The Common Tag Model

The Common Tag format is based on RDFa, a standard mechanism for placing structured content within HTML documents. The RDFa standard was developed by the W3C and is supported by both Yahoo! and Google as a way of providing additional information about the page to search engines.

The Common Tag structural model is very simple. It states that a piece of content addressable through a URL (a "resource") can be "tagged" with one or more Tag structures. Each Tag can contain a pointer to another resource that identifies the concepts described by the content, unambiguously indicating what the content "means." Optionally, the Tag may also contain information about when the Tag was created (the "tagging date") and what human readable "label" should be used when listing the concepts covered in the content.

Advanced Topics

Indicating how a Common Tag was created

The Common Tag format defines three additional types of Tags that can be used to indicate how a Tag was created.

To indicate how a Tag was created replace the typeof="ctag:Tag" statement with one of the following:

  • ctag:AuthorTag When the content creator has specified the Tag
  • ctag:ReaderTag When a content user has specified the Tag. This is appropriate when the Tag created makes reference to content not under the control of the person creating the Tag. For instance, in the example above where Obama's inaugural address is tagged the Tag creator could use typeof="ctag:ReaderTag" to indicate the a content consumer is assigning the Tag. Similarly, ReaderTags are appropriate to use when bookmarks are being published.
  • ctag:AutoTag When an algorithmic tagging system has generated the Tag

Enhancing Common Tags with other RDFa vocabularies

Because Common Tags are based on RDFa, it is possible to extend the Common Tag format by adding additional information from other RDF vocabularies. For instance, you can use the Friend Of A Friend (FOAF) vocabulary to specify who created a Tag.

For example, to indicate that the Faviki user "jamietaylor" tagged the BBC page about U2's roof-top performance with the Tag "U2":

<body xmlns:ctag="http://commontag.org/ns#" 
          about="http://www.bbc.co.uk/musicevents/u2/" rel="ctag:tagged">  
    <span typeof="ctag:ReaderTag"> 
         <span rel="ctag:means"  resource="http://rdf.freebase.com/ns/en.u2"/>
        <span rel="foaf:maker" resource="http://faviki.com/person/jamietaylor#me"/>
    </span>
</body>

Note: The "typeof" statement is responsible for creating the Tag node. Thus the child span elements each convey a property associated with the Tag.

Common Tag with more advanced RDFa

Because RDFa is built on RDF you can tag anything that is identified with a URI. Thus you can also tag embedded content like video, audio and images.

Tagging an embedded video

Embedded content objects can be tagged as follows:

<body xmlns:ctag="http://commontag.org/ns#">

    <span typeof="ctag:Tag">

      <object width="560" height="340" rev="ctag:tagged">
          <param name="movie" value="http://www.youtube.com/v/VQ3d3KigPQM"></param>
          <param name="allowFullScreen" value="true"></param>
          <param name="allowscriptaccess" value="always"></param>
          <embed src="http://www.youtube.com/v/VQ3d3KigPQM" 
               type="application/x-shockwave-flash" allowscriptaccess="always" 
               allowfullscreen="true" width="560" height="340"></embed>
      </object>

      <span rel="ctag:means" resource="http://rdf.freebase.com/ns/en.flash_mob" />
    </span>
</body>

Tagging an image

To tag an "empty" DOM element, such as an image, you can user the "rev" attribute to specify the src of the image as the subject of the Tag. For example:

<span xmlns:ctag="http://commontag.org/ns#" typeof="ctag:Tag">
  <span rev="ctag:tagged">
      <img src="http://www.nasa.gov/images/content/297106main_vert_12_516-387.jpg"/>
  </span>
  <span rel="ctag:means" resource="http://rdf.freebase.com/ns/en.phoenix_mars_mission"/>
</span>