我是 SPARQL 的初学者,所以如果你能帮助我,那就太好了。. 我有一个这样的 RDF 文档:
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix lb: <http://example.org/lastfm/> .
lb:bob foaf:knows lb:user2, lb:user3, lb:user4 ;
foaf:age 25 ;
lb:listenedTo lb:track1, lb:track2 ;
lb:topArtist lb:artist1, lb:artist2 .
lb:user2 foaf:knows lb:user5, lb:user6 ;
foaf:age 40 ;
lb:listenedTo lb:track1, lb:track2, lb:track3 ;
lb:topArtist lb:artist2, lb:artist4 .
lb:user3 foaf:knows lb:user5, lb:bob, lb:user6 ;
foaf:age 19 ;
lb:listenedTo lb:track2, lb:track3, lb:track4 ;
lb:topArtist lb:artist2, lb:artist3 .
lb:user4 lb:listenedTo lb:track2, lb:track3, lb:track4 ;
foaf:age 61 ;
lb:topArtist lb:artist3, lb:artist4, lb:artist5 .
lb:user5 foaf:knows lb:user7 ;
foaf:age 23 ;
lb:topArtist lb:artist1, lb:artist3 .
并且我想找到所有可以lb:bob
通过foaf:knows
最多关注 3 次并且至少听过两首曲目的用户。我写了一个这样的查询:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix lb: <http://example.org/lastfm/>
select ?user
where
{
lb:bob foaf:knows | foaf:knows/foaf:knows| foaf:knows/foaf:knows/foaf:knows ?user.
?user lb:listenedTo ?tracks
minus{lb:bob lb:listenedTo ?track}
filter (?tracks count(*)>=2)
}
但是这个错误:
Encountered " "count" "count "" at line 12, column 23. Was expecting one of:
"not" ...
"in" ...
<INTEGER_POSITIVE> ...
<DECIMAL_POSITIVE> ...
<DOUBLE_POSITIVE> ...
<INTEGER_NEGATIVE> ...
<DECIMAL_NEGATIVE> ...
<DOUBLE_NEGATIVE> ...
")" ...
"=" ...
"!=" ...
">" ...
"<" ...
"<=" ...
">=" ...
"||" ...
"&&" ...
"+" ...
"-" ...
"*" ...
"/" ...
我知道我的查询有很多问题,请您帮我重写一下好吗?