简体   繁体   English

为什么过滤器在这种情况下不起作用?

[英]Why filter doesn't work in this context?

This is the query and the result: 这是查询和结果:

在此处输入图片说明

As you see, I am filtering out the users that are bo:ania , so why do they still appear? 如您所见,我正在过滤掉bo:ania的用户,那么为什么它们仍然出现?

However, if I remove the widecard and select just the users ?user , bo:ania doesn't appear 但是,如果删除宽卡并仅选择用户?user ,则bo:ania不会出现

在此处输入图片说明

I didn't provide a minimum data example because this is a question about how filter and wildcard work, not about a problem in extracting some data from a data set. 我没有提供最低限度的数据示例,因为这是关于过滤器和通配符如何工作的问题,而不是关于从数据集中提取某些数据的问题。 However, if you need a minimum data, I'm more than happy to provide it. 但是,如果您需要最低限度的数据,我很乐意提供。

?specificUser is bound to bo:ania by your VALUES statement. ?specificUser通过VALUES语句绑定到bo:ania ?user is an entirely different binding defined by the other triple patterns. ?user是由其他三元模式定义的完全不同的绑定。 Your FILTER says to filter out results where ?user = bo:ania , and it appears to be doing that correctly, seeing that ?user is not bound to bo:ania in any of the results. 您的FILTER说要过滤掉?user = bo:ania ,并且看来这样做正确,因为在任何结果中都没有看到?user绑定到bo:ania

BTW, there isn't a need to use VALUES in this case unless you want to inspect multiple values. 顺便说一句,除非您要检查多个值,否则在这种情况下无需使用VALUES If it's just the one value, then the following would work, and not have you wondering why the binding to bo:ania is included in the result set: 如果只是一个值,那么下面的方法将起作用,并且您不知道为什么对bo:ania的绑定包含在结果集中:

SELECT *
WHERE {
  ?user a rs:user .
  ?user rs:hasRated ?rating .
  ?rating rs:hasRatingDate ?ratngDate .
  FILTER (?ratingDates >= (now() -"P10000F"^^xsd:duration) )
  FILTER (?user != bo:ania)
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM