5

是否可以使用 RDFLIB 绘制 Sesame 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'>)

我认为唯一的技巧是指定一个正确的 URL 以使 Sesame 返回一个 .rdf xml 布局。

问题作者:转贴到http://answers.semanticweb.com/questions/9414/python-using-rdflib-to-graph-a-sesame-database(见那里的答案)

4

1 回答 1

1

您的端点 URL 错误。它指向 Sesame Workbench,它不是 (SPARQL) 端点,而是客户端应用程序。任何 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. 有关更多详细信息,请参阅Sesame HTTP 通信协议

(答案从我自己在另一个网站上的答案复制而来,为了完整起见,在此处发布)

于 2014-03-30T19:06:58.780 回答