コード例 #1
0
ファイル: OpRewriter.java プロジェクト: apache/jena
 /** rewrites the subop of assign. */
 @Override
 public void visit(final OpAssign opAssign) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpAssign");
   }
   addOp(OpAssign.assign(rewriteOp1(opAssign), opAssign.getVarExprList()));
 }
コード例 #2
0
    @Override
    public Op transform(OpGraph opGraph, Op op) {
      // ?? Could just leave the (graph) in place always - just rewrite BGPs.
      boolean noPattern = false;

      /* One case to consider is when the pattern for the GRAPH
       * statement includes uses the variable inside the GRAPH clause.
       * In this case, we must rename away the inner variable
       * to allow stream execution via index joins,
       * and then put back the value via an assign.
       * (This is what QueryIterGraph does using a streaming join
       * for triples)
       */

      // Note: op is already quads by this point.
      // Must test scoping by the subOp of GRAPH

      QuadSlot qSlot = tracker.peek();
      Node actualName = qSlot.actualGraphName;
      Node rewriteName = qSlot.rewriteGraphName;

      if (OpBGP.isBGP(op)) {
        // Empty BGP
        if (((OpBGP) op).getPattern().isEmpty()) noPattern = true;
      } else if (op instanceof OpTable) {
        // Empty BGP compiled to a unit table
        if (((OpTable) op).isJoinIdentity()) noPattern = true;
      }

      if (noPattern) {
        // The case of something like:
        // GRAPH ?g {} or GRAPH <v> {}
        // which are ways of accessing the names in the dataset.
        return new OpDatasetNames(opGraph.getNode());
      }

      if (actualName != rewriteName)
        op = OpAssign.assign(op, Var.alloc(actualName), new ExprVar(rewriteName));

      // Drop (graph...) because inside nodes
      // have been converted to quads.
      return op;
    }
コード例 #3
0
 public void visit(OpAssign opAssign) {
   Table table = eval(opAssign.getSubOp());
   table = evaluator.assign(table, opAssign.getVarExprList());
   push(table);
 }