2009-04-25
PURL がおもしろい
RDF の周辺で使われている PURL(Persistent Uniform Resource Locator)という方法が面白い。PURL は参照URLがあるときに、HTTP リダイレクトをつかって、URL 先のアドレスが変更されても、それを参照しているデータのレコードを変更せずに、参照先へのリンクを維持する仕組みです。つまり、データは PURL へリンクしたままで、参照先の変更に追従できるようになる仕組みです。データ間の依存性下げてメンテナンス性を向上するデザインパターンのようです。ほかには、「今日のニュース」や「最新の遺伝子レコード」のような動的なリソースのアドレスとして利用することも適しています。
利用例その1
セマンティックウェブの勉強会で RDF と SPARQL について調べたまとめ - ゲノム周辺 - lifesciencedbグループ の Named Graph の例では、Ontology: provenance と Dublin Core のタームで使用していました。
5: @prefix dw: <http://purl.org/net/datawebs/provenance/> . 6: @prefix dcterms: <http://purl.org/dc/terms/> .
http://purl.org/dc/terms/ は http://rodos.zoo.ox.ac.uk/datawebs/provenance-20080917-owldoc/ にリダイレクトされています。
利用例その2:UniProt
利用例としては、UniProt RDF/XML で外部リンクがすべて purl.uniprot.org ドメインになっています。
エントリ例として、Photosystem Q(B) protein 2precursor - Synechocystis sp. (strain PCC 6803 / Kazusa) の RDF/XML http://www.uniprot.org/uniprot/P16033.rdf からの抜粋:
1: <?xml version='1.0' encoding='UTF-8'?> 2: <rdf:RDF xmlns="http://purl.uniprot.org/core/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:dc="http://purl.org/dc/elements/1.1/"> 3: <rdf:Description rdf:about="http://purl.uniprot.org/uniprot/P16033"> 4: <rdf:type rdf:resource="http://purl.uniprot.org/core/Protein" /> 5: <reviewed>true</reviewed> 6: <created>1990-04-01</created> 7: <modified>2009-03-03</modified> 8: <version>79</version> 9: <mnemonic>PSBA2_SYNY3</mnemonic> 10: <mnemonic>PSB2_SYNY3</mnemonic> 11: <citation rdf:resource="http://purl.uniprot.org/citations/2499875" rdf:ID="_1" /> 12: <citation rdf:resource="http://purl.uniprot.org/citations/2123543" rdf:ID="_2" /> 13: <citation rdf:resource="http://purl.uniprot.org/citations/8905231" rdf:ID="_3" /> 14: <citation rdf:resource="http://purl.uniprot.org/citations/1498597" rdf:ID="_4" /> 15: <citation rdf:resource="http://purl.uniprot.org/citations/8068689" rdf:ID="_5" /> 16: <citation rdf:resource="http://purl.uniprot.org/citations/9512353" rdf:ID="_6" /> ... 20: <organism rdf:resource="http://purl.uniprot.org/taxonomy/1148" /> ... 54: <rdfs:seeAlso rdf:resource="http://purl.uniprot.org/refseq/NP_441550.1" /> ... 62: <rdfs:seeAlso rdf:resource="http://purl.uniprot.org/kegg/syn:sll1867" /> ... 85: <classifiedWith rdf:resource="http://purl.uniprot.org/go/0016021" rdf:ID="_51" /> ... 96: <rdf:Description rdf:about="http://purl.uniprot.org/citations/2499875"> 97: <rdf:type rdf:resource="http://purl.uniprot.org/core/Journal_Citation" /> ... 104: <owl:sameAs rdf:resource="http://purl.uniprot.org/medline/89282415" /> 105: <owl:sameAs rdf:resource="http://purl.uniprot.org/pubmed/2499875" /> ...
- xmlns 宣言で http://purl.uniprot.org/core/(2行目)
- xmlns:dc 宣言で http://purl.org/dc/elements/1.1/(2行目)
- rdf:Description rdf:about="http://purl.uniprot.org/uniprot/P16033"(3行目)
- UniProt のタイプとして http://purl.uniprot.org/core/Protein (4行目)
- 引用文献として http://purl.uniprot.org/citations/2499875 (11-16行目)
- 外部データソース Taxonomy のレコードで http://purl.uniprot.org/taxonomy/1148 (20行目)
- RefSeq (54行目)、KEGG(62行目)、GO(85行目)、Medline(104行目)、PubMed(105行目)
というように、w3.org 以外のすべてのリンクに PURL(purl.uniprot.org と purl.org)を利用しています。外部データソース(Taxonomy、RefSeq、KEGG、GO、medline、PubMedなど)は、 ${データソース名}/${ENTRY_ID} というURL設計。こうすると、(1)RDF/XML書類内部に比較的短いURLとして記述できて、書類サイズが小さくなり、(2)リンク先が変更されても、書類を変更する必要がなくなるというメリットがあると考えられます。また、purl と名乗っているものは無くならないということを暗黙に表明できるので、リンク先性が高まるとおもいました。
- eFoundations: UniProt, URNs, PURLs
- URL +1, LSID -1 from Eric Jain on 2007-07-10 (public-semweb-lifesci@w3.org from July 2007) -- 2007/07 に UniProt が LSID をやめて PURL をつかうことにしたようです。
PURL のしくみ
http://purl.oclc.org/docs/purl_faq.html:titlPURL FAQ] からざっとひろってみます。
PURL は HTTP リダイレクトを利用する
- クライアント → PURLサーバ -- PURL にアクセス
- クライアント ← PURLサーバ -- リダイレクトURLが返る
- クライアント → リソースサーバ -- リダイレクトURLにアクセス
- クライアント ← リソースサーバ -- リソースが返る
PURL は三つのパートから構成されている:プロトコル、解決アドレス、名前
名前の部分は、すべての path を含む訳ではない。
purl.org はユーザ登録すると、PURLサーバを構築することができる
PURL の名前に利用できる文字、利用できない文字
- # と ~ が使えない。