我尝试按照dotnetrdf
documentation将数据存储在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
权限。
知道我缺少什么吗?
提前致谢,
弗兰克
答案 0 :(得分:1)
您还没有完全阅读您关注的文档。
将图表保存到三重存储的最简单方法是使用
SaveGraph()
实施的IStorageProvider
方法,有关详细信息,请参阅Triple Store Integration。