我在本地 GraphDB 三元存储中运行 SPARQL 查询,该查询包含一个 SERVICE 子句,该子句用于 DBPedia Virtuoso。该查询基本上直接从 DBPedia 获取一些 DBPedia URI 的标签(注意首先执行子查询以获取本地结果,然后将这些结果传递给 SERVICE 子句):
SELECT DISTINCT ?uri (STR(?theLabel) AS ?label)
WHERE {
{
SELECT DISTINCT ?uri
WHERE {
?domain a <http://xmlns.com/foaf/0.1/Person> .
?domain <http://virtual-assembly.org/pair#hasKeyword> ?uri .
}
}
SERVICE <http://dbpedia.org/sparql> {
?uri <http://www.w3.org/2000/01/rdf-schema#label> ?theLabel .
FILTER(lang(?theLabel) = 'fr')
}
}
ORDER BY ?label
在评估服务子句Virtuoso S0022 Error SQ200时,我从 Virtuoso 收到以下错误:
Query evaluation error: org.eclipse.rdf4j.query.QueryEvaluationException: Virtuoso S0022 Error SQ200: No column uri.
SPARQL query:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sesame: <http://www.openrdf.org/schema/sesame#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX fn: <http://www.w3.org/2005/xpath-functions#>
SELECT ?theLabel ?__rowIdx WHERE {
?uri <http://www.w3.org/2000/01/rdf-schema#label> ?theLabel .
FILTER(lang(?theLabel) = 'fr')
}
VALUES (?__rowIdx ?uri) { ("0" <http://dbpedia.org/resource/Semantic_Web> ) ("1" <http://dbpedia.org/resource/Peer-to-peer> ) ("2" <http://dbpedia.org/resource/Collaboration> ) ("3" <http://dbpedia.org/resource/Free_software> ) ("4" <http://dbpedia.org/resource/Social_transformation> ) ("5" <http://dbpedia.org/resource/Social_network> ) ("6" <http://dbpedia.org/resource/Ecology> ) ("7" <http://dbpedia.org/resource/Activism> ) ("8" <http://dbpedia.org/resource/Supernatural> ) ("9" <http://dbpedia.org/resource/Sociology> ) ("10" <http://dbpedia.org/resource/Natural_science> ) ("11" <http://dbpedia.org/resource/Popular_science> ) ("12" <http://dbpedia.org/resource/Cooperation> ) ("13" <http://dbpedia.org/resource/Wikimedia_Commons> ) ("14" <http://dbpedia.org/resource/Musician> ) }
(HTTP status 500)
发送给 Virtuoso 的 SPARQL 查询在我看来是有效的。
当然,我不知道 GraphDB 如何生成查询,但是有什么办法可以重写原始查询来解决这个问题?
谢谢