Gus*_*usa 5 regex rdf sparql pattern-matching
我试图通过使用正则表达式过滤器匹配SPARQL中的一个单词,但没有成功...:/我将查询发送到位于"http://dbtune.org/musicbrainz/sparql"的端点.那么,以下查询有效:
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX mo: <http://purl.org/ontology/mo/>
SELECT ?artist ?name
WHERE {
?artist a mo:MusicArtist
. ?artist foaf:name "Switchfoot"
. ?artist foaf:name ?name
. FILTER(regex(str(?name), "switchfoot", "i"))
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我删除第7行(.?artist foaf:name"Switchfoot"),则以下查询不匹配:
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX mo: <http://purl.org/ontology/mo/>
SELECT ?artist ?name
WHERE {
?artist a mo:MusicArtist
. ?artist foaf:name ?name
. FILTER(regex(str(?name), "switchfoot", "i"))
}
Run Code Online (Sandbox Code Playgroud)
我不知道我是做错了什么,还是端点错误......
有人能帮助我吗?