当我运行以下代码以使用此代码片段查询 dblp 数据集时,我正在使用此端点http://dblp.l3s.de/d2r/snorql
enter code here
String st = ""; 字符串 qry = ""; 字符串 uri_V;
uri_V = "http://dblp.l3s.de/d2r/sparql";
// Modify if need......
//String ns = "\""+TextBox1.Text.ToString()+"\"";
// String qry = "SELECT DISTINCT ?name WHERE { ?person foaf:name ?name.FILTER regex(str(?name),"+ns+").}";
if (radiosrch.SelectedIndex == 0)
{
qry = "SELECT ?title WHERE {?game <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:First-person_shooters> .?game foaf:name ?title .}ORDER by ?title";
}
else// if (radiosrch.SelectedIndex == 1)
{
// qry= "query for publisher."
qry = "SELECT DISTINCT ?Concept WHERE {[] a ?Concept} LIMIT 10";
}
//Common
SparqlRemoteEndpoint endpoint = new SparqlRemoteEndpoint(new Uri(uri_V));
SparqlResultSet results = endpoint.QueryWithResultSet(qry);
foreach (SparqlResult result in results)
{
Console.WriteLine(result.ToString());
st = st + result.ToString() + "\n";
}
TextBox3.Text = st.ToString();
}
catch (Exception ex)
{
Label1.Visible = true;
Label1.Text = ex.ToString();
}
我收到以下错误
VDS.RDF.Query.RdfQueryException:尝试进行 SPARQL 查询时发生 HTTP 错误,有关详细信息,请参阅内部异常 ---> System.Net.WebException:远程服务器返回错误:(400)错误请求。在 System.Net.HttpWebRequest.GetResponse() 在 VDS.RDF.Query.SparqlRemoteEndpoint.ExecuteQuery(Uri target, String postData, String accept) 在 VDS.RDF.Query.SparqlRemoteEndpoint.QueryInternal(String sparqlQuery, String acceptHeader) 在 VDS。 RDF.Query.SparqlRemoteEndpoint.QueryWithResultSet(ISparqlResultsHandler handler, String sparqlQuery) --- 内部异常堆栈跟踪结束 --- 在 VDS.RDF.Query.SparqlRemoteEndpoint.QueryWithResultSet(ISparqlResultsHandler handler, String sparqlQuery) 在 VDS.RDF.Query。 SparqlRemoteEndpoint.QueryWithResultSet(String sparqlQuery) at Index.ImageButton1_Click(Object sender, ImageClickEventArgs e) in d:
请帮我尽快解决,请