【问题标题】:Different result in DBPedia using WebClient and browser使用 WebClient 和浏览器在 DBPedia 中产生不同的结果
【发布时间】:2013-03-15 12:39:35
【问题描述】:

我想提取一些存在于DBPedia 中的信息。因此,我使用 .NET 的 System.Net.WebClient 编写了一个应用程序,它获取 url 并以 N-Triples 格式(纯文本)返回 url 的内容。

url(与应用程序)提取数据的结果是:

<http://dbpedia.org/resource/AfghanistanCommunications> <http://dbpedia.org/ontology/wikiPageRedirects> <http://dbpedia.org/resource/Communications_in_Afghanistan> . <http://dbpedia.org/resource/AfghanistanCommunications>   <http://www.w3.org/ns/prov#wasDerivedFrom>  <http://en.wikipedia.org/wiki/AfghanistanCommunications?oldid=74466499> . <http://dbpedia.org/resource/AfghanistanCommunications>   <http://xmlns.com/foaf/0.1/isPrimaryTopicOf>    <http://en.wikipedia.org/wiki/AfghanistanCommunications> . <http://dbpedia.org/resource/AfghanistanCommunications>  <http://www.w3.org/2000/01/rdf-schema#label>    "AfghanistanCommunications"@en .

但是,当我在浏览器中看到the url 时,我得到的内容与我提取的内容截然不同。

我用 Fiddler 检查了请求,然后:

webClient.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/4.0 (兼容; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");

DBPedia 是否将应用程序检测为机器人并返回比真实浏览器更少的数据,或者我错过了其他东西?!

【问题讨论】:

    标签: .net c#-4.0 rdf sparql dbpedia


    【解决方案1】:

    您的应用程序要求的肯定是:

    http://dbpedia.org/data/AfghanistanCommunications.ntriples
    

    但是您的网络浏览器显示的是:

    http://dbpedia.org/data/Communications_in_Afghanistan.ntriples
    

    如果您的 Web 浏览器,如果您转到 http://dbpedia.org/resource/AfghanistanCommunicationshttp://dbpedia.org/page/AfghanistanCommunications,您将被重定向到 http://dbpedia.org/page/Communications_in_Afghanistan,除非要求提供特定格式。重定向的原因是因为维基百科有一个从http://en.wikipedia.org/wiki/AfghanistanCommunicationshttp://en.wikipedia.org/wiki/Communications_in_Afghanistan 的重定向。您可以在应用程序中获得的三元组中看到:

    <http://dbpedia.org/ontology/wikiPageRedirects>
    

    【讨论】:

      猜你喜欢
      • 2016-03-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-11
      相关资源
      最近更新 更多