gpt4 book ai didi

sparql - 如何更改 DBpedia SPARQL 查询的执行时间上限? (Virtuoso 42000 错误)

转载 作者:行者123 更新时间:2023-12-02 05:37:07 25 4
gpt4 key购买 nike

我正在通过 Python 使用 SPARQL 查询 DBpedia。我面临执行时间上限的问题。这是错误:

代码:

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(秒)

如何解决这个问题?

最佳答案

您不能使用公共(public) DBPedia 端点,因为该端点众所周知,而且也被大量使用,因此他们必须限制允许人们运行的查询的复杂程度。

如果您需要运行遇到此类超时问题的查询,请考虑使用可用的 database dumps 之一并在 Virtuoso 的本地副本或您选择的三重存储中运行它们。

关于sparql - 如何更改 DBpedia SPARQL 查询的执行时间上限? (Virtuoso 42000 错误),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11967785/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com