語意網與microformats

microformats

hlb大大新文章中,提到了語意網(Semantic Web)與microformats(現翻為微格),這些東西以前都有所耳聞,不過一直沒搞清楚是作什麼用的,趁著這個機會把microformats搞清楚了(語意網還沒全部瞭解,不過差不多了)。

簡單說的話,microformats裡面包含很多種format,每個format都是利用現有的XHTML原件組成一個有特定意義的文件,例如hReview是用來發表評論的格式,我要介紹書時就可以用,複製一段範例過來如下:

<div class="hreview">
 <span><span class="rating">5</span> out of 5 stars</span>
 <h4 class="summary"><span class="item fn">Crepes on Cole</span> is awesome</h4>
 <span>Reviewer: <span class="reviewer fn">Tantek</span> - 
 <abbr class="dtreviewed" title="20050418T2300-0700">April 18, 2005</abbr></span>
 <blockquote class="description"><p>
  Crepes on Cole is one of the best little creperies in San Francisco.
  Excellent food and service. Plenty of tables in a variety of sizes 
  for parties large and small.  Window seating makes for excellent 
  people watching to/from the N-Judah which stops right outside.  
  I've had many fun social gatherings here, as well as gotten 
  plenty of work done thanks to neighborhood WiFi.
 </p></blockquote>
 <p>Visit date: <span>April 2005</span></p>
 <p>Food eaten: <span>Florentine crepe</span></p>
</div>

其實說穿了只是照順序排,填入該欄位的內容而已。那用上microformats有什麼好處呢?因為microformats是公開的文件格式,所以其他人可以透過程式簡單的讀取你的文件內容,看是要自訂顯示方式(user script)、自動收集資訊都是可行的,不過最重要的還是資訊間的交流,這樣可以讓文件的被利用度提升不少(當然現在還沒有)。

好像很有發展性,當然就想來試試看,從現有的格式當中挑出來的就是hReviewrelTag這兩個,先放進更新的TODO-List裡:P。