?? rfc2731.txt
字號:
組織:中國互動出版網(http://www.china-pub.com/)
RFC文檔中文翻譯計劃(http://www.china-pub.com/compters/emook/aboutemook.htm)
E-mail:ouyang@china-pub.com
譯者:王安鵬(anpengwang anpengwang@263.net)
譯文發布時間:2002-3-29
版權:本翻譯文檔可以用于非商業用途自由轉載,但必須保留本文檔的翻譯及組織信息。
Network Working Group J. Kunze
Request for Comments: 2731 Dublin Core
Category: Informational Metadata Initiative
December 1999
在HTML中使用DC元數據
(Encoding Dublin Core Metadata in HTML)
本備忘錄狀態
本備忘錄為Internet社區提供一些信息,但沒有規定任何Internet標準。本備忘錄的發布不受限制
版權信息
Copyright (C) The Internet Society (1999)。版權所有。
目錄
1. 摘要 1
2. HTML、Dublin核心元數據及其他原數據 1
3.META標簽 2
4、LINK標簽 2
5、編碼建議 3
6、DC元數據的實際應用 4
7、DC元素編碼 4
8、安全性問題 10
9、附錄——處理用META標簽編碼的元數據的Perl腳本程序 10
10. 作者地址 15
11、參考資料 15
12、版權聲明 17
1. 摘要
Dublin核心元數據 [DC1]是描述信息資源的小的元數據元素集合,本文討論如何在HTML文檔[HTML4.0]中通過META和LINK標簽表示這些元素。嵌入HTML的元數據用于描述文檔本身的信息。本文通過一些例子說明了如何用現有的軟件來檢索、顯示和處理這些元數據,軟件包括附錄中列出的[SWISH-E]、[freeWAIS-sf2.0]、[GLIMPSE]、 [HARVEST]、 [ISEARCH]以及Perl[PERL]腳本語言等。
2. HTML、Dublin核心元數據及其他原數據
[DCHOME]發起的Dublin核心元數據推出了一組少量的資源描述類別DC1,或者叫元數據元素(從字面上看就是關于數據的數據)。一般而言,元數據元素相對它們所描述的資源要小得多,而且如果資源格式支持可以把元數據嵌入到資源中。支持嵌入元數據的有兩類資源:超文本標記語言(HTML)與擴展標記語言(XML)。HTML已經得到了廣泛的應用,但是一旦標準化,XML與資源描述框架(RDF)一起有望提供對源數據進行編碼的更有效的方式。RDF規范實際上描述了在HTML文檔中按照一種簡潔語法應用RDF的方法。
本文講述了如何在HTML4.0中對元數據進行編碼,這些元數據元素的語義在其他文檔中定義。為了方便說明,文中提及了某些元數據的語義,但不應把這些語義看作是定義性的。
HTML編碼允許DC元數據元素與其它元素混合使用(前提是那些元素的用法支持混合使用)。DC元素使用前綴“DC”標記,其他元素則使用另外的標記,比方說AC表示來自A-Core[AC]的元素。
3.META標簽
HTML中的META標簽用于已經命名的元數據元素進行編碼,每個元素描述了文檔或者其他信息資源的一個方面。比方說<meta name="DC.Creator" content="Simpson, Homer">,這個元素說明創作者是Homer Simpson,其中Creator是DC元素集中定義的一個元素。更一般的形式為:
<meta name = "PREFIX . ELEMENT_NAME"
content = "ELEMENT_VALUE">
大寫部分表示在應用時要換成真正的標記符,在上面的例子中,ELEMENT_NAME是Creator, ELEMENT_VALUE是Simpson, Homer而PREFIX則是DC。
在META標簽中,DC元素名的第一個字母要大寫,但對元素值的大小寫沒有要求,也沒有限制同時出現的META元素的個數與順序。同一個DC元素可以出現多次,每個DC元素都是可選的。下面的例子是對一本書的說明,它有兩位作者、兩個標題:
<meta name = "DC.Title"
content = "The Communist Manifesto">
<meta name = "DC.Creator"
content = "Marx, K.">
<meta name = "DC.Creator"
content = "Engels, F.">
<meta name = "DC.Title"
content = "Capital">
使用META編碼的所有DC元素都帶有“DC”前綴,與后面的元素名之間用點號(“.”)隔開。每個非DC元素的編碼都應該有相應的前綴以便于跟蹤其來源和定義,前綴與元素定義之間的聯系通過LINK元素來完成,參閱下一節的說明。非DC元素,比如來自AC的Email可以與DC元素混合使用:
<meta name = "DC.Creator"
content = "Da Costa, José">
<meta name = "AC.Email"
content = "dacostaj@peoplesmail.org">
<meta name = "DC.Title"
content = "Jesse "The Body" Ventura--A Biography">
這個例子還說明了特殊字符的編碼,第一個元素作者名中使用HTML字符實體引用表示一個音標符號——帶有重音號的字母E。類似的,最后一行中有兩個雙引號使用的是數字字符引用,以便于元素內容分隔符區別開。
4、LINK標簽
HTML的LINK可以把元素名前綴與元素的參考定義關聯在一起。如果沒有LINK標簽與相應的定義文檔關聯,只有META標簽描述的資源是不完整的。前面的例子再加上以下兩個元素就可以認為是完整的了:
<link rel = "schema.DC"
href = "http://purl.org/DC/elements/1.0/">
<link rel = "schema.AC"
href = "http://metadata.net/ac/2.0/">
一般來說這種聯系通常采用如下的形式:
<link rel ="schema.PREFIX" href = "LOCATION_OF_DEFINITION" >
其中的PREFIX要代換為實際使用的前綴,LOCATION_OF_DEFINITION則是定義文檔的URL或URN。嵌入在HTML文檔HEAD部分的LINK和META序列,描述的是該HTML文檔自身的信息。下面是帶有描述信息的一個完整的HTML文檔。
<html>
<head>
<title> A Dirge </title>
<link rel = "schema.DC"
href = "http://purl.org/DC/elements/1.0/">
<meta name = "DC.Title"
content = "A Dirge">
<meta name = "DC.Creator"
content = "Shelley, Percy Bysshe">
<meta name = "DC.Type"
content = "poem">
<meta name = "DC.Date"
content = "1820">
<meta name = "DC.Format"
content = "text/html">
<meta name = "DC.Language"
content = "en">
</head>
<body><pre>
Rough wind, that moanest loud
Grief too sad for song;
Wild wind, when sullen cloud
Knells all the night long;
Sad storm, whose tears are vain,
Bare woods, whose branches strain,
Deep caves and dreary main, -
Wail, for the world's wrong!
</pre></body>
</html>
5、編碼建議
與這里推薦的元數據編碼方式相比,在原理上和實際應用中HTML對元數據編碼的要求更加寬松,不過稍加限制更有助于元數據解碼和處理軟件的開發。在目前的發展階段,一些簡單的原型和試驗促進了實用標準的開發。
因此最好按照本文以下所舉例子的標記方法在HTML中書寫元數據:前綴及元素名用大寫、屬性值用雙引號括起來,一行中最多只有一個META元素。當然實際編寫元數據代碼的伸縮性很大,不過選擇并始終堅持這種風格似乎更有助于元數據的處理與編輯。下面的三個標簽都符合上面的建議,內容也相同但是書寫風格不一致:
<META NAME="DC.Format"
CONTENT="text/html; 12 Kbytes">
<meta
Content = "text/html; 12 Kbytes"
Name = "DC.Format"
>
<meta name = "DC.Format" content = "text/html; 12 Kbytes">
按照上述建議編碼有助于使元數據被一些廣泛使用的免費軟件包所接受、檢索和處理,比如[SWISH-E]、[freeWAIS-sf2.0]、[GLIMPSE]、[HARVEST]和[ISEARCH]。這些約定還可以與附錄中的腳本,以及[DCHOME]網站上的大部分[DCPROJECTS]應用程序協同工作。支持LINK標簽和修飾符約定(下一節)的軟件現在還不多。
元數據元素的順序一般是不固定的。檢索并顯示元數據的軟件的開發者應該盡量保持同名的META標簽元素的相對順序(比方說多個文檔作者),但是如果通過不明系統傳輸,元數據的提供者與檢索程序并不能保證元數據的先后順序保持不變。
6、DC元數據的實際應用
在實際用與資源描述時,為了表達含義上的細微差別,經常需要對DCC元素作一些修飾。雖然這些修飾符的應用原則和具體語義超出了本文的范圍,為了方便日常應用,后面通過一些例子介紹修飾語法。對下述在META標簽中應用元數據描述符的三種語法(可能發生變化)不再作進一步的說明。
<meta lang = "LANGUAGE_OF_METADATA_CONTENT" ... >
<meta scheme = "CONTROLLED_FORMAT_OR_VOCABULARY_OF_METADATA" ... >
<meta name = "PREFIX.ELEMENT_NAME.SUBELEMENT_NAME" ... >
據此,某部西班牙語的遺作可以寫為:
<meta name = "DC.Language"
scheme = "rfc1766"
content = "es">
<meta name = "DC.Title"
lang = "es"
content = "La Mesa Verde y la Silla Roja">
<meta name = "DC.Title"
lang = "en"
content = "The Green Table and the Red Chair">
<meta name = "DC.Date.Created"
content = "1935">
<meta name = "DC.Date.Available"
content = "1939">
需要注意,本文例中所使用的修飾符語法和標簽后綴(跟在元素名和點號后)僅僅反映了修飾符HTML編碼的趨勢,這種語法格式和后綴既非標準也不建議這么做。
7、DC元素編碼
這一節針對不同的DC元素舉出了相應的應用實例:
Title (給出的資源名)
-----
<meta name = "DC.Title"
content = "Polycyclic aromatic hydrocarbon contamination">
<meta name = "DC.Title"
content = "Crime and Punishment">
<meta name = "DC.Title"
content = "Methods of Information in Medicine, Vol 32, No 4">
<meta name = "DC.Title"
content = "Still life #4 with flowers">
<meta name = "DC.Title"
lang = "de"
content = "Das Wohltemperierte Klavier, Teil I">
Creator (常見內容的實體)
-------
<meta name = "DC.Creator"
content = "Gogh, Vincent van">
<meta name = "DC.Creator"
content = "van Gogh, Vincent">
<meta name = "DC.Creator"
content = "Mao Tse Tung">
<meta name = "DC.Creator"
content = "Mao, Tse Tung">
<meta name = "DC.Creator"
content = "Plato">
<meta name = "DC.Creator"
lang = "fr"
content = "Platon">
<meta name = "DC.Creator.Director"
content = "Sturges, Preston">
<meta name = "DC.Creator.Writer"
content = "Hecht, Ben">
<meta name = "DC.Creator.Producer"
content = "Chaplin, Charles">
Subject (主題或關鍵字)
-------
<meta name = "DC.Subject"
content = "heart attack">
<meta name = "DC.Subject"
scheme = "MESH"
content = "Myocardial Infarction; Pericardial Effusion">
<meta name = "DC.Subject"
content = "vietnam war">
<meta name = "DC.Subject"
scheme = "LCSH"
content = "Vietnamese Conflict, 1961-1975">
<meta name = "DC.Subject"
content = "Friendship">
<meta name = "DC.Subject"
scheme = "ddc"
content = "158.25">
Description (說明、小結與摘要)
-----------
<meta name = "DC.Description"
lang = "en"
content = "The Author gives some Account of Himself and Family
-- His First Inducements to Travel -- He is
Shipwrecked, and Swims for his Life -- Gets safe on
Shore in the Country of Lilliput -- Is made a
Prisoner, and carried up the Country">
<meta name = "DC.Description"
content = "A tutorial and reference manual for Java.">
<meta name = "DC.Description"
content = "Seated family of five, coconut trees to the left,
sailboats moored off sandy beach to the right,
with volcano in the background.">
Publisher (出版商、發布方)
---------
<meta name = "DC.Publisher"
content = "O'Reilly">
<meta name = "DC.Publisher"
content = "Digital Equipment Corporation">
<meta name = "DC.Publisher"
content = "University of California Press">
<meta name = "DC.Publisher"
content = "State of Florida (USA)">
Contributor (其他貢獻者)
-----------
<meta name = "DC.Contributor"
content = "Curie, Marie">
<meta name = "DC.Contributor.Photographer"
content = "Adams, Ansel">
<meta name = "DC.Contributor.Artist"
content = "Sendak, Maurice">
<meta name = "DC.Contributor.Editor"
content = "Starr, Kenneth">
Date (該資源生命期中的某個時點; 推薦[WTN8601])
----
<meta name = "DC.Date"
content = "1972">
<meta name = "DC.Date"
content = "1998-05-14">
<meta name = "DC.Date"
scheme = "WTN8601"
content = "1998-05-14">
<meta name = "DC.Date.Created"
content = "1998-05-14">
<meta name = "DC.Date.Available"
content = "1998-05-21">
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -