On 22/03/12 19:50, Diogo FC Patrao wrote:
I believe it is partially implemented in Virtuoso but doesn't use the
SAMPLE keyword currently, I think you have to use the special term
sql:sample currently
you're right, that just worked! Thanks!
dfcp
Diogo - glad you got it working.
It changed from 2.8.1 to 2.8.8 because SPARQL formalised
group/aggregation and ARQ followed that.
The subquery way is quite neat - it's effectively BIND.
I see. It's different from RDBs that treat grouped expressions as columns
and hence could be used as such.
Well - that depends on the database - there is a lot of variation
between different databases. A lot.
SPARQL follows the SQL-92 standard as we understood it. We also found
that very few databases follow it! The smaller, e.g. pure java ones are
more compliant than the majors. MySQL is non-deterministically bizarre
in this area - actually it is deterministic in undocumented ways that
people now rely on.
Internally, ARQ does assign a GROUP BY aggregate expression to variable
and all uses of an expression could be checked to see if it matches that
expression - but it gets funky if you expect (?y+?x) to be (?x+?y). All
of a sudden, the amount of searching needed to test for equivalence
grows quickly with the size and number of expressions.
In SPARQL you can name the GROUP BY expression:
GROUP BY (?x+?y as ?z)
which is the compromise.
As for Virtuoso's SPARQL 1.1 support, it's patchy coverage is causing
people problems.
I presume you're using the remote SPARQL query engine, which parses the
query to check it client-side before sending it.
If you need to get non-SPARQL 1.1 syntax through to Virtuoso, you could
call the constructor QueryEngineHTTP(String, String) directly that takes
the query string directly and not a Query object.
Or make a HTTP call directly, and pass the result stream straight into a
ResultSetFactory operation to parse the results.
Andy