This query
prefix : <http://example.org/>
select ?x ?y where {
values (?x ?y) {
(1 2)
(1 UNDEF )
}
}
produces
---------
| x | y |
=========
| 1 | |
| 1 | 2 |
---------
because in the ordering, the UNDEF ?y comes before the 2 ?y. As such,
I'd expect that if I were to group by ?x and have the aggregate set
for ?y = { UNDEF, 2 } and select max(?y) that I should get 2.
However, this query
order by ?x ?y
prefix : <http://example.org/>
select ?x (max(?y) as ?maxY) where {
values (?x ?y) {
(1 2)
(1 UNDEF)
}
}
group by ?x
order by ?x
which does just that, produces:
------------
| x | maxY |
============
| 1 | |
------------
Am I misunderstanding how max [1] works? The spec says that max makes
use of the ORDER BY ordering, so I'm surprised by these results. Have
I missed something?
Thanks,
//JT
[1] http://www.w3.org/TR/sparql11-query/#defn_aggMax
--
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/