我已经运行了一个AllegroGraph服务器,并且在查询远程数据存储时遇到了困难,关于文档的信息非常少。
这是我的代码:
using System;
using VDS.RDF;
using VDS.RDF.Storage;
namespace PoC {
class Program {
static void Main(string[] args) {
string server = "http://server";
string repo = "repo";
string username = "username";
string password = "password";
AllegroGraphConnector agraph = new AllegroGraphConnector(server, repo, username, password);
Options.HttpDebugging = true;
Options.HttpFullDebugging = true;
agraph.Query("SELECT * WHERE { emid:_PCAT_0001 ?p ?o }");
Console.ReadLine();
}
}
}格式错误的查询:解析错误:在展开QName "emid:_PCAT_0001“时未定义的"emid”名称空间映射。
虽然在AllegroGraph WebView中,我可以运行完全相同的查询和名称空间,但它被加载到存储库中。
我该怎么解决这个问题?
发布于 2017-02-21 10:31:40
您需要在查询中声明前缀emid:。据推测,AllegroGraph WebView UI是自动为您完成的,但是普通的SPARQL端点不会这样做。
试着使用这样的方法:
agraph.Query("PREFIX emid: <http://your.uri.goes/here> SELECT * WHERE { emid:_PCAT_0001 ?p ?o }");显然,您应该将这个假URI替换为您的emid:前缀映射到的实际URI!
https://stackoverflow.com/questions/42363501
复制相似问题