本文介绍了如何更改DBpedia SPARQL查询的执行时间上限? (Virtuoso 42000错误)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在通过Python使用SPARQL查询DBpedia。我面临执行时间上限的问题。这是错误:I am querying DBpedia using SPARQL through Python. I am facing issues with the upper execution time limit. This is the error : 代码:sparql = SPARQLWrapper("http://dbpedia.org/sparql")newquery = "DEFINE input:inference "skos-trans" PREFIX dcterms: <http://purl.org/dc/terms/> select distinct ?cat1 ?cat2 ?cat3 ?cat4 where { <http://dbpedia.org/resource/Pulp_Fiction> dcterms:subject ?cat1 . ?cat1 skos:broaderTransitive ?cat2. ?cat2 skos:broaderTransitive ?cat3. ?cat3 skos:broaderTransitive ?cat4. } "sparql.setQuery( newquery)sparql.setReturnFormat(JSON)results = sparql.query().convert()响应: Virtuoso 42000错误估计的执行时间5286(秒)超过了3000(秒)的限制 如何解决这个问题? 推荐答案您不能使用公共DBPedia端点,因为该端点众所周知,它也被大量使用,因此来限制允许人们运行的查询的复杂程度。You can't using the public DBPedia endpoint, because the endpoint is very well known it is also heavily used so they have to limit how complex a query they allow people to run.如果您需要运行遇到此类超时问题的查询,请考虑使用可用的数据库转储,并在Virtuoso或您选择的三元存储的本地副本中运行它们。If you need to run queries that run into issues like this timeout consider using one of the available database dumps and running them in a local copy of Virtuoso or a triple store of your choice. 这篇关于如何更改DBpedia SPARQL查询的执行时间上限? (Virtuoso 42000错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-09 23:37