public void visit(final ASTWindow node, final OperatorConnection connection, final Item graphConstraint) {
ASTType.TYPE dot = ASTType.TYPE.TRIPLES;
int slidingNumber = 10;
Literal iri = null;
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
final Node n = node.jjtGetChild(i);
if (n instanceof ASTType) {
dot = ((ASTType) n).getType();
slidingNumber = ((ASTType) n).getValue();
if(dot == ASTType.TYPE.INSTANCESDURATION || dot == ASTType.TYPE.INSTANCESNUMBER){
iri = ((ASTQuotedURIRef)n.jjtGetChild(0)).getLiteral(true);
}
}
}
final Window window;
switch(dot){
default:
case TRIPLES:
window = new WindowTriples(slidingNumber);
break;
case DURATION:
window = new WindowDuration(slidingNumber);
break;
case INSTANCESNUMBER:
window = new WindowInstancesNumber(slidingNumber, iri);
break;
case INSTANCESDURATION:
window = new WindowInstancesDuration(slidingNumber, iri);
break;
}
if (this.indexScanCreator_Stream.getStream() == null) {
System.out.println("Query uses Window operations, but did not define a stream, asssuming STREAM INTERMEDIATERESULT TRIPLES 1");
final CollectResult cr = new CollectResult(false);
this.result.addApplication(cr);
this.indexScanCreator_Stream.setStream(new StreamTriples(cr, 1));
}
this.indexScanCreator_Stream.getStream().addSucceedingOperator(new OperatorIDTuple(window, 0));
final PatternMatcher currentPatternMatcher = new PatternMatcher();
window.addSucceedingOperator(new OperatorIDTuple(currentPatternMatcher, 0));
final PatternMatcher oldPatternMatcher = this.indexScanCreator_Stream.getCurrentPatternMatcher();
this.indexScanCreator_Stream.setCurrentPatternMatcher(currentPatternMatcher);
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
final Node n = node.jjtGetChild(i);
if (!(n instanceof ASTType)) {
n.accept(this, connection, graphConstraint);
}
}
this.indexScanCreator_Stream.setCurrentPatternMatcher(oldPatternMatcher);
}