Hello Alexander,
That's my bug. To fix, please apply the attached patch to libsrc/Wi
directory of Virtuoso sources.
Best Regards,
Ivan Mikhailov
OpenLink Software
http://virtuoso.openlinksw.com
On Sun, 2010-04-11 at 15:14 +0700, Alexander Sidorov wrote:
> Hello!
>
> At the moment I'm implementing pagination for my SPARQL queries and I
> can't find out how to retrieve records count. By "count" I mean
> records number that were retrieved if I didn't use OFFSET and LIMIT
> clauses.
>
> Here is my sample query:
>
> prefix events:
> <http://www.semanticweb.org/ontologies/2010/1/Events.owl#>
> SELECT DISTINCT ?event, count(*)
> FROM <http://www.semanticweb.org/ontologies/2010/1/EventsContent.owl#>
> WHERE
> {
> ?event ?property ?value .
> ?event events:startDateTime ?startDateTime .
> FILTER (xsd:dateTime(?startDateTime) >=
> xsd:dateTime("2010-04-11T15:04:58+07:00"))
> }
> ORDER BY ASC (xsd:dateTime(?startDateTime))
> OFFSET 0
> LIMIT 10
>
> In this case count returns value as if no filtering were applied.
Index: xqf.c
===================================================================
RCS file: /home/staff/us-cvs/virtuoso/libsrc/Wi/xqf.c,v
retrieving revision 1.22.2.17
diff -u -U 10 -r1.22.2.17 xqf.c
--- xqf.c 2 Feb 2010 11:25:48 -0000 1.22.2.17
+++ xqf.c 11 Apr 2010 08:30:50 -0000
@@ -3244,21 +3244,21 @@
dtp_t arg_dtp;
caddr_t res = NULL;
long desc_idx;
int flags = 0;
xqf_str_parser_desc_t *desc;
desc_idx = ecm_find_name (p_name, xqf_str_parser_descs,
xqf_str_parser_desc_count, sizeof (xqf_str_parser_desc_t) );
if (ECM_MEM_NOT_FOUND == desc_idx)
sqlr_new_error ("22023", "SR486", "Function xqf_str_parse() does not support XQuery library function '%.300s'", p_name);
desc = xqf_str_parser_descs + desc_idx;
- if (3 >= BOX_ELEMENTS (args))
+ if (3 <= BOX_ELEMENTS (args))
flags = bif_long_arg (qst, args, 2, "xqf_str_parse");
if ((desc->p_can_default) && (1 == BOX_ELEMENTS (args)))
arg = NULL;
else
{
arg = bif_arg_unrdf (qst, args, 1, "xqf_str_parse");
arg_dtp = DV_TYPE_OF (arg);
if (DV_DB_NULL == arg_dtp)
return NEW_DB_NULL;
if (DV_STRING != arg_dtp)