Why filter doesn't work in this context?

孤人 提交于 2019-12-12 20:57:19

问题


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?

However, if I remove the widecard and select just the users ?user, bo:ania doesn't appear

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.


回答1:


?specificUser is bound to bo:ania by your VALUES statement. ?user is an entirely different binding defined by the other triple patterns. 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.

BTW, there isn't a need to use VALUES in this case unless you want to inspect multiple 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:

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


来源:https://stackoverflow.com/questions/36724188/why-filter-doesnt-work-in-this-context

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!