使用dotnetRDF查询dbpedia sparql端点-RDFParseException [英] Query dbpedia sparql endpoint using dotnetRDF - RDFParseException

查看:127
本文介绍了使用dotnetRDF查询dbpedia sparql端点-RDFParseException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用(dotnetRDF)<$在 http://dbpedia.org/sparql 上执行以下查询时c $ c> VDS.RDF.Query.SparqlRemoteEndpoint.QueryWithResultSet()一切正常。

When I execute the following query on http://dbpedia.org/sparql using (dotnetRDF) VDS.RDF.Query.SparqlRemoteEndpoint.QueryWithResultSet() everything works fine.

SELECT ?film ?p ?o
WHERE {
    ?film <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:Japanese_films> .
    ?film ?p ?o
}
limit 500

但是当我尝试使用 SparqlRemoteEndpoint.QueryWithResultGraph()

CONSTRUCT { ?film ?p ?o}
WHERE {
    ?film <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:Japanese_films> .
    ?film ?p ?o
}
limit 500

我收到了带有消息

"[Line 456 Column 29] Unexpected Character (Code 8211) – was encountered"

我尝试为ResultsAcceptHeader和RdfAcceptHeader属性设置值,但没有成功。

I've tried to set values for ResultsAcceptHeader and RdfAcceptHeader properties but without success.

如果在第二次查询中,我将限制从500更改为例如100可以正常工作。

If in second query I changed limit from 500 for e.g. 100 it works fine.

您能帮我吗?

现在,如果限制的值为456,则会引发异常。
[第495行第25列]遇到意外字符(代码8211),这是第495行 ns19:??? _ ??? 5555。。第25列的值为 _

Now exception is thrown if limit has value 456. [Line 495 Column 25] Unexpected Character (Code 8211) – was encountered, and this is line 495 ns19:???_???5555 .. Value at column 25 is _

此处您以Wiki格式 http://dbpedia.org/page/Interstella_5555:_The_5tory_of_the_5ecret_5tar_5ystem ,因为我认为$ c> dbpprop:kanji 属性(インターステラ5555)

Here you have this data in wiki format http://dbpedia.org/page/Interstella_5555:_The_5tory_of_the_5ecret_5tar_5ystem, as I suppose, there is a problem with value of dbpprop:kanji property (インターステラ5555)

推荐答案

DBPedia已知编码和编码问题

DBPedia has known issues with encoding and it may be simply that DBPedia is producing dud data.

您可以尝试在dotNetRDF中进一步调试它的方法是,用以下命令包装调用查询的代码:

What you can try to do to debug this further in dotNetRDF is to wrap the code that invokes the query with the following:

try
{
   Options.HttpDebugging = true;
   Options.HttpFullDebugging = true;

  //Try your query here
}
finally
{
   Options.HttpDebugging = false;
   Options.HttpFullDebugging = false;
}

这将导致解析失败(带有其他错误),但将转储对控制台进行调试的原始HTTP响应。如果您可以编辑问题以包含转储456行周围的内容,那么人们也许可以为您提供更多帮助。

This will cause parsing to fail (with a different error) but it will dump the raw HTTP response to the console for debugging. If you can edit your question to include the content from the lines around line 456 of the dump then people may be able to provide your with more help.

编辑

因此,怀疑问题确实出在DBPedia产生的是不连续数据,而不是dotNetRDF本身。

So as suspected the problem is indeed with DBPedia producing dud data, not in dotNetRDF itself.

当我下载您以Turtle格式提到的文件并尝试解析该文件时,我得到了相同的错误消息,并且它与以下行有关:

When I downloaded the file you mentioned in Turtle format and tried to parse it I got the same error message and it pertains to the following line:

ns6:Avalon_–_Spiel_um_dein_Leben ,

乍一看似乎有效(因为前缀名称中允许使用简单的连字符-),问题是它不是连字符,实际上是字符代码8211(AndyS提到的十六进制2013),这是

While at first glance that may look valid (since a simple hyphen - is allowed in Prefixed Names) the problem is that it is not a hyphen it is in fact character code 8211 (of hex 2013 as AndyS mentions) and this is not in the acceptable range of prefix name characters.

Btw我也用耶拿的Turtle解析器确认了这一点,只是要确保它确实不是dotNetRDF问题。

Btw I confirmed this with Jena's Turtle parser as well just to make sure it really wasn't a dotNetRDF issue.

所以ba通常,DBPedia数据已损坏,您可以尝试通过适当设置接收标头来强制其将RDF / XML或NTriples发送回给您,但不能保证这些格式的数据也不会恢复正常。我建议您联系DBPedia的人员,将其报告为错误-dbpedia-discussion@lists.sf.net

So basically the DBPedia data is broken, you can try forcing it to send you back RDF/XML or NTriples by setting the accept headers appropriately but there is no guarantee that the data won't come back bad in those formats as well. I would suggest that you contact the DBPedia guys to report this as a bug - dbpedia-discussion@lists.sf.net

这篇关于使用dotnetRDF查询dbpedia sparql端点-RDFParseException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆