Hi all,
I am executing a SPARQL with MAX aggregate function and I'm facing a
strange behaviour, or at least I think it is.
The snipset of the select variables is the following:
select ?id (MAX(?ti) as ?time) ?value ?latitude ?longitude
where {
......
}
If I launch the SPARQL query and there are results matching there is no
problem and I get the expected answer.
However if I launch the same query over another database and there
should be no match I get the following:
{
"head": {
"vars": [
"id", "time", "value", "latitude", "longitude"
]
},
"results": {
"bindings": [
{}
]
}
}
As you can see, although the resultset seems to be empty it is not. It
is returning one empty object. Actually by checking resultset.hasNext()
within the code it returns true.
If I remove the MAX function from the variables everything is ok, and no
empty object shows up.
select ?id ?value ?latitude ?longitude
where {
......
}
----------
{
"head": {
"vars": [
"id", "value", "latitude", "longitude"
]
},
"results": {
"bindings": [
{}
]
}
}
Why is happening that? Is this the expected behaviour? I guess it
shouldn't. When you use COUNT funtion it returns 0, but MIN/MAX/etc arer
different functions and if there is no result nothing should appear.
Any help/tip is more than welcome.
Regards,
Jorge