我正在运行此查询
SELECT *
WHERE
{
?s dc:creator ?name .
?s rdf:type swrc:Article .
FILTER regex(str(?name), "Jeffrey", "D.", "Ullman") .
}
Run Code Online (Sandbox Code Playgroud)
我收到的错误是:
Encountered " "," ", "" at line 16, column 41.
Was expecting one of:
<LANGTAG> ...
<INTEGER_POSITIVE> ...
<DECIMAL_POSITIVE> ...
Run Code Online (Sandbox Code Playgroud)
有什么问题,我不符合准则吗?我搜索了一下,我在各种帖子中找到了相同的语法.
编辑:
当我要求的时候
SELECT *
WHERE
{
?s rdf:type swrc:Article .
?s dc:creator ?name .
}
我回来了:
s name
<http://dblp.l3s.de/d2r/resource/publications/conf/www/BeszteriV07> [http] <http://dblp.l3s.de/d2r/resource/authors/Istvan_Beszteri> [http]在一行中,第一个URI是?s第二个,第二个是?name.
现在我知道有一个名为"Jeffrey D. Ullman"的作者,我查询:
SELECT *
WHERE
{
?s rdf:type swrc:Article .
?s dc:creator ?name .
FILTER regex(str(?name), "Jeffrey")
}
LIMIT 10.
然后我回过头来举个例子:
s name
<http://dblp.l3s.de/d2r/resource/publications/conf/www/LimWPVA07> [http] <http://dblp.l3s.de/d2r/resource/authors/Jeffrey_Scott_Vitter> [http]
所以这里的问题是我如何能够匹配"Jeffrey D. Ullman"并查看他撰写的所有文章.
您的正则表达式函数语法不正确请参阅SPARQL1.1规范.请注意,正则表达式正好采用两个或三个参数,第一个是文本,第二个是模式,最后一个是包含标志的可选字符串.
17.4.3.14 REGEX
Run Code Online (Sandbox Code Playgroud)xsd:boolean REGEX (string literal text, simple literal pattern) xsd:boolean REGEX (string literal text, simple literal pattern, simple literal flags)