Difference between revisions of "Extend Metadata"
Jon Phillips (talk | contribs) (→LINKing to a data: URL) |
(fixed link to schema) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 8: | Line 8: | ||
Familiar with RDF and want to know how this fits in with the larger picture? | Familiar with RDF and want to know how this fits in with the larger picture? | ||
− | * View our [http:// | + | * View our [http://creativecommons.org/schema.rdf RDF schema] for information about [http://creativecommons.org/ns our model] in a machine-processable form. |
* Read our report on how to use [[#Defining dc:rights|dc:rights]]. | * Read our report on how to use [[#Defining dc:rights|dc:rights]]. | ||
* Take a look at [[#Embedding RDF in HTML|our conclusions on using RDF in HTML]]. | * Take a look at [[#Embedding RDF in HTML|our conclusions on using RDF in HTML]]. | ||
Line 22: | Line 22: | ||
We've decided to use dc:rights to hold a more structured description of the copyright holder. Here's an example: | We've decided to use dc:rights to hold a more structured description of the copyright holder. Here's an example: | ||
− | < | + | <source lang="XML"> |
<dc:rights> | <dc:rights> | ||
<Agent rdf:about="http://me.yoyo.dyne.name/"> | <Agent rdf:about="http://me.yoyo.dyne.name/"> | ||
Line 30: | Line 30: | ||
</dc:rights> | </dc:rights> | ||
− | </ | + | </source> |
As you can see the copyright holder is a person with a URL, a name and a date (of birth). | As you can see the copyright holder is a person with a URL, a name and a date (of birth). | ||
Line 46: | Line 46: | ||
becomes this chunk of RDF: | becomes this chunk of RDF: | ||
− | < | + | <source lang="XML"> |
<rdf:Description> | <rdf:Description> | ||
<dc:date>2002</dc:date> | <dc:date>2002</dc:date> | ||
Line 54: | Line 54: | ||
</Agent></dc:rights> | </Agent></dc:rights> | ||
</rdf:Description> | </rdf:Description> | ||
− | </ | + | </source> |
'''Note:''' The actual text and description of the license ("...place up to three (3) copies...") is not included in this RDF, but would presumably be available at the URL given for the license. | '''Note:''' The actual text and description of the license ("...place up to three (3) copies...") is not included in this RDF, but would presumably be available at the URL given for the license. | ||
Line 60: | Line 60: | ||
== Embedding RDF in HTML == | == Embedding RDF in HTML == | ||
− | There may be lots of RDF out there, but it's no good if no one can find it. Since almost everything on the Web is HTML, we need a good way to hook RDF into the HTML Web. Here are | + | There may be lots of RDF out there, but it's no good if no one can find it. Since almost everything on the Web is HTML, we need a good way to hook RDF into the HTML Web. Here are some ways to do so: |
=== LINKing to an external file === | === LINKing to an external file === | ||
Line 73: | Line 73: | ||
A data: URL (see [http://www.ietf.org/rfc/rfc2397.txt RFC 2397]) encapsulates data into the URL itself. If used as the <code>href</code> attribute of a <code><link></code> element, it can include an RDF document verbatim. | A data: URL (see [http://www.ietf.org/rfc/rfc2397.txt RFC 2397]) encapsulates data into the URL itself. If used as the <code>href</code> attribute of a <code><link></code> element, it can include an RDF document verbatim. | ||
− | + | <source lang="XML"><link rel="meta" type="application/rdf+xml" href="data:application/rdf+xml,%3Crdf%3ARDF%20xmlns%3D%22http%3A%2F%2Fweb.resource.org%2Fcc%2F%22%0D%0A%20%20%20%20xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%0D%0A%20%20%20%20xmlns%3Ardf%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%22%3E%0D%0A%3CWork%20rdf%3Aabout%3D%22http%3A%2F%2Fexample.org%2Fgnomophone.mp3%22%3E%0D%0A%20%20%3Cdc%3Atitle%3ECompilers%20in%20the%20Key%20of%20C%3C%2Fdc%3Atitle%3E%0D%0A%20%20%3Cdc%3Adescription%3EA%20lovely%20classical%20work%20on%20compiling%20code.%3C%2Fdc%3Adescription%3E%0D%0A%20%20%3Cdc%3Acreator%3E%3CAgent%3E%0D%0A%20%20%20%20%3Cdc%3Atitle%3EYo-Yo%20Dyne%3C%2Fdc%3Atitle%3E%0D%0A%20%20%3C%2FAgent%3E%3C%2Fdc%3Acreator%3E%0D%0A%20%20%3Cdc%3Arights%3E%3CAgent%3E%0D%0A%20%20%20%20%3Cdc%3Atitle%3EGnomophone%3C%2Fdc%3Atitle%3E%0D%0A%20%20%3C%2FAgent%3E%3C%2Fdc%3Arights%3E%0D%0A%20%20%3Cdc%3Adate%3E1842%3C%2Fdc%3Adate%3E%0D%0A%20%20%3Cdc%3Aformat%3Eaudio%2Fmpeg%3C%2Fdc%3Aformat%3E%0D%0A%20%20%3Cdc%3Atype%20rdf%3Aresource%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Fdcmitype%2FSound%22%20%2F%3E%0D%0A%20%20%3Cdc%3Asource%20rdf%3Aresource%3D%22http%3A%2F%2Fexample.net%2Fgnomovision.mov%22%20%2F%3E%0D%0A%20%20%3Clicense%20rdf%3Aresource%3D%22http%3A%2F%2Fcreativecommons.org%2Flicenses%2Fby-nc-nd%2F2.0%2F%22%20%2F%3E%0D%0A%20%20%3Clicense%20rdf%3Aresource%3D%22http%3A%2F%2Fwww.eff.org%2FIP%2FOpen_licenses%2Feff_oal.html%22%20%2F%3E%0D%0A%0D%0A%3C%2FWork%3E%0D%0A%0D%0A%3CLicense%20rdf%3Aabout%3D%22http%3A%2F%2Fcreativecommons.org%2Flicenses%2Fby-nc-nd%2F2.0%2F%22%3E%0D%0A%20%20%3Cpermits%20rdf%3Aresource%3D%22http%3A%2F%2Fweb.resource.org%2Fcc%2FReproduction%22%20%2F%3E%0D%0A%20%20%3Cpermits%20rdf%3Aresource%3D%22http%3A%2F%2Fweb.resource.org%2Fcc%2FDistribution%22%20%2F%3E%0D%0A%20%20%3Crequires%20rdf%3Aresource%3D%22http%3A%2F%2Fweb.resource.org%2Fcc%2FNotice%22%20%2F%3E%0D%0A%20%20%3Crequires%20rdf%3Aresource%3D%22http%3A%2F%2Fweb.resource.org%2Fcc%2FAttribution%22%20%2F%3E%0D%0A%20%20%3Cprohibits%20rdf%3Aresource%3D%22http%3A%2F%2Fweb.resource.org%2Fcc%2FCommercialUse%22%20%2F%3E%0D%0A%0D%0A%3C%2FLicense%3E%0D%0A%3C%2Frdf%3ARDF%3E" /></source> | |
* '''Pro:''' It includes the data in the HTML document; it doesn't break old browsers; it's standard-compliant; it uses the proper element (link) for associating metadata | * '''Pro:''' It includes the data in the HTML document; it doesn't break old browsers; it's standard-compliant; it uses the proper element (link) for associating metadata | ||
− | * '''Con:''' It requires the RDF to be URL-encoded; it's hard to read; not all URL libraries can recognize or decode a data: URL; Creative Commons tools ([[MozCC]], [[CcLookup]], etc) don't support it, likely browsers don't/won't support it; not a preferred method | + | * '''Con:''' It requires the RDF to be URL-encoded; it's hard to read; not all URL libraries can recognize or decode a data: URL; Creative Commons tools ([[MozCC]], [[CcLookup]], etc) don't support it, likely browsers don't/won't support it; not a preferred method. |
− | See also: [http://software.hixie.ch/utilities/cgi/data/data data: URI kitchen] (tool for making data: URLs), [http://www.mozilla.org/quality/networking/docs/aboutdata.html about data: URLs] (from Mozilla) | + | See also: [http://software.hixie.ch/utilities/cgi/data/data data: URI kitchen] (tool for making <code>data:</code> URLs), [http://www.mozilla.org/quality/networking/docs/aboutdata.html about data: URLs] (from Mozilla) |
=== In the HEAD === | === In the HEAD === | ||
Line 85: | Line 85: | ||
* '''Pro:''' Should be ignored by browsers. | * '''Pro:''' Should be ignored by browsers. | ||
− | * '''Con:''' Not all users may be able to. Doesn't validate. | + | * '''Con:''' Not all users may be able to insert content into the HEAD of their documents. Doesn't validate. Not a preferred method. |
=== In the BODY === | === In the BODY === | ||
Line 92: | Line 92: | ||
* '''Pro:''' Super simple. | * '''Pro:''' Super simple. | ||
− | * '''Con:''' RDF needs to be formatted as attributes. May cause problems with some browsers. Doesn't validate. | + | * '''Con:''' RDF needs to be formatted as attributes. May cause problems with some browsers. Doesn't validate. Not a preferred method. |
=== In META === | === In META === | ||
Line 100: | Line 100: | ||
Example: | Example: | ||
− | < | + | <source lang="XML"> |
<meta name="DC.rights" | <meta name="DC.rights" | ||
scheme="DCTERMS.URI" | scheme="DCTERMS.URI" | ||
Line 106: | Line 106: | ||
<meta name="DC.rights" | <meta name="DC.rights" | ||
content="(c) 2002 Gnomovision Records" /> | content="(c) 2002 Gnomovision Records" /> | ||
− | </ | + | </source> |
* '''Pro:''' Won't break anything. | * '''Pro:''' Won't break anything. | ||
− | * '''Con:''' Not all users may be able to. '''Not RDF''' (included in this list due to obviousness). Limited to statements about the current page. | + | * '''Con:''' Not all users may be able to. '''Not RDF''' (included in this list due to obviousness). Limited to statements about the current page. Not a preferred method. |
Further reading: [http://dublincore.org/documents/dcq-html/ Expressing Dublin Core in HTML/XHTML meta and link elements] | Further reading: [http://dublincore.org/documents/dcq-html/ Expressing Dublin Core in HTML/XHTML meta and link elements] | ||
− | === | + | === In a comment === |
− | + | The RDF can be included in a <code><!--comment--></code> in the document. The TrackBack system embeds its RDF in this way. | |
− | + | Note that if a literal "--" is included in a comment, it must be encoded as "--". | |
− | |||
− | |||
− | |||
− | |||
− | * '''Pro:''' Super simple | + | * '''Pro:''' Won't break anything. Super simple. |
− | * '''Con: | + | * '''Con:''' Not supported by all readers. Makes people queasy. |
− | + | === Using element attributes ([[RDFa]]) === | |
− | + | [[RDFa]] allows RDF to be expressed using a small set of attributes. The simple case of asserting a license only needs <code>rel="license"</code> added to the license link. Example: | |
− | + | <source lang="XML"> | |
+ | This work is licensed under the <a rel="license" | ||
+ | href="http://creativecommons.org/licenses/by/2.0/">Creative | ||
+ | Commons Attribution License</a>. | ||
+ | </source> | ||
− | + | * '''Pro:''' Super simple, extensible, [http://rdfa.info/wiki/How-to-validate validates]. | |
+ | * '''Con:''' Validation requires modifying the DOCTYPE which some users may be unable to do. | ||
− | + | See also: [[ccREL|Creative Commons Rights Expression Language]] | |
− | |||
=== Conclusions === | === Conclusions === | ||
Line 141: | Line 141: | ||
RDF readers should support all of these methods. | RDF readers should support all of these methods. | ||
− | We use and recommend | + | We use and recommend [[RDFa]] since it's easy, straight forward, powerful and doesn't break existing web clients (browsers). Our previous recommendation, including the RDF in an HTML comment, is no longer recommended. For more information on our use of RDFa and metadata strategy generally, see information on the [[ccREL|CC Rights Expression Language]]. |
+ | |||
+ | For the RDFa equivalent of the RDF/XML embedded using the data: URI scheme above see below: | ||
+ | <source lang="XML"><div xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/"> | ||
+ | <div about="http://example.org/gnomophone.mp3" typeof="cc:Work"> | ||
+ | <span property="dc:title" content="Compilers in the Key of C">foo</span> | ||
+ | <span property="dc:description" content="A lovely classical work on compiling code.">foo</span> | ||
+ | <span rel="dc:creator"><span typeof="cc:Agent" property="dc:title" content="Yo-Yo Dyne">foo</span></span> | ||
+ | <span rel="dc:rights"><span typeof="cc:Agent" property="dc:title" content="Gnomophone">foo</span></span> | ||
+ | <span property="dc:date" content="1842">foo</span> | ||
+ | <span property="dc:format" content="audio/mpeg">foo</span> | ||
+ | <a rel="dc:type" href="http://purl.org/dc/dcmitype/Sound">foo</a>, | ||
+ | <a rel="dc:source" href="http://example.net/gnomovision.mov">foo</a>, | ||
+ | <a rel="cc:license" href="http://creativecommons.org/licenses/by-nc-nd/2.0/">foo</a>, | ||
+ | <a rel="cc:license" href="http://artlibre.org/licence/lal/en/">foo</a>, | ||
+ | </div> | ||
+ | <div about="http://creativecommons.org/licenses/by-nc-nd/2.0/" typeof="cc:License"> | ||
+ | <a rel="cc:permits" href="http://web.resource.org/cc/Reproduction">foo</a>, | ||
+ | <a rel="cc:permits" href="http://web.resource.org/cc/Distribution">foo</a>, | ||
+ | <a rel="cc:requires" href="http://web.resource.org/cc/Notice">foo</a>, | ||
+ | <a rel="cc:requires" href="http://web.resource.org/cc/Attribution">foo</a>, | ||
+ | <a rel="cc:prohibits" href="http://web.resource.org/cc/CommercialUse">foo</a>, | ||
+ | </div> | ||
+ | </div></source> | ||
Further reading: [http://esw.w3.org/topic/EmbeddingRDFinHTML Embedding RDF in HTML] | Further reading: [http://esw.w3.org/topic/EmbeddingRDFinHTML Embedding RDF in HTML] |
Latest revision as of 08:11, 25 April 2013
Contents
Extending Creative Commons Metadata
Familiar with RDF and want to know how this fits in with the larger picture?
- View our RDF schema for information about our model in a machine-processable form.
- Read our report on how to use dc:rights.
- Take a look at our conclusions on using RDF in HTML.
If you've got comments or suggestions on any of this, don't hesitate to send us a note.
Defining dc:rights
Use of the Dublin Core dc:rights element has long been fraught with confusion and misunderstanding. A study of its use in practice shows a variety of different purposes and formats with little commonality. For the Creative Commons metadata specification, we wanted to define a profile of the rights element that was more useful and structured.
Most copyright statements consist of a statement of the date and copyright holder (i.e. "(C) 2002 Gnomovision Records. All rights reserved.") and the actual text of the legal license. The date can be described using dc:date, the copyright holder using dc:rights and the license can be linked to with cc:license.
We've decided to use dc:rights to hold a more structured description of the copyright holder. Here's an example:
<source lang="XML"> <dc:rights>
<Agent rdf:about="http://me.yoyo.dyne.name/"> <dc:title>Yo-Yo Dyne</dc:title> <dc:date>1001-10-01</dc:date> </Agent>
</dc:rights> </source>
As you can see the copyright holder is a person with a URL, a name and a date (of birth).
In this way we cover all the parts of the copyright notice in a way that RDF tools can deal with. As a full example, this plain text statement:
(C) 2002 Gnomovision Records. All rights reserved. This document has NO WARRANTY. You are permitted to copy it, modify it, and place up to three (3) copies of it on the White House lawn.
becomes this chunk of RDF:
<source lang="XML"> <rdf:Description>
<dc:date>2002</dc:date> <cc:license rdf:resource="http://flf.org/licenses/whiteHouseLawn" /> <dc:rights><Agent> <dc:title>Gnomovision Records</dc:title> </Agent></dc:rights>
</rdf:Description> </source>
Note: The actual text and description of the license ("...place up to three (3) copies...") is not included in this RDF, but would presumably be available at the URL given for the license.
Embedding RDF in HTML
There may be lots of RDF out there, but it's no good if no one can find it. Since almost everything on the Web is HTML, we need a good way to hook RDF into the HTML Web. Here are some ways to do so:
LINKing to an external file
RDF can be kept in a separate file (filename.rdf
) and linked to using <link rel="meta" type="application/rdf+xml" ... />
or an equivalent a href tag.
- Pro: Doesn't break anything.
- Con: Requires users to make files. Not supported by all readers.
LINKing to a data: URL
A data: URL (see RFC 2397) encapsulates data into the URL itself. If used as the href
attribute of a <link>
element, it can include an RDF document verbatim.
<source lang="XML"><link rel="meta" type="application/rdf+xml" href="data:application/rdf+xml,%3Crdf%3ARDF%20xmlns%3D%22http%3A%2F%2Fweb.resource.org%2Fcc%2F%22%0D%0A%20%20%20%20xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%0D%0A%20%20%20%20xmlns%3Ardf%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%22%3E%0D%0A%3CWork%20rdf%3Aabout%3D%22http%3A%2F%2Fexample.org%2Fgnomophone.mp3%22%3E%0D%0A%20%20%3Cdc%3Atitle%3ECompilers%20in%20the%20Key%20of%20C%3C%2Fdc%3Atitle%3E%0D%0A%20%20%3Cdc%3Adescription%3EA%20lovely%20classical%20work%20on%20compiling%20code.%3C%2Fdc%3Adescription%3E%0D%0A%20%20%3Cdc%3Acreator%3E%3CAgent%3E%0D%0A%20%20%20%20%3Cdc%3Atitle%3EYo-Yo%20Dyne%3C%2Fdc%3Atitle%3E%0D%0A%20%20%3C%2FAgent%3E%3C%2Fdc%3Acreator%3E%0D%0A%20%20%3Cdc%3Arights%3E%3CAgent%3E%0D%0A%20%20%20%20%3Cdc%3Atitle%3EGnomophone%3C%2Fdc%3Atitle%3E%0D%0A%20%20%3C%2FAgent%3E%3C%2Fdc%3Arights%3E%0D%0A%20%20%3Cdc%3Adate%3E1842%3C%2Fdc%3Adate%3E%0D%0A%20%20%3Cdc%3Aformat%3Eaudio%2Fmpeg%3C%2Fdc%3Aformat%3E%0D%0A%20%20%3Cdc%3Atype%20rdf%3Aresource%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Fdcmitype%2FSound%22%20%2F%3E%0D%0A%20%20%3Cdc%3Asource%20rdf%3Aresource%3D%22http%3A%2F%2Fexample.net%2Fgnomovision.mov%22%20%2F%3E%0D%0A%20%20%3Clicense%20rdf%3Aresource%3D%22http%3A%2F%2Fcreativecommons.org%2Flicenses%2Fby-nc-nd%2F2.0%2F%22%20%2F%3E%0D%0A%20%20%3Clicense%20rdf%3Aresource%3D%22http%3A%2F%2Fwww.eff.org%2FIP%2FOpen_licenses%2Feff_oal.html%22%20%2F%3E%0D%0A%0D%0A%3C%2FWork%3E%0D%0A%0D%0A%3CLicense%20rdf%3Aabout%3D%22http%3A%2F%2Fcreativecommons.org%2Flicenses%2Fby-nc-nd%2F2.0%2F%22%3E%0D%0A%20%20%3Cpermits%20rdf%3Aresource%3D%22http%3A%2F%2Fweb.resource.org%2Fcc%2FReproduction%22%20%2F%3E%0D%0A%20%20%3Cpermits%20rdf%3Aresource%3D%22http%3A%2F%2Fweb.resource.org%2Fcc%2FDistribution%22%20%2F%3E%0D%0A%20%20%3Crequires%20rdf%3Aresource%3D%22http%3A%2F%2Fweb.resource.org%2Fcc%2FNotice%22%20%2F%3E%0D%0A%20%20%3Crequires%20rdf%3Aresource%3D%22http%3A%2F%2Fweb.resource.org%2Fcc%2FAttribution%22%20%2F%3E%0D%0A%20%20%3Cprohibits%20rdf%3Aresource%3D%22http%3A%2F%2Fweb.resource.org%2Fcc%2FCommercialUse%22%20%2F%3E%0D%0A%0D%0A%3C%2FLicense%3E%0D%0A%3C%2Frdf%3ARDF%3E" /></source>
- Pro: It includes the data in the HTML document; it doesn't break old browsers; it's standard-compliant; it uses the proper element (link) for associating metadata
- Con: It requires the RDF to be URL-encoded; it's hard to read; not all URL libraries can recognize or decode a data: URL; Creative Commons tools (MozCC, CcLookup, etc) don't support it, likely browsers don't/won't support it; not a preferred method.
See also: data: URI kitchen (tool for making data:
URLs), about data: URLs (from Mozilla)
In the HEAD
RDF can be included inline in the <head>
tag of the document, along with the title and any <link>
s.
- Pro: Should be ignored by browsers.
- Con: Not all users may be able to insert content into the HEAD of their documents. Doesn't validate. Not a preferred method.
In the BODY
RDF can be included inline in the <body>
of the document, like any other HTML.
- Pro: Super simple.
- Con: RDF needs to be formatted as attributes. May cause problems with some browsers. Doesn't validate. Not a preferred method.
In META
A reference to the license a web page is offered under may be included in a <meta>
tag in the document's <head>
.
Example:
<source lang="XML"> <meta name="DC.rights"
scheme="DCTERMS.URI" content="http://creativecommons.org/licenses/by-sa/2.0/" />
<meta name="DC.rights"
content="(c) 2002 Gnomovision Records" />
</source>
- Pro: Won't break anything.
- Con: Not all users may be able to. Not RDF (included in this list due to obviousness). Limited to statements about the current page. Not a preferred method.
Further reading: Expressing Dublin Core in HTML/XHTML meta and link elements
In a comment
The RDF can be included in a in the document. The TrackBack system embeds its RDF in this way.
Note that if a literal "--" is included in a comment, it must be encoded as "--".
- Pro: Won't break anything. Super simple.
- Con: Not supported by all readers. Makes people queasy.
Using element attributes (RDFa)
RDFa allows RDF to be expressed using a small set of attributes. The simple case of asserting a license only needs rel="license"
added to the license link. Example:
<source lang="XML"> This work is licensed under the <a rel="license"
href="http://creativecommons.org/licenses/by/2.0/">Creative Commons Attribution License</a>.
</source>
- Pro: Super simple, extensible, validates.
- Con: Validation requires modifying the DOCTYPE which some users may be unable to do.
See also: Creative Commons Rights Expression Language
Conclusions
RDF readers should support all of these methods.
We use and recommend RDFa since it's easy, straight forward, powerful and doesn't break existing web clients (browsers). Our previous recommendation, including the RDF in an HTML comment, is no longer recommended. For more information on our use of RDFa and metadata strategy generally, see information on the CC Rights Expression Language.
For the RDFa equivalent of the RDF/XML embedded using the data: URI scheme above see below:
<source lang="XML">
foo foo foo foo foo foo <a rel="dc:type" href="http://purl.org/dc/dcmitype/Sound">foo</a>, <a rel="dc:source" href="http://example.net/gnomovision.mov">foo</a>, <a rel="cc:license" href="http://creativecommons.org/licenses/by-nc-nd/2.0/">foo</a>, <a rel="cc:license" href="http://artlibre.org/licence/lal/en/">foo</a>,
<a rel="cc:permits" href="http://web.resource.org/cc/Reproduction">foo</a>, <a rel="cc:permits" href="http://web.resource.org/cc/Distribution">foo</a>, <a rel="cc:requires" href="http://web.resource.org/cc/Notice">foo</a>, <a rel="cc:requires" href="http://web.resource.org/cc/Attribution">foo</a>, <a rel="cc:prohibits" href="http://web.resource.org/cc/CommercialUse">foo</a>,
</source>
Further reading: Embedding RDF in HTML