2013-03-15 71 views
2

我想提取一些存在于DBPedia中的信息。所以,我写了一个使用.NET的System.Net.WebClient的应用程序,该应用程序获取url并以N-Triples格式(纯文本)返回url的内容。DBPedia使用WebClient和浏览器的不同结果

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与我的浏览器,我从我已经提取非常不同的内容。

我检查与小提琴手,然后请求:

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

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> 
相关问题