private static Op effectiveOp(Op op) { if (op instanceof OpExt) op = ((OpExt) op).effectiveOp() ; return op ; } }
private Op xform(OpExt op) { try { return op.apply(this); } catch (Exception e) { // May happen if the OpExt doesn't implement apply() return op; } }
protected QueryIterator execute(OpExt opExt, QueryIterator input) { try { QueryIterator qIter = opExt.eval(input, execCxt) ; if (qIter != null) return qIter ; } catch (UnsupportedOperationException ex) {} // null or UnsupportedOperationException throw new QueryExecException("Encountered unsupported OpExt: " + opExt.getName()) ; }
@Override public boolean equalTo(Op obj, NodeIsomorphismMap labelMap) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; OpSparqlViewPattern other = (OpSparqlViewPattern) obj; if (conjunction == null) { if (other.conjunction != null) return false; } else if (!conjunction.equals(other.conjunction)) return false; return true; }
@Override protected void visitExt(OpExt op) { before(op) ; if ( op.effectiveOp() != null ) // Walk the effective op, if present. op.effectiveOp().visit(this); if ( visitor != null ) op.visit(visitor) ; after(op) ; } }
@Override public void visit(OpExt opExt) { // start(opExt, NL) ; opExt.output(out, sContext) ; // finish(opExt) ; }
@Override public void output(IndentedWriter out, SerializationContext sCxt) { int line = out.getRow() ; if ( false ) { // Write in (ext NAME ...) form. WriterLib.start(out, Tags.tagExt, WriterLib.NoNL) ; out.print(getName()) ; out.print(" ") ; outputArgs(out, sCxt) ; WriterLib.finish(out, Tags.tagExt) ; } else { // Write in (NAME ...) form. WriterLib.start(out, tag, WriterLib.NoNL) ; outputArgs(out, sCxt) ; WriterLib.finish(out, tag) ; } if ( line != out.getRow() ) out.ensureStartOfLine() ; }
@Override public boolean equalTo(Op obj, NodeIsomorphismMap labelMap) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; @SuppressWarnings("unchecked") OpViewInstanceJoin<T> other = (OpViewInstanceJoin<T>) obj; if (join == null) { if (other.join != null) return false; } else if (!join.equals(other.join)) return false; return true; } }
@Override public Op transform(OpExt opExt) { Op tmp = opExt.effectiveOp(); Op result = tmp == null ? opExt : tmp; return result; } }
@Override public boolean equalTo(Op obj, NodeIsomorphismMap labelMap) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; OpMapping other = (OpMapping) obj; if (mapping == null) { if (other.mapping != null) return false; } else if (!mapping.equals(other.mapping)) return false; if (restrictions == null) { if (other.restrictions != null) return false; } else if (!restrictions.equals(other.restrictions)) return false; return true; }
@Override public Op transform(OpExt opExt) { return opExt.apply(this, beforeVisitor, afterVisitor) ; }
@Override public Op transform(OpExt opExt) { Op tmp = opExt.effectiveOp(); Op result = tmp == null ? opExt : tmp; return result; } }
@Override public boolean equalTo(Op obj, NodeIsomorphismMap labelMap) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; OpSubQueryExecution other = (OpSubQueryExecution) obj; if (qef == null) { if (other.qef != null) return false; } else if (!qef.equals(other.qef)) return false; if (query == null) { if (other.query != null) return false; } else if (!query.equals(other.query)) return false; return true; } }
public Op apply(Transform transform, OpVisitor before, OpVisitor after) { // Default behaviour is just to pass to apply(transform) return apply(transform) ; }
protected void visitExt(OpExt op) { if ( op.effectiveOp() != null ) op.effectiveOp().visit(this); }
@Override public boolean equalTo(Op obj, NodeIsomorphismMap labelMap) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; OpSubQueryExecution other = (OpSubQueryExecution) obj; if (qef == null) { if (other.qef != null) return false; } else if (!qef.equals(other.qef)) return false; if (query == null) { if (other.query != null) return false; } else if (!query.equals(other.query)) return false; return true; } }
@Override public Op transform(OpExt opExt) { return opExt.apply(this, beforeVisitor, afterVisitor) ; }
@Override public void visit(OpExt opExt) { Op op = opExt.effectiveOp() ; if(op == null) { throw new RuntimeException("Effective Op is null for: " + opExt.getClass()); } // // This does not work in all cases. op.visit(this) ; //throw new ARQNotImplemented("OpExt") ; }
@Override public Op transform(OpExt opExt) { return opExt.apply(this, this.before, this.after); }
@Override public void visit(OpExt opExt) { Op effectiveOp = opExt.effectiveOp(); if(effectiveOp == null) { throw new IllegalArgumentException("Default handing of OpExt requires an effectiveOp"); } effectiveOp.visit(this); VarUsage2 varUsage = opToVarUsage.get(effectiveOp); opToVarUsage.put(opExt, varUsage); }