0

我尝试按照dotnetrdf 文档将数据存储在Virtuoso Server中。

这是我所做的:

public void LoadGraph()
{
    //Create our Storage Provider - this example uses Virtuoso Universal Server
    VirtuosoManager virtuoso = new VirtuosoManager("creativeartefact.org", 1111, "DB", "user", "password");

    //Load the Graph into an ordinary graph instance first
    Graph g = new Graph();
    virtuoso.LoadGraph(g, new Uri("http://creativeartefact.org/"));

    //Then place the Graph into a wrapper
    StoreGraphPersistenceWrapper wrapper = new StoreGraphPersistenceWrapper(virtuoso, g);

    //Now make changes to this Graph as desired...
    g.Assert(g.CreateUriNode(new Uri("http://creativeartefact.org/testB/123")), g.CreateUriNode("rdf:Type"), g.CreateUriNode(new Uri("http://creativeartefact.org/ontology/Artist")));
    wrapper.Flush(); // mandatory, but doesn't help either

    //Remember to call Dispose() to ensure changes get persisted when you are done
    wrapper.Dispose();
}

但是 - 没有数据被保存,也没有抛出异常。插入三元组后,三元组计数按预期增加 1,但不会进入数据库。当我重新运行代码时,三重计数又回到了旧值。用户帐户具有write权限。

知道我缺少什么吗?

提前致谢,
弗兰克

4

1 回答 1

1

您没有完全阅读您关注的文档。

将 Graph 保存到 Triple Store 的最简单方法是使用实​​现的SaveGraph()方法,有关详细信息IStorageProvider,请参阅Triple Store 集成。

于 2016-10-11T16:58:27.200 回答