Uploaded image for project: 'Blazegraph (by SYSTAP)'
  1. Blazegraph (by SYSTAP)
  2. BLZG-761

Doubly nested subqueries yield no results with LIMIT

    Details

      Description

      The ?nested query? bug can be tickled with a very small data set. I used this one:

      INSERT DATA
      {

      <http://example.com/book1> a <http://example.com/Book> .

      <http://example.com/book2> a <http://example.com/Book> .

      <http://example.com/book3> a <http://example.com/Book> .

      }

      The following queries yield these results:

      SELECT ?s
      WHERE { ?s ?p ?o} LIMIT 1

      Yields:
      s
      http://example.com/book1

      and

      SELECT ?s
      WHERE

      { {SELECT ?s WHERE \{ ?s ?p ?o} LIMIT 1}
      }


      yields:
      s
      http://example.com/book1

      These are all correct.

      But



      SELECT ?s WHERE {
      {
      SELECT ?s WHERE {{SELECT ?sWHERE { ?s ?p ?o}

      LIMIT 1
      }
      }
      }
      }

      Yields no results.

      Using the same data set in Jena yields the same answer for all three examples, as desired

        Activity

        Hide
        mikepersonick mikepersonick added a comment -

        The ASTSparql11SubqueryOptimizer was not properly recursing into nested Sparql 11 subqueries.

        Changed the recursion code to check for nested subqueries:

        if (child instanceof GraphPatternGroup<?>) {

        /*

        • Note: Do recursion before we do the rewrite so we will
        • rewrite Sub-Sub-Selects.
        • FIXME Unit test for sub-sub-select optimization.
          */
          liftSubqueries(context, sa,
          ((GraphPatternGroup<IGroupMemberNode>) child));

        } else if (child instanceof SubqueryRoot) {

        // Recursion into subqueries.

        final SubqueryRoot subqueryRoot = (SubqueryRoot) child;

        liftSubqueries(context, sa,
        subqueryRoot.getWhereClause());

        }

        Show
        mikepersonick mikepersonick added a comment - The ASTSparql11SubqueryOptimizer was not properly recursing into nested Sparql 11 subqueries. Changed the recursion code to check for nested subqueries: if (child instanceof GraphPatternGroup<?>) { /* Note: Do recursion before we do the rewrite so we will rewrite Sub-Sub-Selects. FIXME Unit test for sub-sub-select optimization. */ liftSubqueries(context, sa, ((GraphPatternGroup<IGroupMemberNode>) child)); } else if (child instanceof SubqueryRoot) { // Recursion into subqueries. final SubqueryRoot subqueryRoot = (SubqueryRoot) child; liftSubqueries(context, sa, subqueryRoot.getWhereClause()); }

          People

          • Assignee:
            mikepersonick mikepersonick
            Reporter:
            mikepersonick mikepersonick
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: