Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-1487

Incorrect SPARQL query result set when applying ORDER BY after an empty GROUP BY

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • Jena 3.6.0
    • None
    • ARQ
    • None

    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):

      ./fuseki-server --file=test.ttl /foobar
      

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

      SELECT ?s
      WHERE {
        ?s ?p ?o
        FILTER(false)
      }
      GROUP BY ?s
      ORDER BY DESC(COUNT(?o))
      
      {
        "head": {
          "vars": [ "s" ]
        } ,
        "results": {
          "bindings": [
            {
      # NOTE THIS EMPTY BINDING HERE!        
            }
          ]
        }
      }
      

      The result set is correct without the ORDER BY:

      SELECT ?s
      WHERE {
        ?s ?p ?o
        FILTER(false)
      }
      GROUP BY ?s
      
      {
        "head": {
          "vars": [ "s" ]
        } ,
        "results": {
          "bindings": [
      # CORRECT      
          ]
        }
      }
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Aklakan Claus Stadler
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: