2

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 はアプリケーションをボットとして検出し、実際のブラウザよりも少ないデータを返すのでしょうか?

4

1 に答える 1

1

アプリケーションが要求しているのは、確かに次のとおりです。

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

しかし、あなたの Web ブラウザには次のように表示されています。

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

Web ブラウザでhttp://dbpedia.org/resource/AfghanistanCommunicationsまたはhttp://dbpedia.org/page/AfghanistanCommunicationsにアクセスすると、次の場合を除き、http://dbpedia.org/page/Communications_in_Afghanistanにリダイレクトされます。特定のフォーマットを求める。リダイレクトの理由は、Wikipedia に http://en.wikipedia.org/wiki/AfghanistanCommunications から http://en.wikipedia.org/wiki/Communications_in_Afghanistan へのリダイレクトがあるためです。アプリケーションで取得したトリプルで確認できます。

<http://dbpedia.org/ontology/wikiPageRedirects>
于 2013-03-15T13:19:45.833 に答える