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

OpAsQuery can move sub-query modifiers onto outer query

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • Jena 2.13.0
    • Jena 3.0.0
    • ARQ
    • None

    Description

      Reported on the mailing list:

      http://s.apache.org/jena-algebra-roundtripping-bug

      Some queries roundtrip incorrectly through the Algebra.compile() to OpAsQuery.asQuery() flow e.g.

      SELECT (COUNT(*) as ?count) {
        SELECT DISTINCT ?uri ?graph WHERE {
          GRAPH ?graph {
            ?uri ?p ?o .
            }
          } LIMIT 1
      }
      

      Produces algebra:

      project (?tripod_count_var)
        (extend ((?tripod_count_var ?.0))
          (group () ((?.0 (count)))
            (distinct
              (project (?uri ?graph)
                (graph ?graph
                  (bgp (triple ?uri ?p ?o))))))))
      

      Which round trips back to:

      SELECT DISTINCT  (count(*) AS ?tripod_count_var)
      WHERE
        { { SELECT  ?uri ?graph
            WHERE
              { GRAPH ?graph
                  { ?uri ?p ?o}
              }
          }
        }
      

      Note that the DISTINCT was incorrectly moved to the outer query

      The problem is that the conversion does not correct cope with the case of being within a project and needs to spawn a sub-converter to cope as OpProject already does

      Attachments

        1. Jena_954_Report.java
          2 kB
          Andy Seaborne

        Activity

          People

            rvesse Rob Vesse
            rvesse Rob Vesse
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: