私は主に Blazegraph をバックエンドとして使用するプロジェクトに取り組んでおり、私が理解していることから、比較的古いセサミ (2.7.12) に閉じ込められています。
プロジェクトには、埋め込まれたゴマ、または独立したゴマまたは RDF4J を使用できる別のコンポーネントがあります。 自立型の RDF4J が既にセットアップされているので、それを使用したいと思います。
次の Scala コードを使用して、埋め込まれた Sesame に接続できます。serverUrl
独立した RDF4J 2.2 を指すように変更すると、以下のエラーが発生します。
Sesame API を使用して RDF4J サーバーにアクセスすることは可能ですか?
val serverUrl = "http://address.domain:8080/rdf4j-server"
val manager = new RemoteRepositoryManager(serverUrl)
manager.initialize()
val repositoryId = "repo_id"
val repository = manager.getRepository(repositoryId)
val con = repository.getConnection()
val queryString = "SELECT ?x ?y WHERE { ?x ?p ?y } "
val tupleQuery = con.prepareTupleQuery(QueryLanguage.SPARQL, queryString)
val result = tupleQuery.evaluate()
[main] 警告 org.openrdf.http.client.SesameSession - サーバーが問題を報告します: org.eclipse.rdf4j.repository.config.RepositoryConfigException: リポジトリのリポジトリの実装がスレッド「メイン」で例外がありません UuidRefresh.main で java.lang.ExceptionInInitializerError (UuidRefresh.scala) 原因: org.openrdf.repository.http.HTTPQueryEvaluationException: org.eclipse.rdf4j.repository.config.RepositoryConfigException: org.openrdf.repository.http.HTTPTupleQuery.evaluate(HTTPTupleQuery. java:64) at UuidRefresh$.(UuidRefresh.scala:54) at UuidRefresh$.(UuidRefresh.scala) ... 1 つ以上原因: org.openrdf.repository.RepositoryException: org.eclipse.rdf4j.repository.config.リポジトリ構成例外:org.openrdf.http.client.SparqlSession.execute(SparqlSession.java:1100) at org.openrdf.http.client.SparqlSession.executeOK(SparqlSession.java:1028) at org.openrdf.http にリポジトリのリポジトリ実装がありません。 client.SparqlSession.sendTupleQueryViaHttp(SparqlSession.java:807) at org.openrdf.http.client.SparqlSession.getBackgroundTupleQueryResult(SparqlSession.java:704) at org.openrdf.http.client.SparqlSession.sendTupleQuery(SparqlSession.java:363) at org.openrdf.repository.http.HTTPTupleQuery.evaluate(HTTPTupleQuery.java:58) ... 3 つ以上client.SparqlSession.getBackgroundTupleQueryResult(SparqlSession.java:704) at org.openrdf.http.client.SparqlSession.sendTupleQuery(SparqlSession.java:363) at org.openrdf.repository.http.HTTPTupleQuery.evaluate(HTTPTupleQuery.java:58) ... 3 つ以上client.SparqlSession.getBackgroundTupleQueryResult(SparqlSession.java:704) at org.openrdf.http.client.SparqlSession.sendTupleQuery(SparqlSession.java:363) at org.openrdf.repository.http.HTTPTupleQuery.evaluate(HTTPTupleQuery.java:58) ... 3 つ以上