我创建了一个在 DBpedia SPARQL 端点上执行 SPARQL 查询的函数。该函数接受一个包含 15 个元素的数组,每次将数组中的一个元素替换到查询中,然后执行它以获取结果。问题是它需要前 9 个元素,然后引发此错误:
results = sparql.query().convert()
File "build/bdist.linux-i686/egg/SPARQLWrapper/Wrapper.py", line 390, in query
return QueryResult(self._query())
File "build/bdist.linux-i686/egg/SPARQLWrapper/Wrapper.py", line 369, in _query
raise e
HTTPError: HTTP Error 414: Request-URI Too Large
我的查询如下:
sparql = SPARQLWrapper('http://mlode.nlp2rdf.org/sparql');
querystring="""
PREFIX dc:<http://purl.org/dc/elements/1.1/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX olia-ar: <http://purl.org/olia/arabic_khoja.owl#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX lexvo: <http://lexvo.org/id/iso639-3/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX gold: <http://purl.org/linguistics/gold/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX qvoc: <http://www.nlp2rdf.org/quranvocab#>
SELECT ?verseTextAr ?tafseer
WHERE
{
?verse a qvoc:Verse;
qvoc:chapterIndex 26;
qvoc:verseIndex WORD;
skos:prefLabel ?verseTextAr;
qvoc:descByJalalayn ?tafseer.
}
"""