[ 
https://issues.apache.org/jira/browse/JENA-1487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Stadler updated JENA-1487:
--------------------------------
    Description: 
Ordering an empty result set must not introduce additional bindings, but this 
happens with the following example (run on an arbitrary dataset - including an 
empty one):

{code:bash}
./fuseki-server --file=test.ttl /foobar
{code}

The Json below is obtained from the Fuski bundle; but I noted this issue first 
using the ARQ API, where the result set contains a single BindingProjectNamed 
instance.

{code:sql}
SELECT ?s
WHERE {
  ?s ?p ?o
  FILTER(false)
}
GROUP BY ?s
ORDER BY DESC(COUNT(?o))
{code}

{code:json}
{
  "head": {
    "vars": [ "s" ]
  } ,
  "results": {
    "bindings": [
      {
# NOTE THIS EMPTY BINDING HERE!        
      }
    ]
  }
}
{code}


The result set is correct without the ORDER BY:

{code:sql}
SELECT ?s
WHERE {
  ?s ?p ?o
  FILTER(false)
}
GROUP BY ?s
{code}

{code:json}
{
  "head": {
    "vars": [ "s" ]
  } ,
  "results": {
    "bindings": [
# CORRECT      
    ]
  }
}
{code}

  was:
Ordering an empty result set must not introduce additional bindings, but this 
happens with the following example (run on an arbitrary dataset - including an 
empty one):

{code:bash}
./fuseki-server --file=test.ttl /foobar
{code}

The Json below is obtained from the Fuski bundle; I could figure out that using 
the ARQ API, the result set contains a single BindingProjectNamed instance, but 
I did not investigate any deeper.

{code:sql}
SELECT ?s
WHERE {
  ?s ?p ?o
  FILTER(false)
}
GROUP BY ?s
ORDER BY DESC(COUNT(?o))
{code}

{code:json}
{
  "head": {
    "vars": [ "s" ]
  } ,
  "results": {
    "bindings": [
      {
# NOTE THIS EMPTY BINDING HERE!        
      }
    ]
  }
}
{code}


The result set is correct without the ORDER BY:

{code:sql}
SELECT ?s
WHERE {
  ?s ?p ?o
  FILTER(false)
}
GROUP BY ?s
{code}

{code:json}
{
  "head": {
    "vars": [ "s" ]
  } ,
  "results": {
    "bindings": [
# CORRECT      
    ]
  }
}
{code}


> Incorrect SPARQL query result set when applying ORDER BY after an empty GROUP 
> BY
> --------------------------------------------------------------------------------
>
>                 Key: JENA-1487
>                 URL: https://issues.apache.org/jira/browse/JENA-1487
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: ARQ
>    Affects Versions: Jena 3.6.0
>            Reporter: Claus Stadler
>            Priority: Major
>
> Ordering an empty result set must not introduce additional bindings, but this 
> happens with the following example (run on an arbitrary dataset - including 
> an empty one):
> {code:bash}
> ./fuseki-server --file=test.ttl /foobar
> {code}
> The Json below is obtained from the Fuski bundle; but I noted this issue 
> first using the ARQ API, where the result set contains a single 
> BindingProjectNamed instance.
> {code:sql}
> SELECT ?s
> WHERE {
>   ?s ?p ?o
>   FILTER(false)
> }
> GROUP BY ?s
> ORDER BY DESC(COUNT(?o))
> {code}
> {code:json}
> {
>   "head": {
>     "vars": [ "s" ]
>   } ,
>   "results": {
>     "bindings": [
>       {
> # NOTE THIS EMPTY BINDING HERE!        
>       }
>     ]
>   }
> }
> {code}
> The result set is correct without the ORDER BY:
> {code:sql}
> SELECT ?s
> WHERE {
>   ?s ?p ?o
>   FILTER(false)
> }
> GROUP BY ?s
> {code}
> {code:json}
> {
>   "head": {
>     "vars": [ "s" ]
>   } ,
>   "results": {
>     "bindings": [
> # CORRECT      
>     ]
>   }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to