您在这里有两个查询。在问题的最后,您使用的查询没有过滤器,但是与代码中嵌入的查询不同。如果您使用DBpedia终结点上的代码中嵌入的查询,则会收到非常清楚的错误消息:
Virtuoso 22023 Error SL001: The SPARQL 1.1 function STRSTARTS() needs a string value as 2d argumentSPARQL query:define sql:big-data-const 0 #output-format:text/htmldefine sql:signal-void-variables 1 define input:default-graph-uri <http://dbpedia.org> prefix dbpediaont: <http://dbpedia.org/ontology/>prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>select ?resource where {?mat rdf:type ?resourcefilter strstarts(str(?resource), dbpediaont:)}关键是
SPARQL 1.1函数STRSTARTS()需要一个字符串值作为2d参数
你需要写
dbpediaont:用
str(),因为它是一个IRI,而不是字符串:
filter strstarts(str(?resource), str(dbpediaont:))



