On 2017-10-09 11:53, Lorenz Buehmann wrote: > > > On 09.10.2017 10:22, George News wrote: >> Hi all, >> >> Here it goes. The MWE is below. >> >> As you can see when I execute Q_without.rq I get an empty array in >> bindings. However with Qmax_without.rq I get {} (empty object) in >> bindings. >> >> What I'm saying is that if I'm getting nothing when listing the >> matching entities, I don't know why I get an empty object when >> listing the matching entities with an aggregate operation like MAX. >> > Well, I guess Andy already gave you the answer in the beginning of > the thread: A query with an aggregate always returns a row by > convention. But compared to the aggregate function COUNT which simply > can return 0 then, MAX can't return any concrete value because the > MAX of nothing is not specified.
I understood it, but I don't agree with this behaviour. Is this in the standard or is it just Jena behaviour? The issue here is that returning a row in the resultset in something that leads to misunderstanding, as it seems there is a result available when there isn't. In this sense, if there were a procedure to know in advance that the object is empty, it will be ok, but you don't know it is empty till you call next() and try to get the actual value. In that case, if you want to print it you cannot rewind (if not stored everything in memmory). This is just my humble opinion on the issue. Nothing is nothing and not one row although empty ;) Thanks a lot for your understanding. Regards, Jorge >> My opinion is that it should be an empty resultset as there is >> nothing matching. That is, I cannot the max of nothing. >> >> Hope now it is clear, and sorry for this long thread. >> >> Regards, Jorge >> >> [...snip...]