| 1 |
<pre>Network Working Group J. Kunze |
| 2 |
Request for Comments: 2731 Dublin Core |
| 3 |
Category: Informational Metadata Initiative |
| 4 |
December 1999 |
| 5 |
|
| 6 |
|
| 7 |
<span class="h1">Encoding Dublin Core Metadata in HTML</span> |
| 8 |
|
| 9 |
|
| 10 |
Status of this Memo |
| 11 |
|
| 12 |
This memo provides information for the Internet community. It does |
| 13 |
not specify an Internet standard of any kind. Distribution of this |
| 14 |
memo is unlimited. |
| 15 |
|
| 16 |
Copyright Notice |
| 17 |
|
| 18 |
Copyright (C) The Internet Society (1999). All Rights Reserved. |
| 19 |
|
| 20 |
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Abstract</span> |
| 21 |
|
| 22 |
The Dublin Core [<a href="#ref-DC1" title=""Dublin Core Metadata for Resource Discovery"">DC1</a>] is a small set of metadata elements for |
| 23 |
describing information resources. This document explains how these |
| 24 |
elements are expressed using the META and LINK tags of HTML |
| 25 |
[<a href="#ref-HTML4.0">HTML4.0</a>]. A sequence of metadata elements embedded in an HTML file |
| 26 |
is taken to be a description of that file. Examples illustrate |
| 27 |
conventions allowing interoperation with current software that |
| 28 |
indexes, displays, and manipulates metadata, such as [<a href="#ref-SWISH-E">SWISH-E</a>], |
| 29 |
[<a href="#ref-freeWAIS-sf2.0">freeWAIS-sf2.0</a>], [<a href="#ref-GLIMPSE">GLIMPSE</a>], [<a href="#ref-HARVEST">HARVEST</a>], [<a href="#ref-ISEARCH">ISEARCH</a>], etc., and the Perl |
| 30 |
[<a href="#ref-PERL" title="R. Schwartz">PERL</a>] scripts in the appendix. |
| 31 |
|
| 32 |
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. HTML, Dublin Core, and Non-Dublin Core Metadata</span> |
| 33 |
|
| 34 |
The Dublin Core (DC) metadata initiative [<a href="#ref-DCHOME">DCHOME</a>] has produced a |
| 35 |
small set of resource description categories [<a href="#ref-DC1" title=""Dublin Core Metadata for Resource Discovery"">DC1</a>], or elements of |
| 36 |
metadata (literally, data about data). Metadata elements are |
| 37 |
typically small relative to the resource they describe and may, if |
| 38 |
the resource format permits, be embedded in it. Two such formats are |
| 39 |
the Hypertext Markup Language (HTML) and the Extensible Markup |
| 40 |
Language (XML); HTML is currently in wide use, but once standardized, |
| 41 |
XML [<a href="#ref-XML">XML</a>] in conjunction with the Resource Description Framework |
| 42 |
[<a href="#ref-RDF">RDF</a>] promise a significantly more expressive means of encoding |
| 43 |
metadata. The [<a href="#ref-RDF">RDF</a>] specification actually describes a way to use |
| 44 |
RDF within an HTML document by adhering to an abbreviated syntax. |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
<span class="grey">Kunze Informational [Page 1]</span></pre> |
| 53 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span> |
| 54 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 55 |
|
| 56 |
|
| 57 |
This document explains how to encode metadata using HTML 4.0 |
| 58 |
[<a href="#ref-HTML4.0">HTML4.0</a>]. It is not concerned with element semantics, which are |
| 59 |
defined elsewhere. For illustrative purposes, some element semantics |
| 60 |
are alluded to, but in no way should semantics appearing here be |
| 61 |
considered definitive. |
| 62 |
|
| 63 |
The HTML encoding allows elements of DC metadata to be interspersed |
| 64 |
with non-DC elements (provided such mixing is consistent with rules |
| 65 |
governing use of those non-DC elements). A DC element is indicated |
| 66 |
by the prefix "DC", and a non-DC element by another prefix; for |
| 67 |
example, the prefix "AC" is used with elements from the A-Core [<a href="#ref-AC">AC</a>]. |
| 68 |
|
| 69 |
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. The META Tag</span> |
| 70 |
|
| 71 |
The META tag of HTML is designed to encode a named metadata element. |
| 72 |
Each element describes a given aspect of a document or other |
| 73 |
information resource. For example, this tagged metadata element, |
| 74 |
|
| 75 |
<meta name = "DC.Creator" |
| 76 |
content = "Simpson, Homer"> |
| 77 |
|
| 78 |
says that Homer Simpson is the Creator, where the element named |
| 79 |
Creator is defined in the DC element set. In the more general form, |
| 80 |
|
| 81 |
<meta name = "PREFIX.ELEMENT_NAME" |
| 82 |
content = "ELEMENT_VALUE"> |
| 83 |
|
| 84 |
the capitalized words are meant to be replaced in actual |
| 85 |
descriptions; thus in the example, |
| 86 |
|
| 87 |
ELEMENT_NAME was: Creator |
| 88 |
ELEMENT_VALUE was: Simpson, Homer |
| 89 |
and PREFIX was: DC |
| 90 |
|
| 91 |
Within a META tag the first letter of a Dublin Core element name is |
| 92 |
capitalized. DC places no restriction on alphabetic case in an |
| 93 |
element value and any number of META tagged elements may appear |
| 94 |
together, in any order. More than one DC element with the same name |
| 95 |
may appear, and each DC element is optional. The next example is a |
| 96 |
book description with two authors, two titles, and no other metadata. |
| 97 |
|
| 98 |
<meta name = "DC.Title" |
| 99 |
content = "The Communist Manifesto"> |
| 100 |
<meta name = "DC.Creator" |
| 101 |
content = "Marx, K."> |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
<span class="grey">Kunze Informational [Page 2]</span></pre> |
| 109 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span> |
| 110 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 111 |
|
| 112 |
|
| 113 |
<meta name = "DC.Creator" |
| 114 |
content = "Engels, F."> |
| 115 |
<meta name = "DC.Title" |
| 116 |
content = "Capital"> |
| 117 |
|
| 118 |
The prefix "DC" precedes each Dublin Core element encoded with META, |
| 119 |
and it is separated by a period (.) from the element name following |
| 120 |
it. Each non-DC element should be encoded with a prefix that can be |
| 121 |
used to trace its origin and definition; the linkage between prefix |
| 122 |
and element definition is made with the LINK tag, as explained in the |
| 123 |
next section. Non-DC elements, such as Email from the A-Core [<a href="#ref-AC">AC</a>], |
| 124 |
may appear together with DC elements, as in |
| 125 |
|
| 126 |
<meta name = "DC.Creator" |
| 127 |
content = "Da Costa, Jos&eacute;"> |
| 128 |
<meta name = "AC.Email" |
| 129 |
content = "[email protected]"> |
| 130 |
<meta name = "DC.Title" |
| 131 |
content = "Jesse &#34;The Body&#34; Ventura--A Biography"> |
| 132 |
|
| 133 |
This example also shows how some special characters may be encoded. |
| 134 |
The author name in the first element contains a diacritic encoded as |
| 135 |
an HTML character entity reference -- in this case an accented letter |
| 136 |
E. Similarly, the last line contains two double-quote characters |
| 137 |
encoded so as to avoid being interpreted as element content |
| 138 |
delimiters. |
| 139 |
|
| 140 |
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. The LINK Tag</span> |
| 141 |
|
| 142 |
The LINK tag of HTML may be used to associate an element name prefix |
| 143 |
with the reference definition of the element set that it identifies. |
| 144 |
A sequence of META tags describing a resource is incomplete without |
| 145 |
one such LINK tag for each different prefix appearing in the |
| 146 |
sequence. The previous example could be considered complete with the |
| 147 |
addition of these two LINK tags: |
| 148 |
|
| 149 |
<link rel = "schema.DC" |
| 150 |
href = "<a href="http://purl.org/DC/elements/1.0/">http://purl.org/DC/elements/1.0/</a>"> |
| 151 |
<link rel = "schema.AC" |
| 152 |
href = "<a href="http://metadata.net/ac/2.0/">http://metadata.net/ac/2.0/</a>"> |
| 153 |
|
| 154 |
In general, the association takes the form |
| 155 |
|
| 156 |
<link rel = "schema.PREFIX" |
| 157 |
href = "LOCATION_OF_DEFINITION"> |
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
<span class="grey">Kunze Informational [Page 3]</span></pre> |
| 165 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span> |
| 166 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 167 |
|
| 168 |
|
| 169 |
where, in actual descriptions, PREFIX is to be replaced by the prefix |
| 170 |
and LOCATION_OF_DEFINITION by the URL or URN of the defining |
| 171 |
document. When embedded in the HEAD part of an HTML file, a sequence |
| 172 |
of LINK and META tags describes the information in the surrounding |
| 173 |
HTML file itself. Here is a complete HTML file with its own embedded |
| 174 |
description. |
| 175 |
|
| 176 |
<html> |
| 177 |
<head> |
| 178 |
<title> A Dirge </title> |
| 179 |
<link rel = "schema.DC" |
| 180 |
href = "<a href="http://purl.org/DC/elements/1.0/">http://purl.org/DC/elements/1.0/</a>"> |
| 181 |
<meta name = "DC.Title" |
| 182 |
content = "A Dirge"> |
| 183 |
<meta name = "DC.Creator" |
| 184 |
content = "Shelley, Percy Bysshe"> |
| 185 |
<meta name = "DC.Type" |
| 186 |
content = "poem"> |
| 187 |
<meta name = "DC.Date" |
| 188 |
content = "1820"> |
| 189 |
<meta name = "DC.Format" |
| 190 |
content = "text/html"> |
| 191 |
<meta name = "DC.Language" |
| 192 |
content = "en"> |
| 193 |
</head> |
| 194 |
<body><pre> |
| 195 |
Rough wind, that moanest loud |
| 196 |
Grief too sad for song; |
| 197 |
Wild wind, when sullen cloud |
| 198 |
Knells all the night long; |
| 199 |
Sad storm, whose tears are vain, |
| 200 |
Bare woods, whose branches strain, |
| 201 |
Deep caves and dreary main, - |
| 202 |
Wail, for the world's wrong! |
| 203 |
</pre></body> |
| 204 |
</html> |
| 205 |
|
| 206 |
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Encoding Recommendations</span> |
| 207 |
|
| 208 |
HTML allows more flexibility in principle and in practice than is |
| 209 |
recommended here for encoding metadata. Limited flexibility |
| 210 |
encourages easy development of software for extracting and processing |
| 211 |
metadata. At this early evolutionary stage of internet metadata, |
| 212 |
easy prototyping and experimentation hastens the development of |
| 213 |
useful standards. |
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
<span class="grey">Kunze Informational [Page 4]</span></pre> |
| 221 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span> |
| 222 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 223 |
|
| 224 |
|
| 225 |
Adherence is therefore recommended to the tagging style exemplified |
| 226 |
in this document as regards prefix and element name capitalization, |
| 227 |
double-quoting (") of attribute values, and not starting more than |
| 228 |
one META tag on a line. There is much room for flexibility, but |
| 229 |
choosing a style and sticking with it will likely make metadata |
| 230 |
manipulation and editing easier. The following META tags adhere to |
| 231 |
the recommendations and carry identical metadata in three different |
| 232 |
styles: |
| 233 |
|
| 234 |
<META NAME="DC.Format" |
| 235 |
CONTENT="text/html; 12 Kbytes"> |
| 236 |
<meta |
| 237 |
Content = "text/html; 12 Kbytes" |
| 238 |
Name = "DC.Format" |
| 239 |
> |
| 240 |
<meta name = "DC.Format" content = "text/html; 12 Kbytes"> |
| 241 |
|
| 242 |
Use of these recommendations is known to result in metadata that may |
| 243 |
be harvested, indexed, and manipulated by popular, freely available |
| 244 |
software packages such as [<a href="#ref-SWISH-E">SWISH-E</a>], [<a href="#ref-freeWAIS-sf2.0">freeWAIS-sf2.0</a>], [<a href="#ref-GLIMPSE">GLIMPSE</a>], |
| 245 |
[<a href="#ref-HARVEST">HARVEST</a>], and [<a href="#ref-ISEARCH">ISEARCH</a>], among others. These conventions also work |
| 246 |
with the metadata processing scripts appearing in the appendix, as |
| 247 |
well as with most of the [<a href="#ref-DCPROJECTS">DCPROJECTS</a>] applications referenced from |
| 248 |
the [<a href="#ref-DCHOME">DCHOME</a>] site. Software support for the LINK tag and qualifier |
| 249 |
conventions (see the next section) is not currently widespread. |
| 250 |
|
| 251 |
Ordering of metadata elements is not preserved in general. Writers |
| 252 |
of software for metadata indexing and display should try to preserve |
| 253 |
relative ordering among META tagged elements having the same name |
| 254 |
(e.g., among multiple authors), however, metadata providers and |
| 255 |
searchers have no guarantee that ordering will be preserved in |
| 256 |
metadata that passes through unknown systems. |
| 257 |
|
| 258 |
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. Dublin Core in Real Descriptions</span> |
| 259 |
|
| 260 |
In actual resource description it is often necessary to qualify |
| 261 |
Dublin Core elements to add nuances of meaning. While neither the |
| 262 |
general principles nor the specific semantics of DC qualifiers are |
| 263 |
within scope of this document, everyday uses of the qualifier syntax |
| 264 |
are illustrated to lend realism to later examples. Without further |
| 265 |
explanation, the three ways in which the optional qualifier syntax is |
| 266 |
currently (subject to change) used to supplement the META tag may be |
| 267 |
summarized as follows: |
| 268 |
|
| 269 |
<meta lang = "LANGUAGE_OF_METADATA_CONTENT" ... > |
| 270 |
|
| 271 |
<meta scheme = "CONTROLLED_FORMAT_OR_VOCABULARY_OF_METADATA" ... > |
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
<span class="grey">Kunze Informational [Page 5]</span></pre> |
| 277 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span> |
| 278 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 279 |
|
| 280 |
|
| 281 |
<meta name = "PREFIX.ELEMENT_NAME.SUBELEMENT_NAME" ... > |
| 282 |
|
| 283 |
Accordingly, a posthumous work in Spanish might be described with |
| 284 |
|
| 285 |
<meta name = "DC.Language" |
| 286 |
scheme = "<a href="./rfc1766">rfc1766</a>" |
| 287 |
content = "es"> |
| 288 |
<meta name = "DC.Title" |
| 289 |
lang = "es" |
| 290 |
content = "La Mesa Verde y la Silla Roja"> |
| 291 |
<meta name = "DC.Title" |
| 292 |
lang = "en" |
| 293 |
content = "The Green Table and the Red Chair"> |
| 294 |
<meta name = "DC.Date.Created" |
| 295 |
content = "1935"> |
| 296 |
<meta name = "DC.Date.Available" |
| 297 |
content = "1939"> |
| 298 |
|
| 299 |
Note that the qualifier syntax and label suffixes (which follow an |
| 300 |
element name and a period) used in examples in this document merely |
| 301 |
reflect current trends in the HTML encoding of qualifiers. Use of |
| 302 |
this syntax and these suffixes is neither a standard nor a |
| 303 |
recommendation. |
| 304 |
|
| 305 |
<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. Encoding Dublin Core Elements</span> |
| 306 |
|
| 307 |
This section consists of very simple Dublin Core encoding examples, |
| 308 |
arranged by element. |
| 309 |
|
| 310 |
Title (name given to the resource) |
| 311 |
----- |
| 312 |
|
| 313 |
<meta name = "DC.Title" |
| 314 |
content = "Polycyclic aromatic hydrocarbon contamination"> |
| 315 |
|
| 316 |
<meta name = "DC.Title" |
| 317 |
content = "Crime and Punishment"> |
| 318 |
|
| 319 |
<meta name = "DC.Title" |
| 320 |
content = "Methods of Information in Medicine, Vol 32, No 4"> |
| 321 |
|
| 322 |
<meta name = "DC.Title" |
| 323 |
content = "Still life #4 with flowers"> |
| 324 |
|
| 325 |
<meta name = "DC.Title" |
| 326 |
lang = "de" |
| 327 |
content = "Das Wohltemperierte Klavier, Teil I"> |
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
<span class="grey">Kunze Informational [Page 6]</span></pre> |
| 333 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span> |
| 334 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 335 |
|
| 336 |
|
| 337 |
Creator (entity that created the content) |
| 338 |
------- |
| 339 |
|
| 340 |
<meta name = "DC.Creator" |
| 341 |
content = "Gogh, Vincent van"> |
| 342 |
<meta name = "DC.Creator" |
| 343 |
content = "van Gogh, Vincent"> |
| 344 |
|
| 345 |
<meta name = "DC.Creator" |
| 346 |
content = "Mao Tse Tung"> |
| 347 |
<meta name = "DC.Creator" |
| 348 |
content = "Mao, Tse Tung"> |
| 349 |
|
| 350 |
<meta name = "DC.Creator" |
| 351 |
content = "Plato"> |
| 352 |
<meta name = "DC.Creator" |
| 353 |
lang = "fr" |
| 354 |
content = "Platon"> |
| 355 |
|
| 356 |
<meta name = "DC.Creator.Director" |
| 357 |
content = "Sturges, Preston"> |
| 358 |
<meta name = "DC.Creator.Writer" |
| 359 |
content = "Hecht, Ben"> |
| 360 |
<meta name = "DC.Creator.Producer" |
| 361 |
content = "Chaplin, Charles"> |
| 362 |
|
| 363 |
Subject (topic or keyword) |
| 364 |
------- |
| 365 |
|
| 366 |
<meta name = "DC.Subject" |
| 367 |
content = "heart attack"> |
| 368 |
<meta name = "DC.Subject" |
| 369 |
scheme = "MESH" |
| 370 |
content = "Myocardial Infarction; Pericardial Effusion"> |
| 371 |
|
| 372 |
<meta name = "DC.Subject" |
| 373 |
content = "vietnam war"> |
| 374 |
<meta name = "DC.Subject" |
| 375 |
scheme = "LCSH" |
| 376 |
content = "Vietnamese Conflict, 1961-1975"> |
| 377 |
|
| 378 |
<meta name = "DC.Subject" |
| 379 |
content = "Friendship"> |
| 380 |
<meta name = "DC.Subject" |
| 381 |
scheme = "ddc" |
| 382 |
content = "158.25"> |
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
<span class="grey">Kunze Informational [Page 7]</span></pre> |
| 389 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span> |
| 390 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 391 |
|
| 392 |
|
| 393 |
Description (account, summary, or abstract of the content) |
| 394 |
----------- |
| 395 |
|
| 396 |
<meta name = "DC.Description" |
| 397 |
lang = "en" |
| 398 |
content = "The Author gives some Account of Himself and Family |
| 399 |
-- His First Inducements to Travel -- He is |
| 400 |
Shipwrecked, and Swims for his Life -- Gets safe on |
| 401 |
Shore in the Country of Lilliput -- Is made a |
| 402 |
Prisoner, and carried up the Country"> |
| 403 |
|
| 404 |
<meta name = "DC.Description" |
| 405 |
content = "A tutorial and reference manual for Java."> |
| 406 |
|
| 407 |
<meta name = "DC.Description" |
| 408 |
content = "Seated family of five, coconut trees to the left, |
| 409 |
sailboats moored off sandy beach to the right, |
| 410 |
with volcano in the background."> |
| 411 |
|
| 412 |
Publisher (entity that made the resource available) |
| 413 |
--------- |
| 414 |
|
| 415 |
<meta name = "DC.Publisher" |
| 416 |
content = "O'Reilly"> |
| 417 |
|
| 418 |
<meta name = "DC.Publisher" |
| 419 |
content = "Digital Equipment Corporation"> |
| 420 |
|
| 421 |
<meta name = "DC.Publisher" |
| 422 |
content = "University of California Press"> |
| 423 |
|
| 424 |
<meta name = "DC.Publisher" |
| 425 |
content = "State of Florida (USA)"> |
| 426 |
|
| 427 |
Contributor (other entity that made a contribution) |
| 428 |
----------- |
| 429 |
|
| 430 |
<meta name = "DC.Contributor" |
| 431 |
content = "Curie, Marie"> |
| 432 |
|
| 433 |
<meta name = "DC.Contributor.Photographer" |
| 434 |
content = "Adams, Ansel"> |
| 435 |
<meta name = "DC.Contributor.Artist" |
| 436 |
content = "Sendak, Maurice"> |
| 437 |
<meta name = "DC.Contributor.Editor" |
| 438 |
content = "Starr, Kenneth"> |
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
<span class="grey">Kunze Informational [Page 8]</span></pre> |
| 445 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span> |
| 446 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 447 |
|
| 448 |
|
| 449 |
Date (of an event in the life of the resource; [<a href="#ref-WTN8601">WTN8601</a>] recommended) |
| 450 |
---- |
| 451 |
|
| 452 |
<meta name = "DC.Date" |
| 453 |
content = "1972"> |
| 454 |
|
| 455 |
<meta name = "DC.Date" |
| 456 |
content = "1998-05-14"> |
| 457 |
<meta name = "DC.Date" |
| 458 |
scheme = "WTN8601" |
| 459 |
content = "1998-05-14"> |
| 460 |
|
| 461 |
<meta name = "DC.Date.Created" |
| 462 |
content = "1998-05-14"> |
| 463 |
<meta name = "DC.Date.Available" |
| 464 |
content = "1998-05-21"> |
| 465 |
<meta name = "DC.Date.Valid" |
| 466 |
content = "1998-05-28"> |
| 467 |
|
| 468 |
<meta name = "DC.Date.Created" |
| 469 |
content = "triassic"> |
| 470 |
<meta name = "DC.Date.Acquired" |
| 471 |
content = "1957"> |
| 472 |
|
| 473 |
<meta name = "DC.Date.Accepted" |
| 474 |
scheme = "WTN8601" |
| 475 |
content = "1998-12-02T16:59"> |
| 476 |
|
| 477 |
<meta name = "DC.Date.DataGathered" |
| 478 |
scheme = "ISO8601" |
| 479 |
content = "98-W49-3T1659"> |
| 480 |
|
| 481 |
<meta name = "DC.Date.Issued" |
| 482 |
scheme = "ANSI.X3.X30-1985" |
| 483 |
content = "19980514"> |
| 484 |
|
| 485 |
Type (nature, genre, or category; [<a href="#ref-DCT1" title="DC Type Working Group">DCT1</a>] recommended) |
| 486 |
---- |
| 487 |
|
| 488 |
<meta name = "DC.Type" |
| 489 |
content = "poem"> |
| 490 |
|
| 491 |
<meta name = "DC.Type" |
| 492 |
scheme = "DCT1" |
| 493 |
content = "software"> |
| 494 |
<meta name = "DC.Type" |
| 495 |
content = "software program source code"> |
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
<span class="grey">Kunze Informational [Page 9]</span></pre> |
| 501 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span> |
| 502 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 503 |
|
| 504 |
|
| 505 |
<meta name = "DC.Type" |
| 506 |
content = "interactive video game"> |
| 507 |
|
| 508 |
<meta name = "DC.Type" |
| 509 |
scheme = "DCT1" |
| 510 |
content = "dataset"> |
| 511 |
|
| 512 |
<meta name = "DC.Type" |
| 513 |
content = "web home page"> |
| 514 |
<meta name = "DC.Type" |
| 515 |
content = "web bibliography"> |
| 516 |
|
| 517 |
<meta name = "DC.Type" |
| 518 |
content = "painting"> |
| 519 |
<meta name = "DC.Type" |
| 520 |
content = "image; woodblock"> |
| 521 |
<meta name = "DC.Type" |
| 522 |
scheme = "AAT" |
| 523 |
content = "clipeus (portrait)"> |
| 524 |
<meta name = "DC.Type" |
| 525 |
lang = "en-US" |
| 526 |
content = "image; advertizement"> |
| 527 |
|
| 528 |
<meta name = "DC.Type" |
| 529 |
scheme = "DCT1" |
| 530 |
content = "event"> |
| 531 |
<meta name = "DC.Type" |
| 532 |
content = "event; periodic"> |
| 533 |
|
| 534 |
Format (physical or digital data format, plus optional dimensions) |
| 535 |
------ |
| 536 |
|
| 537 |
<meta name = "DC.Format" |
| 538 |
content = "text/xml"> |
| 539 |
<meta name = "DC.Format" |
| 540 |
scheme = "IMT" |
| 541 |
content = "text/xml"> |
| 542 |
|
| 543 |
<meta name = "DC.Format" |
| 544 |
scheme = "IMT" |
| 545 |
content = "image/jpeg"> |
| 546 |
<meta name = "DC.Format" |
| 547 |
content = "A text file with mono-spaced tables and diagrams."> |
| 548 |
|
| 549 |
<meta name = "DC.Format" |
| 550 |
content = "video/mpeg; 14 minutes"> |
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
<span class="grey">Kunze Informational [Page 10]</span></pre> |
| 557 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span> |
| 558 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 559 |
|
| 560 |
|
| 561 |
<meta name = "DC.Format" |
| 562 |
content = "unix tar archive, gzip compressed; 1.5 Mbytes"> |
| 563 |
|
| 564 |
<meta name = "DC.Format" |
| 565 |
content = "watercolor; 23 cm x 31 cm"> |
| 566 |
|
| 567 |
Identifier (of the resource) |
| 568 |
---------- |
| 569 |
|
| 570 |
<meta name = "DC.Identifier" |
| 571 |
content = "<a href="http://foo.bar.org/zaf/">http://foo.bar.org/zaf/</a>"> |
| 572 |
|
| 573 |
<meta name = "DC.Identifier" |
| 574 |
content = "urn:ietf:rfc:1766"> |
| 575 |
|
| 576 |
<meta name = "DC.Identifier" |
| 577 |
scheme = "ISBN" |
| 578 |
content = "1-56592-149-6"> |
| 579 |
|
| 580 |
<meta name = "DC.Identifier" |
| 581 |
scheme = "LCCN" |
| 582 |
content = "67-26020"> |
| 583 |
|
| 584 |
<meta name = "DC.Identifier" |
| 585 |
scheme = "DOI" |
| 586 |
content = "10.12345/33-824688ab"> |
| 587 |
|
| 588 |
Source (reference to the resource's origin) |
| 589 |
------ |
| 590 |
|
| 591 |
<meta name = "DC.Source" |
| 592 |
content = "Shakespeare's Romeo and Juliet"> |
| 593 |
|
| 594 |
<meta name = "DC.Source" |
| 595 |
content = "<a href="http://a.b.org/manon/">http://a.b.org/manon/</a>"> |
| 596 |
|
| 597 |
Language (of the content of the resource; [<a href="./rfc1766" title=""Tags for the Identification of Languages"">RFC1766</a>] recommended) |
| 598 |
-------- |
| 599 |
|
| 600 |
<meta name = "DC.Language" |
| 601 |
content = "en"> |
| 602 |
<meta name = "DC.Language" |
| 603 |
scheme = "<a href="./rfc1766">rfc1766</a>" |
| 604 |
content = "en"> |
| 605 |
<meta name = "DC.Language" |
| 606 |
scheme = "ISO639-2" |
| 607 |
content = "eng"> |
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
|
| 612 |
<span class="grey">Kunze Informational [Page 11]</span></pre> |
| 613 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span> |
| 614 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 615 |
|
| 616 |
|
| 617 |
<meta name = "DC.Language" |
| 618 |
scheme = "<a href="./rfc1766">rfc1766</a>" |
| 619 |
content = "en-US"> |
| 620 |
|
| 621 |
<meta name = "DC.Language" |
| 622 |
content = "zh"> |
| 623 |
<meta name = "DC.Language" |
| 624 |
content = "ja"> |
| 625 |
<meta name = "DC.Language" |
| 626 |
content = "es"> |
| 627 |
<meta name = "DC.Language" |
| 628 |
content = "de"> |
| 629 |
|
| 630 |
<meta name = "DC.Language" |
| 631 |
content = "german"> |
| 632 |
<meta name = "DC.Language" |
| 633 |
lang = "fr" |
| 634 |
content = "allemand"> |
| 635 |
|
| 636 |
Relation (reference to a related resource) |
| 637 |
-------- |
| 638 |
|
| 639 |
<meta name = "DC.Relation.IsPartOf" |
| 640 |
content = "<a href="http://foo.bar.org/abc/proceedings/1998/">http://foo.bar.org/abc/proceedings/1998/</a>"> |
| 641 |
|
| 642 |
<meta name = "DC.Relation.IsFormatOf" |
| 643 |
content = "<a href="http://foo.bar.org/cd145.sgml">http://foo.bar.org/cd145.sgml</a>"> |
| 644 |
|
| 645 |
<meta name = "DC.Relation.IsVersionOf" |
| 646 |
content = "<a href="http://foo.bar.org/draft9.4.4.2">http://foo.bar.org/draft9.4.4.2</a>"> |
| 647 |
|
| 648 |
<meta name = "DC.Relation.References" |
| 649 |
content = "urn:isbn:1-56592-149-6"> |
| 650 |
|
| 651 |
<meta name = "DC.Relation.IsBasedOn" |
| 652 |
content = "Shakespeare's Romeo and Juliet"> |
| 653 |
|
| 654 |
<meta name = "DC.Relation.Requires" |
| 655 |
content = "LWP::UserAgent; HTML::Parse; URI::URL; |
| 656 |
Net::DNS; Tk::Pixmap; Tk::Bitmap; Tk::Photo"> |
| 657 |
|
| 658 |
Coverage (extent or scope of the content) |
| 659 |
-------- |
| 660 |
|
| 661 |
<meta name = "DC.Coverage" |
| 662 |
content = "US civil war era; 1861-1865"> |
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
<span class="grey">Kunze Informational [Page 12]</span></pre> |
| 669 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span> |
| 670 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 671 |
|
| 672 |
|
| 673 |
<meta name = "DC.Coverage" |
| 674 |
content = "Columbus, Ohio, USA; Lat: 39 57 N Long: 082 59 W"> |
| 675 |
|
| 676 |
<meta name = "DC.Coverage" |
| 677 |
scheme = "TGN" |
| 678 |
content = "Columbus (C,V)"> |
| 679 |
|
| 680 |
<meta name = "DC.Coverage.Jurisdiction" |
| 681 |
content = "Commonwealth of Australia"> |
| 682 |
|
| 683 |
Rights (text or identifier of a rights management statement) |
| 684 |
------ |
| 685 |
|
| 686 |
<meta name = "DC.Rights" |
| 687 |
lang = "en" |
| 688 |
content = "Copyright Acme 1999 - All rights reserved."> |
| 689 |
|
| 690 |
<meta name = "DC.Rights" |
| 691 |
content = "<a href="http://foo.bar.org/cgi-bin/terms">http://foo.bar.org/cgi-bin/terms</a>"> |
| 692 |
|
| 693 |
<span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. Security Considerations</span> |
| 694 |
|
| 695 |
The syntax rules for encoding Dublin Core metadata in HTML that are |
| 696 |
documented here pose no direct risk to computers and networks. |
| 697 |
People can use these rules to encode metadata that is inaccurate or |
| 698 |
even deliberately misleading (creating mischief in the form of "index |
| 699 |
spam"), however, this reflects a general pattern of HTML META tag |
| 700 |
abuse that is not limited to the encoding of metadata from the Dublin |
| 701 |
Core set. Even traditional metadata encoding schemes (e.g., [<a href="#ref-MARC">MARC</a>]) |
| 702 |
are not immune to inaccuracy, although they are generally followed in |
| 703 |
environments where production quality greatly exceeds that of the |
| 704 |
average Web site. |
| 705 |
|
| 706 |
Systems that process metadata encoded with META tags need to consider |
| 707 |
issues related to its accuracy and validity as part of their design |
| 708 |
and implementation, and users of such systems need to consider the |
| 709 |
design and implementation assumptions. Various approaches may be |
| 710 |
relevant for certain applications, such as adding statements of |
| 711 |
metadata provenance, signing of metadata with digital signatures, and |
| 712 |
automating certain aspects of metadata creation; but these are far |
| 713 |
outside the scope of this document and the underlying META tag syntax |
| 714 |
that it describes. |
| 715 |
|
| 716 |
|
| 717 |
|
| 718 |
|
| 719 |
|
| 720 |
|
| 721 |
|
| 722 |
|
| 723 |
|
| 724 |
<span class="grey">Kunze Informational [Page 13]</span></pre> |
| 725 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span> |
| 726 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 727 |
|
| 728 |
|
| 729 |
<span class="h2"><a class="selflink" id="section-9" href="#section-9">9</a>. Appendix -- Perl Scripts that Manipulate HTML Encoded Metadata</span> |
| 730 |
|
| 731 |
This section contains two simple programs that work with versions 4 |
| 732 |
and 5 of the Perl [<a href="#ref-PERL" title="R. Schwartz">PERL</a>] scripting language interpreter. They may be |
| 733 |
taken and freely adapted for local organizational needs, research |
| 734 |
proposals, venture capital bids, etc. A variety of applications are |
| 735 |
within easy reach of implementors that choose to build on these |
| 736 |
scripts. |
| 737 |
|
| 738 |
Script 1: Metadata Format Conversion |
| 739 |
------------------------------------- |
| 740 |
|
| 741 |
Here is a simple Perl script that correctly recognizes every example |
| 742 |
of metadata encoding in this document. It shows how a modest |
| 743 |
scripting effort can produce a utility that converts metadata from |
| 744 |
one format to another. Minor changes are sufficient to support a |
| 745 |
number of output formats. |
| 746 |
|
| 747 |
#!/depot/bin/perl |
| 748 |
# |
| 749 |
# This simple perl script extracts metadata embedded in an HTML file |
| 750 |
# and outputs it in an alternate format. Issues warning about missing |
| 751 |
# element name or value. |
| 752 |
# |
| 753 |
# Handles mixed case tags and attribute values, one per line or spanning |
| 754 |
# several lines. Also handles a quoted string spanning multiple lines. |
| 755 |
# No error checking. Does not tolerate more than one "<meta" per line. |
| 756 |
|
| 757 |
print "@(urc;\n"; |
| 758 |
while (<>) { |
| 759 |
next if (! /<meta/i); |
| 760 |
($meta) = /(<meta.*$)/i; |
| 761 |
if (! /<meta.*>/i) { |
| 762 |
while (<>) { |
| 763 |
$meta .= $_; |
| 764 |
last if (/>/); |
| 765 |
} |
| 766 |
} |
| 767 |
$name = $meta =~ /name\s*=\s*"([^"]*)"/i |
| 768 |
? $1 : "MISSING ELEMENT NAME"; |
| 769 |
$content = $meta =~ /content\s*=\s*"([^"]*)"/i |
| 770 |
? $1 : "MISSING ELEMENT VALUE"; |
| 771 |
($scheme) = $meta =~ /scheme\s*=\s*"([^"]*)"/i; |
| 772 |
($lang) = $meta =~ /lang\s*=\s*"([^"]*)"/i; |
| 773 |
|
| 774 |
if ($lang || $scheme) { |
| 775 |
$mod = " ($lang"; |
| 776 |
if (! $scheme) |
| 777 |
|
| 778 |
|
| 779 |
|
| 780 |
<span class="grey">Kunze Informational [Page 14]</span></pre> |
| 781 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span> |
| 782 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 783 |
|
| 784 |
|
| 785 |
{ $mod .= ")"; } |
| 786 |
elsif (! $lang) |
| 787 |
{ $mod .= "$scheme)" } |
| 788 |
else |
| 789 |
{ $mod .= ", $scheme)"; } |
| 790 |
} |
| 791 |
else |
| 792 |
{ $mod = ""; } |
| 793 |
|
| 794 |
print " @|$name$mod; $content\n"; |
| 795 |
} |
| 796 |
print "@)urc;\n"; |
| 797 |
# ---- end of Perl script ---- |
| 798 |
|
| 799 |
When the conversion script is run on the metadata file example from |
| 800 |
the LINK tag section (<a href="#section-4">section 4</a>), it produces the following output. |
| 801 |
|
| 802 |
@(urc; |
| 803 |
@|DC.Title; A Dirge |
| 804 |
@|DC.Creator; Shelley, Percy Bysshe |
| 805 |
@|DC.Type; poem |
| 806 |
@|DC.Date; 1820 |
| 807 |
@|DC.Format; text/html |
| 808 |
@|DC.Language; en |
| 809 |
@)urc; |
| 810 |
|
| 811 |
Script 2: Automated Metadata Creation |
| 812 |
-------------------------------------- |
| 813 |
|
| 814 |
The creation and maintenance of high-quality metadata can be |
| 815 |
extremely expensive without automation to assist in processes such as |
| 816 |
supplying pre-set or computed defaults, validating syntax, verifying |
| 817 |
value ranges, spell checking, etc. Considerable relief could be had |
| 818 |
from a script that reduced an individual provider's metadata burden |
| 819 |
to just the title of each document. Below is such a script. It lets |
| 820 |
the provider of an HTML document abbreviate an entire embedded |
| 821 |
resource description using a single HTML comment statement that looks |
| 822 |
like |
| 823 |
|
| 824 |
<!--metablock Little Red Riding Hood --> |
| 825 |
|
| 826 |
Our script processes this statement specially as a kind of "metadata |
| 827 |
block" declaration with attached title. The general form is |
| 828 |
|
| 829 |
<!--metablock TITLE_OF_DOCUMENT --> |
| 830 |
|
| 831 |
|
| 832 |
|
| 833 |
|
| 834 |
|
| 835 |
|
| 836 |
<span class="grey">Kunze Informational [Page 15]</span></pre> |
| 837 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span> |
| 838 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 839 |
|
| 840 |
|
| 841 |
This statement works much like a "Web server-side include" in that |
| 842 |
the script replaces it with a fully-specified block of metadata and |
| 843 |
triggers other replacements. Once installed, the script can output |
| 844 |
HTML files suitable for integration into one's production Web server |
| 845 |
procedures. |
| 846 |
|
| 847 |
The individual provider keeps a separate "template" file of |
| 848 |
infrequently changing pre-set values for metadata elements. If the |
| 849 |
provider's needs are simple enough, the only element values besides |
| 850 |
the title that differ from one document to the next may be generated |
| 851 |
automatically. Using the script, values may be referenced as |
| 852 |
variables from within the template or within the document. Our |
| 853 |
variable references have the form "(--mbVARNAME)", and here is what |
| 854 |
they look like inside a template: |
| 855 |
|
| 856 |
<title> (--mbtitle) </title> |
| 857 |
<meta name = "DC.Creator" |
| 858 |
content = "Simpson, Homer"> |
| 859 |
<meta name = "DC.Title" |
| 860 |
content = "(--mbtitle)"> |
| 861 |
<meta name = "DC.Date.Created" |
| 862 |
content = "(--mbfilemodtime)"> |
| 863 |
<meta name = "DC.Identifier" |
| 864 |
content = "(--mbbaseURL)/(--mbfilename)"> |
| 865 |
<meta name = "DC.Format" |
| 866 |
content = "text/html; (--mbfilesize)"> |
| 867 |
<meta name = "DC.Language" |
| 868 |
content = "(--mblanguage)-BUREAUCRATESE"> |
| 869 |
<meta name = "RC.MetadataAuthority" |
| 870 |
content = "Springfield Nuclear"> |
| 871 |
<link rel = "schema.DC" |
| 872 |
href = "<a href="http://purl.org/DC/elements/1.0/">http://purl.org/DC/elements/1.0/</a>"> |
| 873 |
<link rel = "schema.RC" |
| 874 |
href = "<a href="http://nukes.org/ReactorCore/rc">http://nukes.org/ReactorCore/rc</a>"> |
| 875 |
|
| 876 |
The above template represents the metadata block that will describe |
| 877 |
the document once the variable references are replaced with real |
| 878 |
values. By the conventions of our script, the following variables |
| 879 |
will be replaced in both the template and in the document: |
| 880 |
|
| 881 |
(--mbfilesize) size of the final output file |
| 882 |
(--mbtitle) title of the document |
| 883 |
(--mblanguage) language of the document |
| 884 |
(--mbbaseURL) beginning part of document identifier |
| 885 |
(--mbfilename) last part (minus .html) of identifier |
| 886 |
(--mbfilemodtime) last modification date of the document |
| 887 |
|
| 888 |
|
| 889 |
|
| 890 |
|
| 891 |
|
| 892 |
<span class="grey">Kunze Informational [Page 16]</span></pre> |
| 893 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-17" ></span> |
| 894 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 895 |
|
| 896 |
|
| 897 |
Here's an example HTML file to run the script on. |
| 898 |
|
| 899 |
<html> |
| 900 |
<head> |
| 901 |
<!--metablock Nutritional Allocation Increase --> |
| 902 |
<meta name = "DC.Type" |
| 903 |
content = "Memorandum"> |
| 904 |
</head> |
| 905 |
<body> |
| 906 |
<p> |
| 907 |
From: Acting Shift Supervisor |
| 908 |
To: Plant Control Personnel |
| 909 |
RE: (--mbtitle) |
| 910 |
Date: (--mbfilemodtime) |
| 911 |
<p> |
| 912 |
Pursuant to directive DOH:10.2001/405aec of article B-2022, |
| 913 |
sub<a href="#section-48.2.4.4.1">section 48.2.4.4.1</a>c regarding staff morale and employee |
| 914 |
productivity standards, the current allocation of doughnut |
| 915 |
acquisition funds shall be increased effective immediately. |
| 916 |
</body> |
| 917 |
</html> |
| 918 |
|
| 919 |
Note that because replacement occurs throughout the document, the |
| 920 |
provider need only enter the title once instead of twice (normally |
| 921 |
the title must be entered once in the HTML head and again in the HTML |
| 922 |
body). After running the script, the above file is transformed into |
| 923 |
this: |
| 924 |
|
| 925 |
<html> |
| 926 |
<head> |
| 927 |
<title> Nutritional Allocation Increase </title> |
| 928 |
<meta name = "DC.Creator" |
| 929 |
content = "Simpson, Homer"> |
| 930 |
<meta name = "DC.Title" |
| 931 |
content = "Nutritional Allocation Increase"> |
| 932 |
<meta name = "DC.Date.Created" |
| 933 |
content = "1999-03-08"> |
| 934 |
<meta name = "DC.Identifier" |
| 935 |
content = "<a href="http://moes.bar.com/doh/homer.html">http://moes.bar.com/doh/homer.html</a>"> |
| 936 |
<meta name = "DC.Format" |
| 937 |
content = "text/html; 1320 bytes"> |
| 938 |
<meta name = "DC.Language" |
| 939 |
content = "en-BUREAUCRATESE"> |
| 940 |
<meta name = "RC.MetadataAuthority" |
| 941 |
content = "Springfield Nuclear"> |
| 942 |
<link rel = "schema.DC" |
| 943 |
href = "<a href="http://purl.org/DC/elements/1.0/">http://purl.org/DC/elements/1.0/</a>"> |
| 944 |
<link rel = "schema.RC" |
| 945 |
|
| 946 |
|
| 947 |
|
| 948 |
<span class="grey">Kunze Informational [Page 17]</span></pre> |
| 949 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-18" ></span> |
| 950 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 951 |
|
| 952 |
|
| 953 |
href = "<a href="http://nukes.org/ReactorCore/rc">http://nukes.org/ReactorCore/rc</a>"> |
| 954 |
<meta name = "DC.Type" |
| 955 |
content = "Memorandum"> |
| 956 |
</head> |
| 957 |
<body> |
| 958 |
<p> |
| 959 |
From: Acting Shift Supervisor |
| 960 |
To: Plant Control Personnel |
| 961 |
RE: Nutritional Allocation Increase |
| 962 |
Date: 1999-03-08 |
| 963 |
<p> |
| 964 |
Pursuant to directive DOH:10.2001/405aec of article B-2022, |
| 965 |
sub<a href="#section-48.2.4.4.1">section 48.2.4.4.1</a>c regarding staff morale and employee |
| 966 |
productivity standards, the current allocation of doughnut |
| 967 |
acquisition funds shall be increased effective immediately. |
| 968 |
</body> |
| 969 |
</html> |
| 970 |
|
| 971 |
Here is the script that accomplishes this transformation. |
| 972 |
|
| 973 |
#!/depot/bin/perl |
| 974 |
# |
| 975 |
# This Perl script processes metadata block declarations of the form |
| 976 |
# <!--metablock TITLE_OF_DOCUMENT --> and variable references of the |
| 977 |
# form (--mbVARNAME), replacing them with full metadata blocks and |
| 978 |
# variable values, respectively. Requires a "template" file. |
| 979 |
# Outputs an HTML file. |
| 980 |
# |
| 981 |
# Invoke this script with a single filename argument, "foo". It creates |
| 982 |
# an output file "foo.html" using a temporary working file "foo.work". |
| 983 |
# The size of foo.work is measured after variable replacement, and is |
| 984 |
# later inserted into the file in such a way that the file's size does |
| 985 |
# not change in the process. Has little or no error checking. |
| 986 |
|
| 987 |
$infile = shift; |
| 988 |
open(IN, "< $infile") |
| 989 |
or die("Could not open input file \"$infile\""); |
| 990 |
$workfile = "$infile.work"; |
| 991 |
unlink($workfile); |
| 992 |
open(WORK, "+> $workfile") |
| 993 |
or die("Could not open work file \"$workfile\""); |
| 994 |
|
| 995 |
@offsets = (); # records locations for late size replacement |
| 996 |
$title = ""; # gets the title during metablock processing |
| 997 |
$language = "en"; # pre-set language here (not in the template) |
| 998 |
$baseURL = "<a href="http://moes.bar.com/doh">http://moes.bar.com/doh</a>"; # pre-set base URL here also |
| 999 |
$filename = "$infile.html"; # final output filename |
| 1000 |
$filesize = "(--mbfilesize)"; # replaced late (separate pass) |
| 1001 |
|
| 1002 |
|
| 1003 |
|
| 1004 |
<span class="grey">Kunze Informational [Page 18]</span></pre> |
| 1005 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-19" ></span> |
| 1006 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 1007 |
|
| 1008 |
|
| 1009 |
($year, $month, $day) = (localtime( (stat IN) [9] ))[5, 4, 3]; |
| 1010 |
$filemodtime = sprintf "%s-%02s-%02s", 1900 + $year, 1 + $month, $day; |
| 1011 |
|
| 1012 |
sub putout { # outputs current line with variable replacement |
| 1013 |
if (! /\(--mb/) { |
| 1014 |
print WORK; |
| 1015 |
return; |
| 1016 |
} |
| 1017 |
if (/\(--mbfilesize\)/) # remember where it was |
| 1018 |
{ push @offsets, tell WORK; } # but don't replace yet |
| 1019 |
s/\(--mbtitle\)/$title/g; |
| 1020 |
s/\(--mblanguage\)/$language/g; |
| 1021 |
s/\(--mbbaseURL\)/$baseURL/g; |
| 1022 |
s/\(--mbfilename\)/$filename/g; |
| 1023 |
s/\(--mbfilemodtime\)/$filemodtime/g; |
| 1024 |
print WORK; |
| 1025 |
} |
| 1026 |
|
| 1027 |
while (<IN>) { # main loop for input file |
| 1028 |
if (! /(.*)<!--metablock\s*(.*)/) { |
| 1029 |
&putout; |
| 1030 |
next; |
| 1031 |
} |
| 1032 |
$title = $2; |
| 1033 |
$_ = $1; |
| 1034 |
&putout; |
| 1035 |
if ($title =~ s/\s*-->(.*)//) { |
| 1036 |
$remainder = $1; |
| 1037 |
} |
| 1038 |
else { |
| 1039 |
while (<IN>) { |
| 1040 |
$title .= $_; |
| 1041 |
last if (/(.*)\s*-->(.*)/); |
| 1042 |
} |
| 1043 |
$title .= $1; |
| 1044 |
$remainder = $2; |
| 1045 |
} |
| 1046 |
open(TPLATE, "< template") |
| 1047 |
or die("Could not open template file"); |
| 1048 |
while (<TPLATE>) # subloop for template file |
| 1049 |
{ &putout; } |
| 1050 |
close(TPLATE); |
| 1051 |
$_ = $remainder; |
| 1052 |
&putout; |
| 1053 |
|
| 1054 |
|
| 1055 |
|
| 1056 |
|
| 1057 |
|
| 1058 |
|
| 1059 |
|
| 1060 |
<span class="grey">Kunze Informational [Page 19]</span></pre> |
| 1061 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-20" ></span> |
| 1062 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 1063 |
|
| 1064 |
|
| 1065 |
} |
| 1066 |
close(IN); |
| 1067 |
|
| 1068 |
# Now replace filesize variables without altering total byte count. |
| 1069 |
select( (select(WORK), $| = 1) [0] ); # first flush output so we |
| 1070 |
if (($size = -s WORK) < 100000) # can get final file size |
| 1071 |
{ $scale = 0; } # and set scale factor or |
| 1072 |
else { # compute it, keeping width of size field low |
| 1073 |
for ($scale = 0; $size >= 1000; $scale++) |
| 1074 |
{ $size /= 1024; } |
| 1075 |
} |
| 1076 |
$filesize = sprintf "%7.7s %sbytes", |
| 1077 |
$size, (" ", "K", "M", "G", "T", "P") [$scale]; |
| 1078 |
|
| 1079 |
foreach $pos (@offsets) { # loop through saved size locations |
| 1080 |
seek WORK, $pos, 0; # read the line found there |
| 1081 |
$_ = <WORK>; |
| 1082 |
# $filesize must be exactly as wide as "(--mbfilesize)" |
| 1083 |
s/\(--mbfilesize\)/$filesize/g; |
| 1084 |
seek WORK, $pos, 0; # rewrite it with replacement |
| 1085 |
print WORK; |
| 1086 |
} |
| 1087 |
|
| 1088 |
close(WORK); |
| 1089 |
rename($workfile, "$filename") |
| 1090 |
or die("Could not rename \"$workfile\" to \"$filename\""); |
| 1091 |
# ---- end of Perl script ---- |
| 1092 |
|
| 1093 |
|
| 1094 |
|
| 1095 |
|
| 1096 |
|
| 1097 |
|
| 1098 |
|
| 1099 |
|
| 1100 |
|
| 1101 |
|
| 1102 |
|
| 1103 |
|
| 1104 |
|
| 1105 |
|
| 1106 |
|
| 1107 |
|
| 1108 |
|
| 1109 |
|
| 1110 |
|
| 1111 |
|
| 1112 |
|
| 1113 |
|
| 1114 |
|
| 1115 |
|
| 1116 |
<span class="grey">Kunze Informational [Page 20]</span></pre> |
| 1117 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-21" ></span> |
| 1118 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 1119 |
|
| 1120 |
|
| 1121 |
<span class="h2"><a class="selflink" id="section-10" href="#section-10">10</a>. Author's Address</span> |
| 1122 |
|
| 1123 |
John A. Kunze |
| 1124 |
Center for Knowledge Management |
| 1125 |
University of California, San Francisco |
| 1126 |
530 Parnassus Ave, Box 0840 |
| 1127 |
San Francisco, CA 94143-0840, USA |
| 1128 |
|
| 1129 |
Fax: +1 415-476-4653 |
| 1130 |
EMail: [email protected] |
| 1131 |
|
| 1132 |
|
| 1133 |
<span class="h2"><a class="selflink" id="section-11" href="#section-11">11</a>. References</span> |
| 1134 |
|
| 1135 |
[<a id="ref-AAT">AAT</a>] Art and Architecture Thesaurus, Getty Information |
| 1136 |
Institute. |
| 1137 |
<a href="http://shiva.pub.getty.edu/aat_browser/">http://shiva.pub.getty.edu/aat_browser/</a> |
| 1138 |
|
| 1139 |
[<a id="ref-AC">AC</a>] The A-Core: Metadata about Content Metadata, (in |
| 1140 |
progress) |
| 1141 |
<a href="http://metadata.net/ac/draft-iannella-admin-01.txt">http://metadata.net/ac/draft-iannella-admin-01.txt</a> |
| 1142 |
|
| 1143 |
[<a id="ref-DC1">DC1</a>] Weibel, S., Kunze, J., Lagoze, C. and M. Wolf, |
| 1144 |
"Dublin Core Metadata for Resource Discovery", <a href="./rfc2413">RFC</a> |
| 1145 |
<a href="./rfc2413">2413</a>, September 1998. |
| 1146 |
<a href="ftp://ftp.isi.edu/in-notes/rfc2413.txt">ftp://ftp.isi.edu/in-notes/rfc2413.txt</a> |
| 1147 |
|
| 1148 |
[<a id="ref-DCHOME">DCHOME</a>] Dublin Core Initiative Home Page. |
| 1149 |
<a href="http://purl.org/DC/">http://purl.org/DC/</a> |
| 1150 |
|
| 1151 |
[<a id="ref-DCPROJECTS">DCPROJECTS</a>] Projects Using Dublin Core Metadata. |
| 1152 |
<a href="http://purl.org/DC/projects/index.htm">http://purl.org/DC/projects/index.htm</a> |
| 1153 |
|
| 1154 |
[<a id="ref-DCT1">DCT1</a>] Dublin Core Type List 1, DC Type Working Group, |
| 1155 |
March 1999. |
| 1156 |
<a href="http://www.loc.gov/marc/typelist.html">http://www.loc.gov/marc/typelist.html</a> |
| 1157 |
|
| 1158 |
[<a id="ref-freeWAIS-sf2.0">freeWAIS-sf2.0</a>] The enhanced freeWAIS distribution, February 1999. |
| 1159 |
<a href="http://ls6-www.cs.uni-dortmund.de/ir/projects/freeWAIS-sf/">http://ls6-www.cs.uni-</a> |
| 1160 |
<a href="http://ls6-www.cs.uni-dortmund.de/ir/projects/freeWAIS-sf/">dortmund.de/ir/projects/freeWAIS-sf/</a> |
| 1161 |
|
| 1162 |
[<a id="ref-GLIMPSE">GLIMPSE</a>] Glimpse Home Page. |
| 1163 |
<a href="http://glimpse.cs.arizona.edu/">http://glimpse.cs.arizona.edu/</a> |
| 1164 |
|
| 1165 |
[<a id="ref-HARVEST">HARVEST</a>] Harvest Web Indexing. |
| 1166 |
<a href="http://www.tardis.ed.ac.uk/harvest/">http://www.tardis.ed.ac.uk/harvest/</a> |
| 1167 |
|
| 1168 |
|
| 1169 |
|
| 1170 |
|
| 1171 |
|
| 1172 |
<span class="grey">Kunze Informational [Page 21]</span></pre> |
| 1173 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-22" ></span> |
| 1174 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 1175 |
|
| 1176 |
|
| 1177 |
[<a id="ref-HTML4.0">HTML4.0</a>] Hypertext Markup Language 4.0 Specification, April |
| 1178 |
1998. |
| 1179 |
<a href="http://www.w3.org/TR/REC-html40/">http://www.w3.org/TR/REC-html40/</a> |
| 1180 |
|
| 1181 |
[<a id="ref-ISEARCH">ISEARCH</a>] Isearch Resources Page. |
| 1182 |
<a href="http://www.etymon.com/Isearch/">http://www.etymon.com/Isearch/</a> |
| 1183 |
|
| 1184 |
[<a id="ref-ISO639-2">ISO639-2</a>] Code for the representation of names of languages, |
| 1185 |
1996. |
| 1186 |
<a href="http://www.indigo.ie/egt/standards/iso639/iso639-2-en.html">http://www.indigo.ie/egt/standards/iso639/iso639-2-</a> |
| 1187 |
<a href="http://www.indigo.ie/egt/standards/iso639/iso639-2-en.html">en.html</a> |
| 1188 |
|
| 1189 |
[<a id="ref-ISO8601">ISO8601</a>] ISO 8601:1988(E), Data elements and interchange |
| 1190 |
formats -- Information interchange -- Representation |
| 1191 |
of dates and times, International Organization for |
| 1192 |
Standardization, June 1988. |
| 1193 |
<a href="http://www.iso.ch/markete/8601.pdf">http://www.iso.ch/markete/8601.pdf</a> |
| 1194 |
|
| 1195 |
[<a id="ref-MARC">MARC</a>] USMARC Format for Bibliographic Data, US Library of |
| 1196 |
Congress. |
| 1197 |
<a href="http://lcweb.loc.gov/marc/marc.html">http://lcweb.loc.gov/marc/marc.html</a> |
| 1198 |
|
| 1199 |
[<a id="ref-PERL">PERL</a>] L. Wall, T. Christiansen, R. Schwartz, Programming |
| 1200 |
Perl, Second Edition, O'Reilly, 1996. |
| 1201 |
|
| 1202 |
[<a id="ref-RDF">RDF</a>] Resource Description Framework Model and Syntax |
| 1203 |
Specification, February 1999. |
| 1204 |
<a href="http://www.w3.org/TR/REC-rdf-syntax/">http://www.w3.org/TR/REC-rdf-syntax/</a> |
| 1205 |
|
| 1206 |
[<a id="ref-RFC1766">RFC1766</a>] Alvestrand, H., "Tags for the Identification of |
| 1207 |
Languages", <a href="./rfc1766">RFC 1766</a>, March 1996. |
| 1208 |
<a href="ftp://ftp.isi.edu/in-notes/rfc1766.txt">ftp://ftp.isi.edu/in-notes/rfc1766.txt</a> |
| 1209 |
|
| 1210 |
[<a id="ref-SWISH-E">SWISH-E</a>] Simple Web Indexing System for Humans - Enhanced. |
| 1211 |
<a href="http://sunsite.Berkeley.EDU/SWISH-E/">http://sunsite.Berkeley.EDU/SWISH-E/</a> |
| 1212 |
|
| 1213 |
[<a id="ref-TGN">TGN</a>] Thesaurus of Geographic Names, Getty Information |
| 1214 |
Institute. |
| 1215 |
<a href="http://shiva.pub.getty.edu/tgn_browser/">http://shiva.pub.getty.edu/tgn_browser/</a> |
| 1216 |
|
| 1217 |
[<a id="ref-WTN8601">WTN8601</a>] W3C Technical Note - Profile of ISO 8601 Date and |
| 1218 |
Time Formats. |
| 1219 |
<a href="http://www.w3.org/TR/NOTE-datetime">http://www.w3.org/TR/NOTE-datetime</a> |
| 1220 |
|
| 1221 |
[<a id="ref-XML">XML</a>] Extensible Markup Language (XML). |
| 1222 |
<a href="http://www.w3.org/TR/REC-xml">http://www.w3.org/TR/REC-xml</a> |
| 1223 |
|
| 1224 |
|
| 1225 |
|
| 1226 |
|
| 1227 |
|
| 1228 |
<span class="grey">Kunze Informational [Page 22]</span></pre> |
| 1229 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-23" ></span> |
| 1230 |
<span class="grey"><a href="./rfc2731">RFC 2731</a> Encoding Dublin Core Metadata in HTML December 1999</span> |
| 1231 |
|
| 1232 |
|
| 1233 |
<span class="h2"><a class="selflink" id="section-12" href="#section-12">12</a>. Full Copyright Statement</span> |
| 1234 |
|
| 1235 |
Copyright (C) The Internet Society (1999). All Rights Reserved. |
| 1236 |
|
| 1237 |
This document and translations of it may be copied and furnished to |
| 1238 |
others, and derivative works that comment on or otherwise explain it |
| 1239 |
or assist in its implementation may be prepared, copied, published |
| 1240 |
and distributed, in whole or in part, without restriction of any |
| 1241 |
kind, provided that the above copyright notice and this paragraph are |
| 1242 |
included on all such copies and derivative works. However, this |
| 1243 |
document itself may not be modified in any way, such as by removing |
| 1244 |
the copyright notice or references to the Internet Society or other |
| 1245 |
Internet organizations, except as needed for the purpose of |
| 1246 |
developing Internet standards in which case the procedures for |
| 1247 |
copyrights defined in the Internet Standards process must be |
| 1248 |
followed, or as required to translate it into languages other than |
| 1249 |
English. |
| 1250 |
|
| 1251 |
The limited permissions granted above are perpetual and will not be |
| 1252 |
revoked by the Internet Society or its successors or assigns. |
| 1253 |
|
| 1254 |
This document and the information contained herein is provided on an |
| 1255 |
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING |
| 1256 |
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING |
| 1257 |
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION |
| 1258 |
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF |
| 1259 |
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. |
| 1260 |
|
| 1261 |
Acknowledgement |
| 1262 |
|
| 1263 |
Funding for the RFC Editor function is currently provided by the |
| 1264 |
Internet Society. |
| 1265 |
|
| 1266 |
|
| 1267 |
|
| 1268 |
|
| 1269 |
|
| 1270 |
|
| 1271 |
|
| 1272 |
|
| 1273 |
|
| 1274 |
|
| 1275 |
|
| 1276 |
|
| 1277 |
|
| 1278 |
|
| 1279 |
|
| 1280 |
|
| 1281 |
|
| 1282 |
|
| 1283 |
|
| 1284 |
Kunze Informational [Page 23] |
| 1285 |
</pre> |