RFC: ç¶ã»Hatena ID Auto-Discovery ã®ä»æ§
Hatena ID Auto-Discovery ã®ä»æ§ã«ã¤ãã¦ãé·æã§ãã
å æ¥ãã®ãã¼ã¸ã誰ã®ãã®ãªã®ãã示ãèå¥åãåãè¾¼ãä»æ§ãèãã¦ããã¨ãã話ãæ¸ããå¾ããã¾ãã¾ãªãã£ã¼ãããã¯ãããããã¨ãã§ããã®ã§ãå¾æ¥Hatena ID Auto-Discovery ã®ä»æ§ã¨ããã®ãæ¸ãã¾ãããããããæ°ãã«å¹¾ã¤ããã£ã¼ãããã¯ãããã ãã¾ãã¦ãããããæ´çããªããæ¹åãä¿®æ£ä¸ã§ãã
ããããã¿ãªããã»ãã¨ããããã¢ããã¤ã¹ãããã¨ããããã¾ããã¤ãã¥ãèªåãã¦ã§ãã®ä»æ§ã«ã¤ãã¦ä¸åå¼·ã ãªãã¨çæãã¤ã¤ãã¦ã§ãã®æ¨æºã£ã¦è²ã ãããã ãªãã¨ãããã«æå¿ããããä¸äººã§è²ã 調ã¹ã¦ãã ããããªããªãæ£è§£ã«ã¯è¡ãçããªããªãã¨ããã®ãæ£ç´æã£ã¦ã¿ããã§ãã
ãã¨ãã
ã¾ãããããåãèããä»æ§ã¯...ã¨ããåã«ã¾ãä½ããããããæ確ã«ããªãã¨ã§ãããåããããã®ã¯ãã¯ã¦ãªãã¤ã¢ãªã¼ãå«ããã¤ã³ã¿ã¼ãããä¸ã®ã¦ã§ããã¼ã¸ (Permalink) ããããã®ãã¼ã¸ãä½ã£ã人ã®ãã¯ã¦ãªã®IDããæ¢ãåºããããã¨ãããã¨ã§ãã
ãªããããããããã¨ããã¨ãã¯ã¦ãªãã¤ã³ãã§ãã¼ã¸ä½è ã«æãéãã§ãããããªã·ã¹ãã ãèãã¦ããããããªã®ã§ããã
åã¯ãæãéãã«ç¹åããªãã»ãããããªããã¨æã£ã¦ã¾ããä¾ãã°ãã¼ã«ãã¼ã«ããã®äººã®ã¯ã¦ãã«ç§»åãã¨ãããã®ã²ã¨ã®ã¯ã¦ããæ°ã«ãä¸è¦§ãã¨ããããã¿ã³ä½ãã®ã«å½¹ç«ã¡ããã ãªãã¨æããã®ã§ã
ã¨åæ¾ãã(id:fumiakiy)ãã³ã¡ã³ãã«æ®ãã¦ããããã«ãPermalink ã«ã¯ã¦ãªIDãåãè¾¼ã¾ãã¦ããã¨ãæãé以å¤ã®ç®çã«ã使ããã¨åãæã£ã¦ããã®ã§ rel="payment" ã foaf:tipjar ã®ãããªæãéã«ç¹åããä»æ§ããã¯ããå°ãåºãä»æ§ããããªã¨æã£ã¦ãã¾ãã
ã¾ããã¯ã¦ãªç¬èªã®ä»æ§ãæ¡ç¨ããããã¯ã¦ã§ãã®ä»çµã¿ã§ä»åã®ç®çã«ä½¿ããããªãã®ããã£ããã°ãã¡ãã«å¾ã£ãæ¹ãè¯ãã ãããã¨ãããã¨ã§ g:webweaver:id:kotastyle ããããããã ããã話ãå ã«Dublin Core ãæ¡ç¨ãã¦ã¿ããã¨ã«ãã¾ããããããå æ¥æ¸ãã
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" /> <link rel="DC.creator" title="id:naoya" href="http://www.hatena.ne.jp/user?userid=naoya" />
ã¨ãããã®ã«ç¸å½ãã¾ãã
ãã®ä»æ§ã«é¢ã㦠yohei ããããyohei-y:weblog: Hatena ID Auto-Discovery ã«ã¤ãã¦ããã ãããã£ã¼ãããã¯ã«ããã¨
- title å±æ§ã¯ä¾¿å®ä¸ã®å©è¨çæ å ±ã§ãããã³ã³ãã³ãä½è ã«å§ããæ¹ãããããåé¤ããã»ããè¯ã
- ID ã¨ãã¦ã® URI ã« query string ãå ¥ã£ã¦ããã®ã¯ Cool URI ãããªã (å¯çµåç)
ã¨ãããã¨ã ãããªã®ã§ã
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" /> <link rel="DC.creator" href="http://www.hatena.ne.jp/user/naoya" />
ãããã®ã§ã¯ãªããã¨ä¿®æ£æ¡ãèãã¾ããããã®ã¨ã href å±æ§ã§æå®ãã¦ãã URI ã¯ã¦ã§ããã©ã¦ã¶ã§ã¢ã¯ã»ã¹ã§ãããããã¯ã¼ã¯ä¸ã®ãªã½ã¼ã¹ã®URIã§ããå¿ è¦ãããã¨æã£ã¦ãã¦ãããã¾ã§ã®ã¯ã¦ãªã®ãµã¼ãã¹åæ§ http://www.hatena.ne.jp/naoya/ ã§ä½ãããã®æ å ±ã«ã¢ã¯ã»ã¹ã§ããããã«ãã¦ãã¡ãã使ãã®ã¯ã©ãã ããããªã©ã¨èãã¦ããã¨ããç¥å´ãããã
(1) Dublin Coreã®creatorã¯ä½è (An entity primarily responsible for making the content of the resource)ã示ããã®ã§ããï¼(2) linkè¦ç´ ã¯ãã¦ã§ãææ¸ãhrefå±æ§å¤URIã示ããªã½ã¼ã¹ã«å¯¾ãã¦ãrelå±æ§å¤ã示ãã¿ã¤ãï¼é¢ä¿ï¼ã®ãªã³ã¯ãæã¤ãã¨ã表ãï¼ãã®2ã¤ã®å¸°çµã¨ãã¦ãlink rel="dc.creator"ã¨æ¸ããããhrefã®å¤ã¯ãä½è ã表ãURIãã¨ãªããããã¯RDFã¨ãã¦è§£éãããã©ãããåãããDublin Coreã¨(X)HTMLã®ã»ãã³ãã£ã¯ã¹ãå®ãã¦ãããã¨ã ã
ããã§åºã¦ããã®ãããä½è ã®ãã¼ã ãã¼ã¸ãããã¦ã¼ã¶æ å ±ãã¼ã¸ãã®URIã人ç©ã表ãURIã¨ãã¦ä»£ç¨ããã£ã¦ããã®ã§ã¯ãã¨ããèãæ¹ã ããããããããã¯ãArchitecture of the World Wide Web, Volume OneãURIã®è¡çª (URI collision) ã¨å¼ãã§ããåé¡ã«é¥ãã
㨠URI ã®è¡çªã«é¢ããã話ãåºã¦ãã¦ã解決çã¨ãã¦ã¯ä»¥ä¸ã® 3 ã¤ã®ãããããããã®ã§ã¯ãªãããã¨ãããã¨ã§ããã
- href ã§æå®ãã URI ããã¯ã¹ãã¼ã¿ã¹ã³ã¼ã 2xx ã¯è¿ããã«ã303 ã§ä½è æ å ±ãªã©ã®ãã¼ã¸ã«ãªãã¤ã¬ã¯ããã
- dc:creator ã§ã¯ãªããä½è ã®ãã¼ã ãã¼ã¸ãã表ãç¬èªã®ããããã£ã使ã
- href ã®å¤ã http: ãªã½ã¼ã¹ã§ã¯ãªãIDã¨ãã¦ã®URIãä¾ãã° urn:pin: ãªã©ã«ãã
ã¨ããã§ãåæ¾ããã®æ¥è¨ããåã³å¼ç¨ããã®ã§ããã
å ã id:naoyaãããRFCããã®ã¯ããã人éãWebãã¼ã¸ã®ã¡ã¿ãã¼ã¿ããèå¥ããæ¹æ³ã§ã¯ãªãã ãããããã§ã¯ãªãã¦ãããWebãã¼ã¸ãæ¸ããã®ã¯ãã¯ã¦ãªã§ã¯ã©ããã風ã«èå¥ã§ããã¨ã³ãã£ãã£ãªã®ãï¼ã¨ãããã¨ã«éããªãã人éã¨ããã¨ã³ãã£ãã£ãã®ãã®ãèå¥ãããã¨ããããã§ã¯ãªãã人éã¨ã³ãã£ãã£ãæã¤ä¸ã¤ã®ãã¥ã¼ãèå¥ãããã¨ãããã¨ã ãããã ããã人éã«ä¸ããããURIã«Webã§ã¢ã¯ã»ã¹ã§ããã®ã¯å¤ã ã¨ããããã¨ã¯ãå°ãªãã¨ãid:naoyaããã®å½é¢ã®ç®æ¨ã¨ã¯ãºã¬ãè°è«ã ã
ã¨ããã¾ãéããåããããã®ã¯ã©ã¡ããã¨ããã¨äººç©ã®URIãå®ãããã¨ããããããIDãåãè¾¼ã¿ãããã¨ããã¨ããã§ããã¤ã¾ãã人éã®URIã表ç¾ã§ããããã«ãããã¨ãããã¨ã§ãããã¼ã ãã¼ã¸ã®ã¢ãã¬ã¹ãæå®ãããã¨ãããã¨ã§ãããã¾ããã(ã¨ãªãã¨ç¥å´ããã示ãã¦ãã ãã£ã¦ãã 3 ã¤ã®è§£æ±ºæ¹æ³ã®ãã¡ãã¹ããªã®ã¯3çªç®ã®ãã®ãªã®ã§ããããã)
ã¾ããä»åã®ç®æ¨ã¨ãã¦
- ãªãã¹ãé å¸ãããã(ãã³ãã¬ã¼ããªã©ã«è¨è¿°ããã®ã«æéãããããªã)å½¢ã§ã®ä»æ§ã«ããã
- User-Agent ãç°¡åã«è§£æ±ºã§ããä»æ§ã«ããã
ã¨ãã pragmatic ãª2ç¹ãããã¾ãã
å ·ä½çã«ã¯ãåè ã¯ä¾ãã°ä¸åº¦ã¯ã¦ãªã®ç®¡çç»é¢ãªã©ã§åãè¾¼ã¿ã®ããã® ID ããã¯ã¦ãªã¢ã«ã¦ã³ãã¨ã¯å¥ã«åå¾ãã¦ããã£ããã¯ããªãã¦ããããã«ãã¨ãããã¨ã§ãå¾è 㯠User-Agent ãç®çã¨ããã¦ã§ããã¼ã¸ã® GET 1 ãªã¯ã¨ã¹ãã§åå¾ããããã¨ãããã¨ã§ãã(ã¯ã¦ãªIDãåå¾ããããã« Auto-Discovery ã«ããå¥ã®ã¡ã¿ãã¼ã¿ãåç §ããããä½ãããã®åå解決ã®ãããªæ段ãç¨ãããã¨ãããããªããã¨ãããã¨ã)
URI ã«ã¤ãã¦ä¸åå¼·ãªã®ã§ãã¡ãã£ã¨ããããã£ã¦ã¾ããã urn:pin: ã¨ããã®ã¯ã¯ã¦ãªIDã¸ã®è§£æ±ºæ段ãå¥ã«å¿ è¦ã«ãªãã¨ããç¹ã§ãåãç®æ¨ã«ãã¦ããã¨ããã¨åããªãã®ã§é£ããã®ããªã¨æãã¾ããä¸è¨ã®äºç¹ãæºãããã㪠ID ã¨ããæå³ã®å¥ URI ãããã®ããæ°ã«ãªã£ã¦ãã¾ããæé軸ã使ãURIã¹ãã¼ã ãtag:ãRFCã« ã«ãã tag: ã使ããã®ã§ãããããã§ãä»åã®ç®çã«ã¯æé軸ã¯å¿ è¦ãªãããªãã
ã¨ãããã¨ã§ãç¾ç¶ã¯
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" /> <link rel="DC.creator" href="http://www.hatena.ne.jp/user/naoya" />
ã¨ããä»æ§ã§ãwww.hatena.ne.jp ã® /user/naoya 㯠/user?userid=naoya ãããã¯ä»ã®ãã¼ã¸ã« 303 ãªãã¤ã¬ã¯ããã¨ããã®ãè½ã¨ãã©ãããªã®ããªã¨æã£ã¦ãã¦ããããã¿ã¼ãªè§£æ³ã¨ãã¦ã®æé©ãª URI ãããã®ãªããã¡ãã使ããã¨ãã£ãã¨ããã§ããããã
ãªããæçµçã«ããã°ã©ã ã§ä½ãããããã¨ãã㨠URI ã§æå®ããã¦ããæååããã¯ã¦ãªIDãåå¾ãããã¨ãããã¨ã ãã ã£ãããã¾ããã¤ã¾ããHTML::HatenaIDAutoDiscovery ã¨ããã¢ã¸ã¥ã¼ã«ãä½ã£ã¦(ä¸ååã®ä»æ§ã§åããã®ã¯ããä½ã£ã¦ã¿ã)ã
my @names = HTML::HatenaIDAutoDiscovery->find( 'http://naoya.dyndns.org/~naoya/mt/archives/001694.html' ); print $names[0]; # naoya
ã¨ãããã¨ããããã®ã§ããã
ã¨ãããã¨ã§ãå¼ãç¶ã Request for Comments ã§ãã
# ãããããããè°è«ã¯è±èªã§ããã¹ããªãã ããããèªåã®è±èªåã®ãªãã«ã¡ãã£ã¨æ²è¦³ã