On 2017-10-09 17:19, Andy Seaborne wrote:
>
>
> On 09/10/17 15:27, George News wrote:
>> On 2017-10-09 12:31, james anderson wrote:
>>> good afternoon;
>>>> On 2017-10-09, at 12:03, George News <[email protected]> wrote:
>>>>
>>>> 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 recommendation describes the intended behaviour here :
>>>
>>>
>>> https://www.w3.org/TR/sparql11-query/#aggregateAlgebra
>>>
>>
>> I guess this is it. If the standard says so, we have to stick to it,
>> although not in favour of that solution.
>
> I haven't convinced myself that Jena is right (I haven't checked -
> virtuos seemed to do the same though which isn't proof but it's a
> completed unconnected implementation) and even if it is, whether the
> spec is saying what it means to say. I don't see different cases for
> COUNT(*) and AnyAgg(?x) because I'd expect them to be different in the
> case of no GROUP BY.
>
> The presence of GROUP BY fundamentally changes the nature of the query.
The thing is that it has no sense to return a empty object. This lead to
some misunderstandings for automation.
>>
>> Does anybody knows a way to avoid loading the whole resultset in memory
>> to check if it has one row and then rewind it to the beginning?
>
> ASK WHERE { pattern }
I have considered this option, but then it implies that the pattern is
checked twice, once for the ASK and then for the SELECT. Performance
wise I don't think it is sensible.
Is it possible to rewind a resultset to the initial pointer without
retrieving everything (not using ResultSetRewindable, for instance)?
> Andy
>
>>
>> Thanks.
>>
>>>
>>>
>>> best regards, from berlin,
>>>
>>>
>>> ---
>>> james anderson | [email protected] | http://dydra.com
>>>
>>>
>>>
>>>
>>>
>>>
>