使用DotNetRDF连接到Virtuoso

时间:2016-10-06 11:55:33

标签: c# virtuoso dotnetrdf

我尝试使用Virtuoso Server与我的dotnetrdf建立联系。有an example in the documentation就像......

//Create our Storage Provider - this example uses Virtuoso Universal Server
VirtuosoManager virtuoso = new VirtuosoManager("https://myhost.org", 1111, "DB", "username", "password");

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

我用我的凭据替换了用户名和密码,但是当涉及virtuoso.LoadGraph行时,我得到一个FormatException,上面写着:

The input string has the wrong format with the following stacktrace:

bei System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
bei System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
bei OpenLink.Data.Virtuoso.TcpConnection.GetEndPoint(String ds)
bei OpenLink.Data.Virtuoso.TcpConnection.Open(ConnectionOptions options)
bei OpenLink.Data.Virtuoso.VirtuosoConnection.CreateInnerConnection(ConnectionOptions options, Boolean enlist)
bei OpenLink.Data.Virtuoso.ConnectionPool.GetConnection(ConnectionOptions options, VirtuosoConnection connection)
bei OpenLink.Data.Virtuoso.VirtuosoConnection.Open()
bei VDS.RDF.Storage.VirtuosoManager.Open(Boolean keepOpen, IsolationLevel level)
bei VDS.RDF.Storage.VirtuosoManager.LoadGraph(IRdfHandler handler, Uri graphUri)
bei VDS.RDF.Storage.VirtuosoManager.LoadGraph(IGraph g, Uri graphUri)
bei VirtuosoTest.MainWindow.LoadGraph() in C:\Users\devfs\Documents\Visual Studio 2015\Projects\Test\VirtuosoTest\VirtuosoTest\MainWindow.xaml.cs:Zeile 40.
bei VirtuosoTest.MainWindow..ctor() in C:\Users\devfs\Documents\Visual Studio 2015\Projects\Test\VirtuosoTest\VirtuosoTest\MainWindow.xaml.cs:Zeile 30.

不幸的是,在试图找出可能出错的地方时,这并没有多大帮助。任何想法,我能做些什么来缩小问题范围?

PS:我可以通过https://myhost.org:8890/conductor访问Virtuoso导体,我也尝试使用端口8890作为参数(但我认为这不是所需的端口)具有相同的结果。如果我省略了端口,则会收到错误,即目标计算机拒绝连接。

提前致谢,
弗兰克

1 个答案:

答案 0 :(得分:2)

你的问题就在这里 -

VirtuosoManager("https://myhost.org", 1111, "DB", "username", "password");

dotnetrdf连接不是通过http/https;第一个参数应该只是一个主机名,即myhost.org

只需将上述内容更改为以下内容即可解决即时错误 -

VirtuosoManager("myhost.org", 1111, "DB", "username", "password");