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

QueryBuilder can build an invalid union-of-one query.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Jena 3.3.0
    • Jena 3.4.0
    • QueryBuilder
    • None

    Description

      From email chain betwen Claude and Andy

      is the union-of-one still legal during the construction of the query?

      Its illegal in a query - UNION is

      {..} UNION {..}

      UNION

      {..}

      The
      expected usage in the builder is:

          builder.addUnion( <select-type-statement> ).addUnion(
          <select-type-statement>)
          

      Currently the code builds a union-of-one and adds the next union to it.

      check to ensure that a union-of-one is not generated in the
      final result.

      At a minimum it an error to generate a union of one.

      So either, throw an expection or generate "

      { pattern }

      " (including inside {}) which is the moral equivalent.

      IMO The second is nicer. Tat is what I changed the formatter to do so at least it generated something even if it is changing the query a bit (round trip checking will fail but then it fails currently as it can't be parsed at all)

      Attachments

        Activity

          People

            claude Claude Warren
            claude Claude Warren
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: