DBPediaに存在する情報を抽出したい。そこで、.NET のSystem.Net.WebClientを使用して、URL を取得し、URL のコンテンツをN-Triples形式 (プレーン テキスト) で返すアプリケーションを作成しました。
(アプリケーションを使用して) 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 .
しかし、ブラウザでURLを表示すると、抽出したコンテンツとは大きく異なるコンテンツが表示されます。
Fiddler でリクエストを確認した後、次のようにしました。
webClient.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/4.0 (互換; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
DBPedia はアプリケーションをボットとして検出し、実際のブラウザよりも少ないデータを返すのでしょうか?