5

RDFLIBを使用してゴマRDFデータベースのグラフを描くことは可能ですか?これは私が試したものです:

endpoint = "http://127.0.0.1:8080/openrdf-workbench/repositories/movies/explore?resource=%3Cfile%3A%2F%2Fmovies_export.rdf%3E"

from rdflib import Graph
g = Graph()
g.parse(endpoint) 

これはエラーです:

Traceback (most recent call last):
  File "C:\Software\rdflib\movieGraph.py", line 10, in <module>
    g.parse(endpoint)
  File "c:\python26_32bit\lib\site-packages\rdflib\graph.py", line 756, in parse

    parser = plugin.get(format, Parser)()
  File "c:\python26_32bit\lib\site-packages\rdflib\plugin.py", line 89, in get
    raise PluginException("No plugin registered for (%s, %s)" % (name, kind))
rdflib.plugin.PluginException: No plugin registered for (application/xml, <class
 'rdflib.parser.Parser'>)

唯一のトリックは、Sesameが.rdfxmlレイアウトを返すように適切なURLを指定することだと思います。

質問の作成者: http://answers.semanticweb.com/questions/9414/python-using-rdflib-to-graph-a-sesame-databaseに再投稿(回答を参照)

4

1 に答える 1

1

エンドポイントURLが間違っています。これは、(SPARQL)エンドポイントではなく、クライアントアプリケーションであるSesameWorkbenchを指します。SesameデータベースのSPARQLエンドポイントは、常にSesameサーバー上にあり、リポジトリーURLと同じです。あなたの場合、おそらくhttp://127.0.0.1:8080/openrdf-sesame/repositories/movies

あなたがしていることを見ると、SPARQLエンドポイントは必要ないが、完全なSesameデータベースのエクスポートが必要だと思います。これには、を使用できますhttp://127.0.0.1:8080/openrdf-sesame/repositories/movies/statements。詳細については、SesameHTTP通信プロトコルを参照してください。

(別のサイトの私自身の回答からコピーされた回答、完全を期すためにここに投稿されています)

于 2014-03-30T19:06:58.780 に答える