RDFaでFOAFを書く - vantguarde - web:g

また変なXHTMLを見つけたので。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"   "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">  <html version="XHTML+RDFa 1.0"   xmlns="http://www.w3.org/1999/xhtml"   xmlns:foaf="http://xmlns.com/foaf/0.1/"   xmlns:dc="http://purl.org/dc/terms/">  <head typeof="foaf:PersonalProfileDocument">    <title property="dc:title">profile</title>    <link rel="foaf:maker" resource="[_:vantguarde]"/>    <link rel="foaf:primaryTopic" resource="[_:vantguarde]"/>  </head>  <body>  <h1>profile: vantguarde</h1>  <dl about="[_:vantguarde]" typeof="foaf:Person">  <dt>Name:</dt>  <dd property="foaf:nick">vantguarde</dd>  <dt>Email:</dt>  <dd><a rel="foaf:mbox" href="mailto:vantguarde@example.com">vantguarde@example.com</a></dd>  <dt>Weblog:</dt>  <dd><a rel="foaf:weblog" href="http://web.g.hatena.ne.jp/vantguarde/">vantguarde</a></dd>  <dt>Birthday:</dt>  <dd property="foaf:birthday" content="03-19">19 Mar. 1998</dd>  <dt>Twitter:</dt>  <dd rel="foaf:holdsAccount"><a rel="foaf:isPrimaryTopicOf" href="http://twitter.com/vant">twitter.com/vant</a></dd>  <dt>Skype:</dt>  <dd rel="foaf:phone" resource="callto://vantguarde">vantguarde</dd>  </dl>  </body>  </html>  

RDFaで覚えておくのは次くらいでしょうか。

  • CURIE(QNameっぽくURIを書ける。ブラケットで囲むとsafe CURIEに。)
  • 匿名ノード(アンダースコアがprefixなCURIE。込み入った表現をしたいときにほぼ必須。)
  • @aboutと@resourceはURIまたは匿名ノードをとる。
  • @rel, @revはpredicateを表現。@propertyはリテラル用のpredicate。
  • @rel, @revはRDFaで@about/@resourceに対するpredicateとしてスコープが変更。
  • @hrefなどもリソースとして使われる。
  • @typeofはrdf:typeと等価。
  • chainingというルールがあって、それを使えばいろいろまとめられる。

けっこう多かった。まあでもRDFわかる人ならすぐですね。

foaf.rdfというブラウザーで開けないファイルよりは、RDFa+FOAFなプロファイルページにするのがいいのかなあと思ったりしています。

まだ未確定な部分があるので、このままを鵜呑みにしていけない。
foaf:Personで大きく括ることの方が自然なような気がする。

Posted via web from appling’s posterous | Comment »

Short URL for this post: http://tmblr.co/ZpoVby7MUUS