【问题标题】:Querying AllegroGraph using dotNetRDF使用 dotNetRDF 查询 AllegroGraph
【发布时间】:2017-02-21 09:30:57
【问题描述】:

我正在运行 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();
    }
  }
}

错误查询:解析错误:未定义“emid”的命名空间映射 扩展 QName "emid:_PCAT_0001" 时。

尽管在 AllegroGraph WebView 中我可以运行完全相同的查询,并且命名空间已加载到存储库中。

我该如何解决?

【问题讨论】:

    标签: c# sparql dotnetrdf allegrograph


    【解决方案1】:

    您需要在查询中声明前缀 emid:。大概 AllegroGraph WebView UI 会自动为您执行此操作,但普通的 SPARQL 端点不会。

    尝试使用这样的东西:

    agraph.Query("PREFIX emid: <http://your.uri.goes/here> SELECT * WHERE { emid:_PCAT_0001 ?p ?o }");
    

    显然你应该用你的 emid: 前缀映射到的真实 URI 替换那个假 URI!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多