MacOS X 環境に Virtuoso をインストールするために、brew ポートを使用しました。
brew install virtuoso
そうすることで、他の unixodbc セットアップで上書きできないいくつかの ODBC/iODBC ドライバーが自動的にインストールされました。特に、そのようなライブラリをリンクしようとすると:
$ brew link unixodbc
Linking /usr/local/Cellar/unixodbc/2.3.4...
Error: Could not symlink bin/isql
Target /usr/local/bin/isql
is a symlink belonging to virtuoso. You can unlink it:
brew unlink virtuoso
To force the link and overwrite all conflicting files:
brew link --overwrite unixodbc
To list all files that would be deleted:
brew link --overwrite --dry-run unixodbc
ところで、このバージョンのリンクを解除したくありません。そこで、Redland をゼロからコンパイルして、GitHub からダウンロードしようとしました。具体的には、次の 2 つの構成を使用しました。
env PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --with-virtuoso --with-odbc=/usr/local/Cellar/virtuoso/7.2.4.2
env PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --with-virtuoso --with-iodbc=/usr/local/Cellar/virtuoso/7.2.4.2
プロジェクトに手動で追加rdf_hash_internal.h
した後rdf_heuristics.h
、すべてがスムーズに進み、すべてがコンパイルおよびリンクされます。私の C++ アプリでは、次のコードを使用してデータベースにアクセスしようとしています。
world = librdf_new_world();
librdf_world_open(world);
storage = librdf_new_storage(world,"virtuoso",graphName.c_str(),"dsn='Local Virtuoso',user='dba',password='dba'");
model = librdf_new_model(world,storage,NULL);
context_node = librdf_new_node_from_uri_string(world,(const unsigned char*)defaultContext.c_str());
/* librdf_model_transaction_commit(this->super->model) */
librdf_model_size(super->model)
トランザクションを無効にするかどうかに関係なく、「rdf_storage_virtuoso.c」の 941 行目で次のエラーが発生しました。
rc = SQLDriverConnect(connection->hdbc, 0,(UCHAR *) context->conn_str,
SQL_NTS, context->outdsn,
LIBRDF_VIRTUOSO_CONTEXT_DSN_SIZE,
&buflen, SQL_DRIVER_COMPLETE);
したがって、ODBC/iODBC レベルで接続エラーが発生していると思われます。ちなみに、次のコマンドで virtuoso に接続できました。
$ isql localhost:1111 dba dba
Connected to OpenLink Virtuoso
Driver: 07.20.3217 OpenLink Virtuoso ODBC Driver
OpenLink Interactive SQL (Virtuoso), version 0.9849b.
Type HELP; for help and EXIT; to exit.
SQL>
Redland ライブラリと Virtuoso の ODBC ライブラリを接続する方法はありますか? 前もって感謝します。