StatementPattern.Scope scope = StatementPattern.Scope.DEFAULT_CONTEXTS;
Var contextVar = null;
if (node.hasContextID()) {
scope = StatementPattern.Scope.NAMED_CONTEXTS;
ValueExpr contextID = (ValueExpr)node.getContextID().jjtAccept(this, null);
if (contextID instanceof Var) {
contextVar = (Var)contextID;
}
else if (contextID instanceof ValueConstant) {
ValueConstant vc = (ValueConstant)contextID;
contextVar = createConstantVar(vc.getValue());
}
else {
throw new IllegalArgumentException("Unexpected contextID result type: " + contextID.getClass());
}
}
graphPattern.setStatementPatternScope(scope);
graphPattern.setContextVar(contextVar);