<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>Fumihiro Kato / 加藤 文彦 &#187; SemanticWebFumihiro Kato / 加藤 文彦</title>
	<atom:link href="http://fumi.me/category/web/semanticweb-web/feed/" rel="self" type="application/rss+xml" />
	<link>http://fumi.me</link>
	<description>Webやガジェット好き</description>
	<lastBuildDate>Thu, 17 May 2012 14:47:24 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://fumi.me/category/web/semanticweb-web/feed/" />
		<item>
		<title>第1回 LinkedData勉強会</title>
		<link>http://fumi.me/2011/01/29/lodjp/</link>
		<comments>http://fumi.me/2011/01/29/lodjp/#comments</comments>
		<pubDate>Sat, 29 Jan 2011 07:51:17 +0000</pubDate>
		<dc:creator>fumi</dc:creator>
				<category><![CDATA[SemanticWeb]]></category>
		<category><![CDATA[Event]]></category>
		<category><![CDATA[LOD]]></category>

		<guid isPermaLink="false">http://fumi.me/?p=2977</guid>
		<description><![CDATA[
<div class="twitterbutton" style="float: left; padding-right: 5px;"><a href="http://twitter.com/share?url=http://fumi.me/2011/01/29/lodjp/&amp;text=第1回 LinkedData勉強会&amp;via=fumi1&amp;related=DolcePixel"><img align="left" src="http://fumi.me/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="" /></a></div>
先日LinkedDataの勉強会を企画して行いました．今回はLinked Dataに興味があるけどどうやったらいいのかわからないという疑問に答えを見つけるために，プログラミング以外の方法でLinked Dataを作成する&#8230; <a href="http://fumi.me/2011/01/29/lodjp/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="twitterbutton" style="float: left; padding-right: 5px;"><a href="http://twitter.com/share?url=http://fumi.me/2011/01/29/lodjp/&amp;text=第1回 LinkedData勉強会&amp;via=fumi1&amp;related=DolcePixel"><img align="left" src="http://fumi.me/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="第1回 LinkedData勉強会"  title="第1回 LinkedData勉強会 image" /></a></div>
<!-- AdSense Now! V3.07 -->
<!-- Post[count: 2] -->
<div class="adsense adsense-leadin" style="float:right;margin: 12px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-3851768881924732";
/* 200x200 */
google_ad_slot = "9928212714";
google_ad_width = 200;
google_ad_height = 200;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><p>先日LinkedDataの勉強会を企画して行いました．今回はLinked Dataに興味があるけどどうやったらいいのかわからないという疑問に答えを見つけるために，プログラミング以外の方法でLinked Dataを作成するための支援ツールについて，有志に発表して頂きました．各発表資料は<a href="http://linkeddata.jp/2011/01/26/lodjp/">LinkedData.jpのページ</a>にまとめてあります．また，これを期にLinkedData.jp自体も少しずつ作り直しています．</p>
<p>個人の感想としては，Google Refineは今後データクリーニングをしたい人には必須のツールになるのではないかなと思いました．日本語がどの程度できるのかは未知なのですが，英語に関してはかなり良い精度でクリーニングできるようです．</p>
<p>これからは定期的に勉強会を開催していきたいと考えていますので，是非ご興味がある方はご参加ください．</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: '第1回 LinkedData勉強会',url: 'http://fumi.me/2011/01/29/lodjp/',contentID: 'post-2977',code: 'fumi',suggestTags: 'Event,LOD,SemanticWeb',providerName: 'Fumihiro Kato / 加藤 文彦',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-jp.png" class="evernoteSiteMemoryButton" title="第1回 LinkedData勉強会 image" alt="第1回 LinkedData勉強会" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>
	Tags: <a href="http://fumi.me/tag/event/" title="Event" rel="tag">Event</a>, <a href="http://fumi.me/tag/lod/" title="LOD" rel="tag">LOD</a>, <a href="http://fumi.me/tag/semanticweb/" title="SemanticWeb" rel="tag">SemanticWeb</a><br />
]]></content:encoded>
			<wfw:commentRss>http://fumi.me/2011/01/29/lodjp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://fumi.me/2011/01/29/lodjp/" />
	</item>
		<item>
		<title>Virtuoso+OntoWiki</title>
		<link>http://fumi.me/2010/07/07/virtuosoontowiki/</link>
		<comments>http://fumi.me/2010/07/07/virtuosoontowiki/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 11:47:49 +0000</pubDate>
		<dc:creator>fumi</dc:creator>
				<category><![CDATA[SemanticWeb]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[DB]]></category>
		<category><![CDATA[OntoWiki]]></category>
		<category><![CDATA[RDF]]></category>
		<category><![CDATA[SPARQL]]></category>
		<category><![CDATA[Virtuoso]]></category>

		<guid isPermaLink="false">http://fumi.me/?p=2951</guid>
		<description><![CDATA[
<div class="twitterbutton" style="float: left; padding-right: 5px;"><a href="http://twitter.com/share?url=http://fumi.me/2010/07/07/virtuosoontowiki/&amp;text=Virtuoso+OntoWiki&amp;via=fumi1&amp;related=DolcePixel"><img align="left" src="http://fumi.me/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="" /></a></div>
Twitterを見れば分かるとおり最近RDF Storeの調査をしているのですが、その過程でOntoWikiを使おうとして色々嵌っているので、ログを残しておきます。現在Ubuntu10.04での動作を確認しています。 V&#8230; <a href="http://fumi.me/2010/07/07/virtuosoontowiki/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="twitterbutton" style="float: left; padding-right: 5px;"><a href="http://twitter.com/share?url=http://fumi.me/2010/07/07/virtuosoontowiki/&amp;text=Virtuoso+OntoWiki&amp;via=fumi1&amp;related=DolcePixel"><img align="left" src="http://fumi.me/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="Virtuoso+OntoWiki"  title="Virtuoso+OntoWiki image" /></a></div>
<p>Twitterを見れば分かるとおり最近RDF Storeの調査をしているのですが、その過程でOntoWikiを使おうとして色々嵌っているので、ログを残しておきます。現在Ubuntu10.04での動作を確認しています。</p>
<h3>Virtuosoのインストール</h3>
<p><a href="http://virtuoso.openlinksw.com/">Open Link Virtuoso</a>は複数のデータ形式を統合して扱えるデータベースです。RDF Triple/Quad Storeとしても使え、SPARQLにも対応しています。<a href="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/">Open Source版</a>とClosed Source版があり、Closed版ではClusterやSnapshoなどの追加機能があります。ここではOpen Source版を使います。</p>
<p>まず<a href="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/">Virtuoso Open Source Edition</a>のインストールです。Ubuntuのrepositoryにあるのが6.1.0で、これだと最新のOntoWikiが不具合起こすので、<a href="http://packages.debian.org/squeeze/virtuoso-opensource<br />
">debian squeeze</a>から最新のソースパッケージ持ってきて再構築しました。</p>
<pre><kbd>
$ wget http://ftp.de.debian.org/debian/pool/main/v/virtuoso-opensource/virtuoso-opensource_6.1.1+dfsg1-1.dsc
$ wget http://ftp.de.debian.org/debian/pool/main/v/virtuoso-opensource/virtuoso-opensource_6.1.1+dfsg1.orig.tar.gz
$ wget http://ftp.de.debian.org/debian/pool/main/v/virtuoso-opensource/virtuoso-opensource_6.1.1+dfsg1-1.diff.gz
$ dpkg-source -x virtuoso-opensource_6.1.1+dfsg1-1.dsc
$ cd virtuoso-opensource-6.1.1
</kbd></pre>
<p>再構築に必要なパッケージをインストールします。</p>
<pre><kbd>$ aptitude build-dep virtuoso-opensource
$ aptitude install quilt fakeroot
</kbd></pre>
<p>変更点はbuild formatを変えるだけです。changelogとかもそのままでbuildします。</p>
<pre><kbd>$ echo "3.0 (quilt)" >debian/source/format
$ debuild -us -uc
</kbd></pre>
<p>ライブラリが足りなければ適宜インストールしてください。もし問題がなければ、上のディレクトリに*.debができているのでインストールします。インストール時にデータベースのパスワードを聞かれるので設定します。</p>
<pre><kbd>$ dpkg -i ../*.deb</kbd></pre>
<p>次のコマンドで問題なく起動できればインストール完了です。</p>
<pre><kbd>$ /etc/init.d/virtuoso start</kbd></pre>
<h3>ODBCの設定 (要確認)</h3>
<p><strong>NOTE: この設定は必要ないかもしれないので要確認</strong></p>
<p>まずodbcinstをインストールします。</p>
<pre><kbd>$ aptitude install odbcinst odbcinst1debian1</kbd></pre>
<p>その後、<code>/etc/odbcinst.ini,odbc.ini</code>を以下のように作成します。</p>
<pre><kbd>- /etc/odbcinst.ini
[virtuoso-odbc]
Driver  = /usr/lib/odbc/virtodbc.so

- /etc/odbc.ini
[ODBC Data Sources]
VDS  = Virtuoso

[VDS]
Driver  = virtuoso-odbc
Description  = Virtuoso Open-Source Edition
ServerName  = localhost:1111

[VOS]
Driver  = /usr/lib/odbc/virtodbc.so
Description  = Virtuoso OpenSource Edition
Address = localhost:1111
</kbd></pre>
<h3>OntoWiki</h3>
<p><a href="http://ontowiki.net/">OntoWIki</a>はRDF用の閲覧・編集環境です。CMSと言ったほうがいいかもしれません。</p>
<p>とりあえずphp5とapacheの基本的な設定をしておく必要があります。解説を書いている方がたくさんいるので、やり方はググってください。一点追加で必要なのが、php5-odbcのインストールです。</p>
<pre><kbd>$ sudo aptitude install php5-odbc</kbd></pre>
<p>php5とapacheをインストールしたら、<a href="http://code.google.com/p/ontowiki/wiki/InstallFromMercurial">InstallFromMercurial</a>に書かれている通りに、レポジトリから最新のソースをインストールします。</p>
<pre><kbd>$ cd /var/www
$ hg clone https://ontowiki.googlecode.com/hg/ owrep
$ cd owrep/ontowiki/src/libraries
$ ln -s ../../../erfurt/src/Erfurt .
$ ln -s ../../../RDFauthor .

$ wget http://framework.zend.com/releases/ZendFramework-1.9.4/ZendFramework-1.9.4-minimal.tar.gz
$ tar xvzf ZendFramework-1.9.4-minimal.tar.gz
$ mv ZendFramework-1.9.4-minimal/library/Zend .
$ rm -rf ZendFramework-1.9.4-minimal.tar.gz ZendFramework-1.9.4-minimal

$ cd /var/www/owrep/ontowiki/src
$ cp htaccess-dist .htaccess
$ cp config.ini-dist config.ini
</kbd></pre>
<p>次に<a href="http://code.google.com/p/ontowiki/wiki/UsingOntoWikiWithVirtuoso">UsingOntoWikiWithVirtuoso</a>を参考にconfig.iniの設定をします。</p>
<pre><kbd>[private]
store.backend = virtuoso
store.virtuoso.dsn = VOS
store.virtuoso.username = dba
store.virtuoso.password = dba
</kbd></pre>
<p>その後OntoWikiに必要なディレクトリ作成します。</p>
<pre><kbd>
$ mkdir cache log uploads
$ chown www-data:www-data cache log uploads
</kbd></pre>
<p>Apacheの設定をします。そのままトップに置くのなら<code>/etc/apache2/sites-enabled/000-default</code>のDocumentRootと該当Directoryを変更します。</p>
<pre><kbd>DocumentRoot /var/www/owrep/ontowiki/src
&lt;Directory /var/www/owrep/ontowiki/src&gt;
</kbd></pre>
<p>Apacheを再起動した後、http://localhostにアクセスしてください。問題なければOntoWikiが表示されます。ユーザ名 Admin パスワードなしでログインすると管理画面になります。</p>
<h3>Conference Model Demo</h3>
<p><a href="http://ontowiki.net/Projects/OntoWiki/FirstSteps">FirstStep</a>にConferenceデータのデモの作り方がかかれています。注意する必要があるのは、もしlocalhost以外で動かす場合、Google Maps API Keyの設定が必要です。<a href="http://code.google.com/intl/ja/apis/maps/signup.html">API Key取得ページ</a>で生成した文字列を<code>ontowiki/extensions/components/map/component.ini</code>に設定します。</p>
<pre><kbd>- ontowiki/extensions/components/map/component.ini
apikey.google = "生成した文字列"
</kbd></pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Virtuoso+OntoWiki',url: 'http://fumi.me/2010/07/07/virtuosoontowiki/',contentID: 'post-2951',code: 'fumi',suggestTags: 'DB,OntoWiki,RDF,SPARQL,Ubuntu,Virtuoso',providerName: 'Fumihiro Kato / 加藤 文彦',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-jp.png" class="evernoteSiteMemoryButton" title="Virtuoso+OntoWiki image" alt="Virtuoso+OntoWiki" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>
	Tags: <a href="http://fumi.me/tag/db/" title="DB" rel="tag">DB</a>, <a href="http://fumi.me/tag/ontowiki/" title="OntoWiki" rel="tag">OntoWiki</a>, <a href="http://fumi.me/tag/rdf/" title="RDF" rel="tag">RDF</a>, <a href="http://fumi.me/tag/sparql/" title="SPARQL" rel="tag">SPARQL</a>, <a href="http://fumi.me/tag/ubuntu/" title="Ubuntu" rel="tag">Ubuntu</a>, <a href="http://fumi.me/tag/virtuoso/" title="Virtuoso" rel="tag">Virtuoso</a><br />
]]></content:encoded>
			<wfw:commentRss>http://fumi.me/2010/07/07/virtuosoontowiki/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://fumi.me/2010/07/07/virtuosoontowiki/" />
	</item>
		<item>
		<title>セマンティックWebプログラミング</title>
		<link>http://fumi.me/2010/06/18/programming-the-semanticweb/</link>
		<comments>http://fumi.me/2010/06/18/programming-the-semanticweb/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 08:05:20 +0000</pubDate>
		<dc:creator>fumi</dc:creator>
				<category><![CDATA[Book]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[SemanticWeb]]></category>
		<category><![CDATA[LOD]]></category>

		<guid isPermaLink="false">http://fumi.me/?p=2948</guid>
		<description><![CDATA[
<div class="twitterbutton" style="float: left; padding-right: 5px;"><a href="http://twitter.com/share?url=http://fumi.me/2010/06/18/programming-the-semanticweb/&amp;text=セマンティックWebプログラミング&amp;via=fumi1&amp;related=DolcePixel"><img align="left" src="http://fumi.me/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="" /></a></div>
オライリーさんの&#8221;Programming the Semantic Web&#8221;を有志で監訳した本が6/26に出ます．サンプルコードは監訳者一同が結構書き直して動くようにしたので，試しながら読めます．&#8230; <a href="http://fumi.me/2010/06/18/programming-the-semanticweb/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="twitterbutton" style="float: left; padding-right: 5px;"><a href="http://twitter.com/share?url=http://fumi.me/2010/06/18/programming-the-semanticweb/&amp;text=セマンティックWebプログラミング&amp;via=fumi1&amp;related=DolcePixel"><img align="left" src="http://fumi.me/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="セマンティックWebプログラミング"  title="セマンティックWebプログラミング image" /></a></div>
<p>オライリーさんの&#8221;Programming the Semantic Web&#8221;を有志で監訳した本が6/26に出ます．サンプルコードは監訳者一同が結構書き直して動くようにしたので，試しながら読めます．言語はPythonなんですが，Linked Dataなど，現在Web上にあるデータをどうやって使うのかという話がメインなので，他の言語でも役立つはずです．よろしかったら是非．</p>
<div class="tmkm-amazon-view">
	<p><a href="http://www.amazon.co.jp/%E3%82%BB%E3%83%9E%E3%83%B3%E3%83%86%E3%82%A3%E3%83%83%E3%82%AFWeb-%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0-Toby-Segaran/dp/4873114527%3FSubscriptionId%3DAKIAIAILLLDE7T4Q5BMQ%26tag%3Dtorrydiary-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4873114527"><img src="http://ecx.images-amazon.com/images/I/51cO20vg4bL._SL160_.jpg" border="0" alt="セマンティックWebプログラミング"  title="セマンティックWebプログラミング image" /></a></p>
	<p><a href="http://www.amazon.co.jp/%E3%82%BB%E3%83%9E%E3%83%B3%E3%83%86%E3%82%A3%E3%83%83%E3%82%AFWeb-%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0-Toby-Segaran/dp/4873114527%3FSubscriptionId%3DAKIAIAILLLDE7T4Q5BMQ%26tag%3Dtorrydiary-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4873114527">セマンティックWeb プログラミング</a></p>
	<p><em>著者／訳者：</em>Toby Segaran Colin Evans Jamie Taylor </p>
	<p><em>出版社：</em>オライリージャパン( 2010-06-26 )</p>
	<p><em>定価：</em>￥ 3,360</p>
	<p><em>Amazon価格：</em>￥ 3,360</p>
	<p>大型本 ( 312 ページ )</p>
	<p>ISBN-10 : 4873114527</p>
	<p>ISBN-13 : 9784873114521</p>
<hr class="tmkm-amazon-clear" /></div>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'セマンティックWebプログラミング',url: 'http://fumi.me/2010/06/18/programming-the-semanticweb/',contentID: 'post-2948',code: 'fumi',suggestTags: 'Book,LOD,python,SemanticWeb',providerName: 'Fumihiro Kato / 加藤 文彦',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-jp.png" class="evernoteSiteMemoryButton" title="セマンティックWebプログラミング image" alt="セマンティックWebプログラミング" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>
	Tags: <a href="http://fumi.me/tag/book/" title="Book" rel="tag">Book</a>, <a href="http://fumi.me/tag/lod/" title="LOD" rel="tag">LOD</a>, <a href="http://fumi.me/tag/python/" title="python" rel="tag">python</a>, <a href="http://fumi.me/tag/semanticweb/" title="SemanticWeb" rel="tag">SemanticWeb</a><br />
]]></content:encoded>
			<wfw:commentRss>http://fumi.me/2010/06/18/programming-the-semanticweb/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://fumi.me/2010/06/18/programming-the-semanticweb/" />
	</item>
		<item>
		<title>Interop2010</title>
		<link>http://fumi.me/2010/06/16/interop2010/</link>
		<comments>http://fumi.me/2010/06/16/interop2010/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 01:35:03 +0000</pubDate>
		<dc:creator>fumi</dc:creator>
				<category><![CDATA[Event]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[SemanticWeb]]></category>
		<category><![CDATA[W3C]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Academic]]></category>
		<category><![CDATA[Library]]></category>
		<category><![CDATA[LinkedData]]></category>
		<category><![CDATA[LOD]]></category>

		<guid isPermaLink="false">http://fumi.me/?p=2945</guid>
		<description><![CDATA[
<div class="twitterbutton" style="float: left; padding-right: 5px;"><a href="http://twitter.com/share?url=http://fumi.me/2010/06/16/interop2010/&amp;text=Interop2010&amp;via=fumi1&amp;related=DolcePixel"><img align="left" src="http://fumi.me/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="" /></a></div>
しばらく慌ただしかったのでブログを書けずにいました．twitterでは報告済みなのですが，新しいプロジェクトを始めるために4月末で早々に前職を退職し，5月中旬から別の職場に転職しました．Interop2010のW3Cブー&#8230; <a href="http://fumi.me/2010/06/16/interop2010/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="twitterbutton" style="float: left; padding-right: 5px;"><a href="http://twitter.com/share?url=http://fumi.me/2010/06/16/interop2010/&amp;text=Interop2010&amp;via=fumi1&amp;related=DolcePixel"><img align="left" src="http://fumi.me/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="Interop2010"  title="Interop2010 image" /></a></div>
<p>しばらく慌ただしかったのでブログを書けずにいました．twitterでは報告済みなのですが，新しいプロジェクトを始めるために4月末で早々に前職を退職し，5月中旬から別の職場に転職しました．Interop2010のW3Cブースにて概要を話しましたので，紹介代わりにスライドを貼っておきます．</p>
<p>同時期にW3Cでも<a href="http://www.w3.org/2005/Incubator/lld/">Library Linked Data Incubator Group</a>が始まりました．1年時限付きのグループで，既存の事例集めや要求事項まとめなどが目標のようです．このプロジェクトからも取り敢えず数名参加しています．しかし，一度標準化の世界に関わるとどこ行っても関わることになっているような気がしてこの世界狭いなと．</p>
<div style="width:425px" id="__ss_4471068"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/fumihiro/web-4471068" title="学術資源のためのオープン・ ソーシャル・セマンティックWeb プラットホームプロジェクト">学術資源のためのオープン・ ソーシャル・セマンティックWeb プラットホームプロジェクト</a></strong><object id="__sse4471068" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=interop2010-100610235308-phpapp02&#038;stripped_title=web-4471068" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed name="__sse4471068" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=interop2010-100610235308-phpapp02&#038;stripped_title=web-4471068" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/fumihiro">Fumihiro Kato</a>.</div>
</div>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Interop2010',url: 'http://fumi.me/2010/06/16/interop2010/',contentID: 'post-2945',code: 'fumi',suggestTags: 'Academic,Library,LinkedData,LOD',providerName: 'Fumihiro Kato / 加藤 文彦',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-jp.png" class="evernoteSiteMemoryButton" title="Interop2010 image" alt="Interop2010" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>
	Tags: <a href="http://fumi.me/tag/academic/" title="Academic" rel="tag">Academic</a>, <a href="http://fumi.me/tag/library/" title="Library" rel="tag">Library</a>, <a href="http://fumi.me/tag/linkeddata/" title="LinkedData" rel="tag">LinkedData</a>, <a href="http://fumi.me/tag/lod/" title="LOD" rel="tag">LOD</a><br />
]]></content:encoded>
			<wfw:commentRss>http://fumi.me/2010/06/16/interop2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://fumi.me/2010/06/16/interop2010/" />
	</item>
		<item>
		<title>LinkedData.jp &#8211; Google Groups</title>
		<link>http://fumi.me/2010/04/25/linkeddata-jp/</link>
		<comments>http://fumi.me/2010/04/25/linkeddata-jp/#comments</comments>
		<pubDate>Sun, 25 Apr 2010 14:34:38 +0000</pubDate>
		<dc:creator>fumi</dc:creator>
				<category><![CDATA[Event]]></category>
		<category><![CDATA[SemanticWeb]]></category>
		<category><![CDATA[LOD]]></category>

		<guid isPermaLink="false">http://fumi.me/?p=2888</guid>
		<description><![CDATA[
<div class="twitterbutton" style="float: left; padding-right: 5px;"><a href="http://twitter.com/share?url=http://fumi.me/2010/04/25/linkeddata-jp/&amp;text=LinkedData.jp &#8211; Google Groups&amp;via=fumi1&amp;related=DolcePixel"><img align="left" src="http://fumi.me/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="" /></a></div>
今日有志でSemweb&#38;LOD勉強会を行いました．そこでとりあえず日本語で議論できる場所が必要ということになったため，Google GroupsにLinkedData.jpというグループを作りました．Linked&#8230; <a href="http://fumi.me/2010/04/25/linkeddata-jp/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="twitterbutton" style="float: left; padding-right: 5px;"><a href="http://twitter.com/share?url=http://fumi.me/2010/04/25/linkeddata-jp/&amp;text=LinkedData.jp &#8211; Google Groups&amp;via=fumi1&amp;related=DolcePixel"><img align="left" src="http://fumi.me/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="LinkedData.jp   Google Groups"  title="LinkedData.jp   Google Groups image" /></a></div>
<p>今日有志でSemweb&amp;LOD勉強会を行いました．そこでとりあえず日本語で議論できる場所が必要ということになったため，Google Groupsに<a href="http://groups.google.com/group/linkeddatajp?hl=en">LinkedData.jp</a>というグループを作りました．LinkedDataやSemantic Webについて議論したり開発したりする場になれば良いなと思っています．ご興味のある方は是非ご参加下さい．</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'LinkedData.jp &amp;#8211; Google Groups',url: 'http://fumi.me/2010/04/25/linkeddata-jp/',contentID: 'post-2888',code: 'fumi',suggestTags: 'Event,LOD,SemanticWeb',providerName: 'Fumihiro Kato / 加藤 文彦',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-jp.png" class="evernoteSiteMemoryButton" title="LinkedData.jp   Google Groups image" alt="LinkedData.jp   Google Groups" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>
	Tags: <a href="http://fumi.me/tag/event/" title="Event" rel="tag">Event</a>, <a href="http://fumi.me/tag/lod/" title="LOD" rel="tag">LOD</a>, <a href="http://fumi.me/tag/semanticweb/" title="SemanticWeb" rel="tag">SemanticWeb</a><br />
]]></content:encoded>
			<wfw:commentRss>http://fumi.me/2010/04/25/linkeddata-jp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://fumi.me/2010/04/25/linkeddata-jp/" />
	</item>
		<item>
		<title>RDF.rb</title>
		<link>http://fumi.me/2010/04/22/rdf-rb/</link>
		<comments>http://fumi.me/2010/04/22/rdf-rb/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 12:58:10 +0000</pubDate>
		<dc:creator>fumi</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[SemanticWeb]]></category>
		<category><![CDATA[LinkedData]]></category>
		<category><![CDATA[RDF]]></category>

		<guid isPermaLink="false">http://fumi.me/?p=2876</guid>
		<description><![CDATA[
<div class="twitterbutton" style="float: left; padding-right: 5px;"><a href="http://twitter.com/share?url=http://fumi.me/2010/04/22/rdf-rb/&amp;text=RDF.rb&amp;via=fumi1&amp;related=DolcePixel"><img align="left" src="http://fumi.me/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="" /></a></div>
RubyからRDFを使うライブラリをいくつか紹介してきましたが，最近急ピッチで開発されているRDF.rbが本命になりそうです．まだSPARQLは使えず，基本的なことしかできませんが，やっとどれを使ったらいいのかよくわから&#8230; <a href="http://fumi.me/2010/04/22/rdf-rb/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="twitterbutton" style="float: left; padding-right: 5px;"><a href="http://twitter.com/share?url=http://fumi.me/2010/04/22/rdf-rb/&amp;text=RDF.rb&amp;via=fumi1&amp;related=DolcePixel"><img align="left" src="http://fumi.me/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="RDF.rb"  title="RDF.rb image" /></a></div>
<p>RubyからRDFを使うライブラリをいくつか紹介してきましたが，最近急ピッチで開発されているRDF.rbが本命になりそうです．まだSPARQLは使えず，基本的なことしかできませんが，やっとどれを使ったらいいのかよくわからないという状況が変わりそうです．</p>
<p>ちゃんとした紹介を日本語で書こうと思っていたら，作者達が良くできたチュートリアルを書いてくれたので，それを翻訳することにしました．とりあえずここに置いておくことにします．</p>
<h3>RubyによるRDFデータの解析と永続化 (Parsing and Serializing RDF Data with Ruby)</h3>
<p><a href="http://blog.datagraph.org/2010/04/parsing-rdf-with-ruby">original text</a> 2010/04/21 by Arto</p>
<p>このチュートリアルでは、<a href="http://ruby-lang.org/">Ruby</a>用のライブラリ<a href="http://blog.datagraph.org/2010/03/rdf-for-ruby">RDF.rb</a>を使った<a href="http://www.w3.org/RDF/">RDF</a>データの解析と永続化の方法を学びます。RDFを基礎とした<a href="http://linkeddata.org/">Linked Data</a>の永続化形式には色々ありますが、RDF.rbでは多くの形式が使えます。</p>
<p>このチュートリアルに沿ってコード例を試すには、Rubyと<a href="http://rubygems.org/">Rubygems</a>だけが必要です。最近のRuby 1.8.xや1.9.x、またはJRuby1.4.0以上なら動きます。</p>
<h4>サポートしているRDF形式</h4>
<p>現在RDF.rbで解析や永続化できるRDF形式は以下の通りです。</p>
<pre><code>
形式        | 実装                  | RubyGems gem
------------|-----------------------|-------------
N-Triples   | RDF::NTriples         | rdf
Turtle      | RDF::Raptor::Turtle   | rdf-raptor
RDF/XML     | RDF::Raptor::RDFXML   | rdf-raptor
RDF/JSON    | RDF::JSON             | rdf-json
TriX        | RDF::TriX             | rdf-trix
</code></pre>
<p>RDF.rb自体は比較的軽量なgemで、<a href="http://blog.datagraph.org/2010/03/grepping-ntriples">N-Triples</a>形式のみビルトインでサポートしています。その他の形式については<a href="http://rdf.rubyforge.org/raptor/"><code>RDF::Raptor</code></a>, <a href="http://rdf.rubyforge.org/json/"><code>RDF::JSON</code></a>, <a href="http://rdf.rubyforge.org/trix/"><code>RDF::TriX</code></a>のようなプラグインとして、個別のgemにパッケージ化されています。このアプローチによって、コアライブラリを他から切り離して、RDF.rb自体がいかなるXMLやJSONパーサへの依存しないようにしています。</p>
<p>これら全ての形式サポートを一度に簡単にインストールできます。</p>
<pre><code>$ sudo gem install rdf rdf-raptor rdf-json rdf-trix
Successfully installed rdf-0.1.9
Successfully installed rdf-raptor-0.2.1
Successfully installed rdf-json-0.1.0
Successfully installed rdf-trix-0.0.3
4 gems installed
</code></pre>
<p>注: <code>RDF::Raptor</code> gemは<a href="http:///librdf.org/raptor/">Raptor RDF Parser</a> ライブラリとそのコマンドラインツールがシステムにインストールされている必要があります。MacやLinux, BSDディストリビューションのための簡単なRaptorのインストール方法は以下の通りです。</p>
<pre><code>$ sudo port install raptor             # Mac OS X with MacPorts
$ sudo fink install raptor-bin         # Mac OS X with Fink
$ sudo aptitude install raptor-utils   # Ubuntu / Debian
$ sudo yum install raptor              # Fedora / CentOS / RHEL
$ sudo zypper install raptor           # openSUSE
$ sudo emerge raptor                   # Gentoo Linux
$ sudo pkg_add -r raptor               # FreeBSD
$ sudo pkg_add raptor                  # OpenBSD / NetBSD
</code></pre>
<p>Raptorのインストールや使用方法についての更なる情報は、我々の以前のチュートリアル <a href="http://blog.datagraph.org/2010/04/transmuting-ntriples">RDF for Intrepid Unix Hackers: Trasmuting N-Triples</a>を見てください。</p>
<h4>RDFデータの読み込み</h4>
<p>もしあなたが急いでいて、すぐにRDFデータの正しい読み込み方を知りたいのなら、あなたが知る必要があることは本当に以下だけです。</p>
<pre><code>require 'rdf'
require 'rdf/ntriples'

graph = RDF::Graph.load("http://datagraph.org/jhacker/foaf.nt")
</code></pre>
<p>この例では、まずはじめにRDF.rbとN-Triples形式のサポートを読み込んでいます。その後、<a href="http://rdf.rubyforge.org/RDF/Graph.html"><code>RDF::Graph</code></a>クラスの便利なメソッドを使って、RDFデータを一度に直接ウェブURLから取得して解析します。(loadメソッドはファイル名かURLを受け付けます。)</p>
<p>全てのRDF.rbパーサプラグインは、処理可能なMIMEタイプとファイル拡張子を宣言します。それが、上の例でRDF.rbが、与えられたURLにあるfoaf.ntファイルを読むためのN-Triplesパーサのインスタンスの作り方を知っている理由です。</p>
<p>同じ方法で、RDF.rbは他のいかなるRDFファイル形式を自動検知します。そのためには、以下のどれかを使って形式のサポートを読み込めば良いです。</p>
<pre><code>
require 'rdf/ntriples' # Support for N-Triples (.nt)
require 'rdf/raptor'   # Support for RDF/XML (.rdf) and Turtle (.ttl)
require 'rdf/json'     # Support for RDF/JSON (.json)
require 'rdf/trix'     # Support for TriX (.xml)
</code></pre>
<p>注: もし複数の名前付きグラフを含むRDFファイル(TriXのように名前付きグラフをサポートする永続化形式)を読む必要があるなら、おそらくRDF::Graphの代わりに<a href="http://rdf.rubyforge.org/RDF/Repository.html">RDF::Repository</a>を使いたいでしょう。</p>
<pre><code>
repository = RDF::Repository.load("http://datagraph.org/jhacker/foaf.nt")
</code></pre>
<p>この2つの違いは、<code>RDF::Repository</code>インスタンス内のRDF文が、オプションとしてcontextを含められることです(すなわち4つ組(quad)になれます)。<code>RDF::Graph</code>インスタンスのRDF文は常に同じcontextとなります(すなわちこれらは3つ組(triple)です)。言い換えると、レポジトリは一つ以上のグラフを含み、以下のようにアクセスできます。</p>
<pre><code>repository.each_graph do |graph|
  puts graph.inspect
end
</code></pre>
<h4>RDF形式の内部処理</h4>
<p>RDF.rbの解析や永続化APIは以下の3つの基底クラスを基にしています。</p>
<ul>
<li><a href="http://rdf.rubyforge.org/RDF/Format.html">RDF::Format</a>は特定のRDF永続化形式を記述するために使われます。</li>
<li><a href="http://rdf.rubyforge.org/RDF/Reader.html">RDF::Reader</a>RDFパーサ実装用の基底クラスです。</li>
<li><a href="http://rdf.rubyforge.org/RDF/Writer.html">RDF::Writer</a>RDF永続化実装用の基底クラスです。</li>
</ul>
<p>もしあなたが解析や永続化をしたいファイル形式について何か知っているなら、形式指定用のクラスを以下の何れかの方法で取得できます。</p>
<pre><code>require 'rdf/raptor'

RDF::Format.for(:rdfxml)       #=> RDF::Raptor::RDFXML::Format
RDF::Format.for("input.rdf")
RDF::Format.for(:file_name      => "input.rdf")
RDF::Format.for(:file_extension => "rdf")
RDF::Format.for(:content_type   => "application/rdf+xml")
</code></pre>
<p>一度そのような形式指定用のクラスを持てば、そこから解析/永続化実装を取得可能です。</p>
<pre><code>format = RDF::Format.for("input.nt")   #=> RDF::NTriples::Format
reader = format.reader                 #=> RDF::NTriples::Reader
writer = format.writer                 #=> RDF::NTriples::Writer
</code></pre>
<p>また、RDF::ReaderとRDF::Writerにも、直接対応するファクトリメソッドがあります。</p>
<pre><code>reader = RDF::Reader.for("input.nt")   #=> RDF::NTriples::Reader
writer = RDF::Writer.for("output.nt")  #=> RDF::NTriples::Writer
</code></pre>
<p>以上が、URLやファイル名をRDF::Graph.loadに渡したときに、RDF.rbが正しい解析実装を得るために内部で依存するものです。もちろん、永続化形式を自動検出して、解析や永続化用の適切な実装クラスに委譲する必要がある、他のいかなるメソッドも同様です。</p>
<h4>RDFデータの解析</h4>
<p>もし、より明示的にRDFデータの解析、例えばデータセットをメモリに読み込めないので文毎に処理したい、ということをする必要があるのなら、<a href="http://rdf.rubyforge.org/RDF/Reader.html"><code>RDF::Reader</code></a>を直接使う必要があります。</p>
<h5>ファイルからRDF文を解析</h5>
<p>RDFパーサ実装は一般的に<a href="http://rdf.rubyforge.org/RDF/Enumerable.html"><code>RDF::Enumerable</code></a>インタフェースのストリーミング互換なサブセットをサポートします。これは<code>#each_statement</code>メソッドを基にしています。以下はRDFファイルを文毎に列挙しながら読み込む方法です。</p>
<pre><code>require 'rdf/raptor'

RDF::Reader.open("foaf.rdf") do |reader|
  reader.each_statement do |statement|
    puts statement.inspect
  end
end
</code></pre>
<p><code>RDF::Reader.open</code>をRubyブロックと一緒に使うことで、入力ファイルが処理後に自動的に閉じられることが保障されます。</p>
<h5>URLからRDF文を解析</h5>
<p>前の通り、ファイル名を使えていた場所全てで<code>http://</code>や<code>https://</code>のURLを使えます。</p>
<pre><code>require 'rdf/json'

RDF::Reader.open("http://datagraph.org/jhacker/foaf.json") do |reader|
  reader.each_statement do |statement|
    puts statement.inspect
  end
end
</code></pre>
<h5>文字列からRDF文を解析</h5>
<p>時々、すでにメモリバッファ上のどこかに永続化されたRDFコンテンツを持っているときがあります。例えばデータベースから取得した場合です。そのような場合、前に示したパーサ実装を取得して、その後<code>RDF::Reader.new</code>を直接使います。</p>
<pre><code>require 'rdf/ntriples'

input = open('http://datagraph.org/jhacker/foaf.nt').read

RDF::Reader.for(:ntriples).new(input) do |reader|
  reader.each_statement do |statement|
    puts statement.inspect
  end
end
</code></pre>
<p><code>RDF::Reader</code>コンストラクタはダックタイピングを使用しているので、<code>#readline</code>メソッドに応答するいかなる入力(例えば<code>IO</code>や<code>StringIO</code>オブジェクト)を受け付けます。もし入力の引数が何も与えられないときは、入力データはデフォルトで標準入力から読み込まれます。</p>
<h4>RDFデータの永続化</h4>
<p>RDFデータの永続化は解析とほとんど同様です。名前付きの出力ファイルに永続化されるとき、与えられたファイル拡張子によって正しい永続化実装がファイル拡張子によって自動検出されます。</p>
<h5>出力ファイルにRDF文を永続化する</h5>
<p>RDF永続化実装は一般的に<a href="http://rdf.rubyforge.org/RDF/Mutable.html"><code>RDF::Mutable</code></a>インタフェースのサブセットであり、追加だけ可能です。主に<code>#insert</code>メソッドとそのエイリアス<code>#&lt;&lt;</code>が対応します。以下がRDFファイルに文毎に出力する方法です。</p>
<pre><code>require 'rdf/ntriples'
require 'rdf/raptor'

data = RDF::Graph.load("http://datagraph.org/jhacker/foaf.nt")

RDF::Writer.open("output.rdf") do |writer|
  data.each_statement do |statement|
    writer << statement
  end
end
</code></pre>
<p>またですが、<code>RDF::Writer.open</code>をRubyブロックと一緒に使うことで、処理後に出力ファイルが自動的にフラッシュされ閉じられることが保障されています。</p>
<h5>RDF文を文字列結果に永続化</h5>
<p>ある共通のユースケースは、文字列バッファにRDFグラフを永続化することです。例えば<a href="http://www.rubyonrails.org/">Rails</a>アプリケーションからRDFデータを供給するときです。<code>RDF::Writer</code>には便利な<code>buffer</code>クラスメソッドがあり、<code>StringIO</code>に出力を溜め込んで最後に文字列として返してくれます。</p>
<pre><code>require 'rdf/ntriples'

output = RDF::Writer.for(:ntriples).buffer do |writer|
  subject = RDF::Node.new
  writer << [subject, RDF.type, RDF::FOAF.Person]
  writer << [subject, RDF::FOAF.name, "J. Random Hacker"]
  writer << [subject, RDF::FOAF.mbox, RDF::URI("mailto:jhacker@example.org")]
  writer << [subject, RDF::FOAF.nick, "jhacker"]
end
</code></pre>
<h5>永続化出力をカスタマイズ</h5>
<p>もし特定の永続化実装が名前空間接頭辞宣言や基底URIのようなオプションをサポートしているなら、これらのオプションを<code>RDF::Writer.open</code>や<code>RDF::Writer.new</code>にキーワード引数として与えることで指定できます。</p>
<pre><code>RDF::Writer.open("output.ttl", :base_uri => "http://rdf.rubyforge.org/")
RDF::Writer.for(:rdfxml).new($stdout, :base_uri => "http://rdf.rubyforge.org/")
</code></pre>
<h4>サポートチャンネル</h4>
<p>皆さん、今はこれで終わりです。このチュートリル以上のAPIについての情報は、RDF.rb <a href="http://rdf.rubyforge.org/">API文書</a>を参照してください。何か質問があれば、<a href="http://swig.xmlhack.com/">#swig</a>か <a href="http://lists.w3.org/Archives/Public/public-rdf-ruby/">public-rdf-ruby@w3.org</a>メーリングリストで遠慮なく聞いて下さい。</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'RDF.rb',url: 'http://fumi.me/2010/04/22/rdf-rb/',contentID: 'post-2876',code: 'fumi',suggestTags: 'LinkedData,Programming,RDF,Ruby,SemanticWeb',providerName: 'Fumihiro Kato / 加藤 文彦',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-jp.png" class="evernoteSiteMemoryButton" title="RDF.rb image" alt="RDF.rb" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>
	Tags: <a href="http://fumi.me/tag/linkeddata/" title="LinkedData" rel="tag">LinkedData</a>, <a href="http://fumi.me/tag/programming/" title="Programming" rel="tag">Programming</a>, <a href="http://fumi.me/tag/rdf/" title="RDF" rel="tag">RDF</a>, <a href="http://fumi.me/tag/ruby/" title="Ruby" rel="tag">Ruby</a>, <a href="http://fumi.me/tag/semanticweb/" title="SemanticWeb" rel="tag">SemanticWeb</a><br />
]]></content:encoded>
			<wfw:commentRss>http://fumi.me/2010/04/22/rdf-rb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://fumi.me/2010/04/22/rdf-rb/" />
	</item>
		<item>
		<title>RdfContext 0.5.0</title>
		<link>http://fumi.me/2010/02/23/rdfcontext-0-5-0/</link>
		<comments>http://fumi.me/2010/02/23/rdfcontext-0-5-0/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 14:15:22 +0000</pubDate>
		<dc:creator>fumi</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[SemanticWeb]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[RDF]]></category>

		<guid isPermaLink="false">http://fumi.me/?p=2866</guid>
		<description><![CDATA[
<div class="twitterbutton" style="float: left; padding-right: 5px;"><a href="http://twitter.com/share?url=http://fumi.me/2010/02/23/rdfcontext-0-5-0/&amp;text=RdfContext 0.5.0&amp;via=fumi1&amp;related=DolcePixel"><img align="left" src="http://fumi.me/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="" /></a></div>
Greggが早急に動くようにしてくれました．すでに入れている人はgem update で0.5.0にできます．とりあえずRuby1.8.6-1.9.1なら動くようになったようです．1.8と1.9では文字の扱いが大分違うの&#8230; <a href="http://fumi.me/2010/02/23/rdfcontext-0-5-0/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="twitterbutton" style="float: left; padding-right: 5px;"><a href="http://twitter.com/share?url=http://fumi.me/2010/02/23/rdfcontext-0-5-0/&amp;text=RdfContext 0.5.0&amp;via=fumi1&amp;related=DolcePixel"><img align="left" src="http://fumi.me/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="RdfContext 0.5.0"  title="RdfContext 0.5.0 image" /></a></div>
<p>Greggが早急に動くようにしてくれました．すでに入れている人はgem update で0.5.0にできます．とりあえずRuby1.8.6-1.9.1なら動くようになったようです．1.8と1.9では文字の扱いが大分違うので色々な問題がありそうですね．また，TurtleなどのTestSuiteもN3 Parserが通るようになってみたいです．</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'RdfContext 0.5.0',url: 'http://fumi.me/2010/02/23/rdfcontext-0-5-0/',contentID: 'post-2866',code: 'fumi',suggestTags: 'RDF,Ruby,SemanticWeb',providerName: 'Fumihiro Kato / 加藤 文彦',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-jp.png" class="evernoteSiteMemoryButton" title="RdfContext 0.5.0 image" alt="RdfContext 0.5.0" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>
	Tags: <a href="http://fumi.me/tag/rdf/" title="RDF" rel="tag">RDF</a>, <a href="http://fumi.me/tag/ruby/" title="Ruby" rel="tag">Ruby</a>, <a href="http://fumi.me/tag/semanticweb/" title="SemanticWeb" rel="tag">SemanticWeb</a><br />
]]></content:encoded>
			<wfw:commentRss>http://fumi.me/2010/02/23/rdfcontext-0-5-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://fumi.me/2010/02/23/rdfcontext-0-5-0/" />
	</item>
		<item>
		<title>RubyRDF</title>
		<link>http://fumi.me/2010/02/23/rubyrdf/</link>
		<comments>http://fumi.me/2010/02/23/rubyrdf/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 16:38:03 +0000</pubDate>
		<dc:creator>fumi</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[SemanticWeb]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[RDF]]></category>
		<category><![CDATA[Sesami]]></category>

		<guid isPermaLink="false">http://fumi.me/?p=2864</guid>
		<description><![CDATA[
<div class="twitterbutton" style="float: left; padding-right: 5px;"><a href="http://twitter.com/share?url=http://fumi.me/2010/02/23/rubyrdf/&amp;text=RubyRDF&amp;via=fumi1&amp;related=DolcePixel"><img align="left" src="http://fumi.me/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="" /></a></div>
次はRubyRDFです．特徴は以下の通りです． Store: Memory, Sesami Query: 独自の構文 特定のフォーマットの入出力には対応しておらず，メモリ上(またはSesami)でグラフを作り，それに対し&#8230; <a href="http://fumi.me/2010/02/23/rubyrdf/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="twitterbutton" style="float: left; padding-right: 5px;"><a href="http://twitter.com/share?url=http://fumi.me/2010/02/23/rubyrdf/&amp;text=RubyRDF&amp;via=fumi1&amp;related=DolcePixel"><img align="left" src="http://fumi.me/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="RubyRDF"  title="RubyRDF image" /></a></div>
<p>次は<a href="http://rubyrdf.rubyforge.org/">RubyRDF</a>です．特徴は以下の通りです．</p>
<ul>
<li>Store: Memory, Sesami</li>
<li>Query: 独自の構文</li>
</ul>
<p>特定のフォーマットの入出力には対応しておらず，メモリ上(またはSesami)でグラフを作り，それに対して独自のクエリを投げられるだけのようです．また，残念ながら開発が止まっており，かつRuby1.8.xでしか動きません．Ruby1.9.1では駄目でした．メリットが何もないので少し試しただけで止めました．</p>
<h3>使い方</h3>
<p>gemから入れます．</p>
<pre><kbd>
$ gem install rubyrdf
</kbd></pre>
<p>とりあえず試すには以下のコード(ほぼサンプルのまま)を入れれば良いです．</p>
<pre><code>
#!/usr/bin/ruby

require 'rubygems'
require 'rubyrdf'

RDF::Namespace.register(:dc, "http://purl.org/dc/elements/1.1/")
g = RDF::Graph::Memory.new
g.add(RDF::UriNode.new("http://paul.stadig.name/"), DC::author,
         g.new_blank_node("test"))

q = RDF::Query.new
q.select(:x, :y).where(:x, DC::author, :y)
result = g.execute(q)
result.bindings.each do |b|
  puts "x = #{b[:x]}"
  puts "y = #{b[:y]}"
end
</code></pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'RubyRDF',url: 'http://fumi.me/2010/02/23/rubyrdf/',contentID: 'post-2864',code: 'fumi',suggestTags: 'Programming,RDF,Ruby,SemanticWeb,Sesami',providerName: 'Fumihiro Kato / 加藤 文彦',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-jp.png" class="evernoteSiteMemoryButton" title="RubyRDF image" alt="RubyRDF" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>
	Tags: <a href="http://fumi.me/tag/programming/" title="Programming" rel="tag">Programming</a>, <a href="http://fumi.me/tag/rdf/" title="RDF" rel="tag">RDF</a>, <a href="http://fumi.me/tag/ruby/" title="Ruby" rel="tag">Ruby</a>, <a href="http://fumi.me/tag/semanticweb/" title="SemanticWeb" rel="tag">SemanticWeb</a>, <a href="http://fumi.me/tag/sesami/" title="Sesami" rel="tag">Sesami</a><br />
]]></content:encoded>
			<wfw:commentRss>http://fumi.me/2010/02/23/rubyrdf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://fumi.me/2010/02/23/rubyrdf/" />
	</item>
		<item>
		<title>RdfContext</title>
		<link>http://fumi.me/2010/02/23/rdfcontext/</link>
		<comments>http://fumi.me/2010/02/23/rdfcontext/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 15:36:10 +0000</pubDate>
		<dc:creator>fumi</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[SemanticWeb]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Library]]></category>
		<category><![CDATA[RDF]]></category>
		<category><![CDATA[RDFa]]></category>

		<guid isPermaLink="false">http://fumi.me/?p=2853</guid>
		<description><![CDATA[
<div class="twitterbutton" style="float: left; padding-right: 5px;"><a href="http://twitter.com/share?url=http://fumi.me/2010/02/23/rdfcontext/&amp;text=RdfContext&amp;via=fumi1&amp;related=DolcePixel"><img align="left" src="http://fumi.me/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="" /></a></div>
自分用メモとして，言語毎にRDFを扱えるライブラリのまとめをしていきたいと思っています．とりあえずまずはRubyから．RubyはRDFライブラリの対応具合がばらばらで，これといったものがありませんでした．一番人気がある方&#8230; <a href="http://fumi.me/2010/02/23/rdfcontext/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="twitterbutton" style="float: left; padding-right: 5px;"><a href="http://twitter.com/share?url=http://fumi.me/2010/02/23/rdfcontext/&amp;text=RdfContext&amp;via=fumi1&amp;related=DolcePixel"><img align="left" src="http://fumi.me/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="RdfContext"  title="RdfContext image" /></a></div>
<p>自分用メモとして，言語毎にRDFを扱えるライブラリのまとめをしていきたいと思っています．とりあえずまずはRubyから．RubyはRDFライブラリの対応具合がばらばらで，これといったものがありませんでした．一番人気がある方法がJRuby経由で<a href="http://jena.sourceforge.net/">Jena</a>を使うことです．私はCライブラリである<a href="http://librdf.org/">Redland</a>のRubyバインディングをたまに使っていました．しかしここ最近，Pure Rubyなライブラリが出てきているので，調査しています．</p>
<p>まず今回は<a href="http://github.com/gkellogg/rdf_context">RdfContext</a>です．<a href="http://github.com/tommorris/reddy">Reddy</a>がベースとなっています．主な機能は以下の通り．</p>
<ul>
<li>Parser: RDF/XML, RDFa, N3</li>
<li>Store: List(Array), Memory, SQLite3</li>
<li>Serialization: RDF/XML, N-Triples</li>
</ul>
<p>まだRDFの入出力しか対応しておらず，SPARQLなどの機能はTodoとなっています．また，非ASCII文字は全部unicode escapeされます．Ruby1.9.1で動かなかったので，とりあえず動くようにする<a href="http://gkellogg.lighthouseapp.com/projects/43717/tickets/1-patches-for-ruby-19">Patchを送った</a>のですが，作者のGreggが今色々と対応中で，近い内にversion0.5を出したいとのことなので，しばらく待とうと思います．</p>
<h3>使い方</h3>
<p>インストールはgemでできます．Ruby 1.8.7なら動くはずです．Ruby1.9以上で使う場合は上記のPatchをインストール後に当てればとりあえず使えます．</p>
<pre><kbd>
$ gem install rdf_context
</kbd></pre>
<p>RDFファイルを読み込んでN-Triplesで出力するコードは以下のようになります．p.parseの2つ目の引数で基点となるURIを与える必要があります．与えなかった場合は適当なbnodeになるようです．</p>
<pre><code>
#!/usr/bin/ruby
require 'rubygems'
require 'rdf_context'
require 'open-uri'

include RdfContext
p = Parser.new
str = open("http://fumi.me/foaf.rdf").read
g = p.parse(str, "http://fumi.me/foaf.rdf", :type => :rdfxml)

#puts g.to_rdfxml
puts g.to_ntriples
</code></pre>
<p>また，GraphにTripleを追加いきたいときは，ストレージ先を指定したGraphを先に作れば良いです．引数storeについては，今のところListは動くのですが，まだSQLite3で動かせていません．引数identifierは，NamedGraph用のようです．下記のコードで，二つのRDF/XMLの内容をまとめた一つのRDF/XMLを出力することができます．</p>
<pre><code>
include RdfContext

## 動かない
#g = Graph.new(:store => SQLite3Store.new(:path => "store.db"),
            :identifier => URIRef.new("http://fumi.me")) 

g = Graph.new(:store => :list_store,
            :identifier => URIRef.new("http://fumi.me"))
g.parse(open("http://fumi.me/foaf.rdf").read,
            "http://fumi.me/foaf.rdf", :type => :rdfxml)
g.parse(open("http://semantictweet.com/fumi1").read,
            "http://semantictweet.com/fumi1", :type => :rdfxml)
puts g.to_rdfxml
</code></pre>
<p>全体的にまだまだこれからという印象です．</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'RdfContext',url: 'http://fumi.me/2010/02/23/rdfcontext/',contentID: 'post-2853',code: 'fumi',suggestTags: 'Library,RDF,RDFa,Ruby,SemanticWeb',providerName: 'Fumihiro Kato / 加藤 文彦',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-jp.png" class="evernoteSiteMemoryButton" title="RdfContext image" alt="RdfContext" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>
	Tags: <a href="http://fumi.me/tag/library/" title="Library" rel="tag">Library</a>, <a href="http://fumi.me/tag/rdf/" title="RDF" rel="tag">RDF</a>, <a href="http://fumi.me/tag/rdfa/" title="RDFa" rel="tag">RDFa</a>, <a href="http://fumi.me/tag/ruby/" title="Ruby" rel="tag">Ruby</a>, <a href="http://fumi.me/tag/semanticweb/" title="SemanticWeb" rel="tag">SemanticWeb</a><br />
]]></content:encoded>
			<wfw:commentRss>http://fumi.me/2010/02/23/rdfcontext/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://fumi.me/2010/02/23/rdfcontext/" />
	</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
