sparql 查询 sparql.query().convert() 有时在 Virtuoso SPARQL 查询编辑器上给出输出时抛出异常
我正在运行 sparql 查询
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT(?film_link) ?film_name ?wikipage
WHERE {
?film_link rdf:type <http://dbpedia.org/ontology/Film> .
?film_link foaf:name ?film_name .
?film_link foaf:page ?wikipage .
} LIMIT 10000 OFFSET num
此查询在 for 循环中运行 [0,9999,19999,29999,39999,49999]
有时 results = sparql.query().convert() 会抛出异常。
有些给出结果,有些则不给出结果。当我在 Virtuoso SPARQL 查询编辑器上运行这些查询时,所有查询都返回数据...有人知道吗?
I am running sparql query
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT(?film_link) ?film_name ?wikipage
WHERE {
?film_link rdf:type <http://dbpedia.org/ontology/Film> .
?film_link foaf:name ?film_name .
?film_link foaf:page ?wikipage .
} LIMIT 10000 OFFSET num
This query is running in for loop [0,9999,19999,29999,39999,49999]
sometimes results = sparql.query().convert() throws an exceptions.
Some give results and some don't. While all queries are returning data when I ran these queries on Virtuoso SPARQL Query Editor... does any one have idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题出在 Distinct 上。
当使用不同的查询快捷方式/优化时,如果您有很多结果,您的查询可能会超时(取决于服务器负载)
您可以查看此 DBpedia 线程以获取其他替代方案/优化
http://sourceforge.net/mailarchive/message.php?msg_id=28653250
此外,distinct 需要更多的服务器资源。根据查询,它可能必须评估所有结果 - 即使您要求限制 - 这可能会导致查询超时(取决于当前服务器负载)。
我不确定您的查询是否属于这种情况......
The problem is with Distinct.
When using Distinct query shortcut / optimization is limited and if you have many results your query could timeout (depending on server load)
You may look into this DBpedia thread for other alternatives / optimizations
http://sourceforge.net/mailarchive/message.php?msg_id=28653250
Also, distinct requires more server resources. Depending on the query it may have to evaluate all the results - even though you ask for a limit - and that could result in query timeouts (depending on current server load).
I am not sure if this is the case for your query...