当我们在Virtuoso中编写SPARQL时,通过使用%20
对空间进行编码,可以轻松地转义URI中的空间。但是,当我在Virtuoso isql服务上运行相同的查询时,转义失败。这是我的疑问:
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
PREFIX schema: <http://schema.org/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Items with specific picture
#Note that URL of the filename must be URL encoded.
#added before 2016-10
SELECT ?item ?itemLabel
WHERE
{
?item wdt:P18 <http://commons.wikimedia.org/wiki/Special:FilePath/Flag%20of%20the%20Netherlands.svg>
OPTIONAL{?item rdfs:label ?en . FILTER(LANG(?en) = "en")}
BIND(str(COALESCE(?en,strafter(str(?item),"http://www.wikidata.org/entity/"))) AS ?itemLabel)
}
LIMIT 100
错误说:
***错误37000:[Virtuoso驱动程序] [Virtuoso服务器] SQ074:第22行:SP030:SPARQL编译器,第18行:'&lt;'的语法错误在'http:'之前 顶级第0行:
SPARQL PREFIX wd: <http://www.wikidata.org/entity/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX wdno: <http://www.wikidata.org/prop/novalue/> PREFIX schema: <http://schema.org/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX bd: <http://www.bigdata.com/rdf#> #Items with specific picture #Note that URL of the filename must be URL encoded. #added before 2016-10 SELECT ?item ?itemLabel WHERE { ?item wdt:P18 <http://commons.wikimedia.org/wiki/Special:FilePath/Flag of the Netherlands.svg> OPTIONAL{?item rdfs:label ?en . FILTER(LANG(?en) = "en")} BIND(str(COALESCE(?en,strafter(str(?item),"http://www.wikidata.org/entity/"))) AS ?itemLabel) } LIMIT 100
%20
无法理解Isql,因为它打印带有空格的资源(URI)。