@Override
 protected void details(IndentedWriter out, SerializationContext sCxt) {
   out.println(Utils.className(this));
   out.incIndent();
   op.output(out, sCxt);
   out.decIndent();
 }
 QueryIterator exec(Op op, QueryIterator input) {
   push(input);
   int x = stack.size();
   op.visit(this);
   int y = stack.size();
   if (x != y) Log.warn(this, "Possible stack misalignment");
   QueryIterator qIter = pop();
   return qIter;
 }
Пример #3
0
 /**
  * This method controls whether any binding in given binding list is service
  *
  * @param op
  * @param bindingList
  * @return
  */
 private static boolean controlWhetherBindingIsService(Op op, List<Binding> bindingList) {
   // try to cast Op value to OpService
   OpService opService = null;
   if (op.getClass().asSubclass(OpService.class).equals(OpService.class)) {
     opService = (OpService) op;
   }
   // if casting is successful control service is variable and service
   // variable is binding variable
   if (opService != null && isServiceVariable(opService) && bindingList.size() > 0) {
     BindingMap binding = (BindingMap) bindingList.get(0);
     List<Var> varList = generateVarList(binding.vars());
     Var var = varList.get(0);
     Node serviceNode = binding.get(var);
     if (serviceNode != null) {
       return true;
     }
   }
   return false;
 }
Пример #4
0
  public static ExprList collectExprs(Op op, ExprList result) {
    if (op instanceof OpLeftJoin) {
      OpLeftJoin x = (OpLeftJoin) op;

      if (x.getExprs() != null) {
        result.addAll(x.getExprs());
      }

      collectExprs(x.getLeft(), result);
      collectExprs(x.getRight(), result);
    } else if (op instanceof OpFilter) {
      OpFilter x = (OpFilter) op;
      result.addAll(x.getExprs());
      collectExprs(x.getSubOp(), result);
    } else if (op instanceof OpJoin) {
      OpJoin x = (OpJoin) op;

      collectExprs(x.getLeft(), result);
      collectExprs(x.getRight(), result);
    } else if (op instanceof OpUnion) {
      System.out.println(
          "Warning: Collecting expressions from unions. Since the same vars may appear within different (parts of) unions, it may be ambiguous to which part the expression refers.");

      OpUnion x = (OpUnion) op;

      collectExprs(x.getLeft(), result);
      collectExprs(x.getRight(), result);
    } else if (op instanceof OpQuadPattern) {

    } else if (op instanceof OpSequence) {
      OpSequence x = (OpSequence) op;
      for (Op element : x.getElements()) {
        collectExprs(element, result);
      }
    } else {
      throw new RuntimeException("Not implemented. Type: " + op.getClass());
    }

    return result;
  }
 protected Table eval(Op op) {
   op.visit(this);
   return pop();
 }