hql.g:232:1: queryRule : selectFrom ( whereClause )? ( groupByClause )? ( havingClause )? ( orderByClause )? ( skipClause )? ( takeClause )? ;
518887
public final hqlParser.queryRule_return queryRule() throws RecognitionException {
		hqlParser.queryRule_return retval = new hqlParser.queryRule_return();
		retval.start = input.LT(1);

		CommonTree root_0 = null;

		ParserRuleReturnScope selectFrom38 =null;
		ParserRuleReturnScope whereClause39 =null;
		ParserRuleReturnScope groupByClause40 =null;
		ParserRuleReturnScope havingClause41 =null;
		ParserRuleReturnScope orderByClause42 =null;
		ParserRuleReturnScope skipClause43 =null;
		ParserRuleReturnScope takeClause44 =null;


		try {
			// hql.g:233:2: ( selectFrom ( whereClause )? ( groupByClause )? ( havingClause )? ( orderByClause )? ( skipClause )? ( takeClause )? )
			// hql.g:233:4: selectFrom ( whereClause )? ( groupByClause )? ( havingClause )? ( orderByClause )? ( skipClause )? ( takeClause )?
			{
			root_0 = (CommonTree)adaptor.nil();


			pushFollow(FOLLOW_selectFrom_in_queryRule904);
			selectFrom38=selectFrom();
			state._fsp--;

			adaptor.addChild(root_0, selectFrom38.getTree());

			// hql.g:234:3: ( whereClause )?
			int alt9=2;
			int LA9_0 = input.LA(1);
			if ( (LA9_0==WHERE) ) {
				alt9=1;
			}
			switch (alt9) {
				case 1 :
					// hql.g:234:4: whereClause
					{
					pushFollow(FOLLOW_whereClause_in_queryRule909);
					whereClause39=whereClause();
					state._fsp--;

					adaptor.addChild(root_0, whereClause39.getTree());

					}
					break;

			}

			// hql.g:235:3: ( groupByClause )?
			int alt10=2;
			int LA10_0 = input.LA(1);
			if ( (LA10_0==GROUP) ) {
				alt10=1;
			}
			switch (alt10) {
				case 1 :
					// hql.g:235:4: groupByClause
					{
					pushFollow(FOLLOW_groupByClause_in_queryRule916);
					groupByClause40=groupByClause();
					state._fsp--;

					adaptor.addChild(root_0, groupByClause40.getTree());

					}
					break;

			}

			// hql.g:236:3: ( havingClause )?
			int alt11=2;
			int LA11_0 = input.LA(1);
			if ( (LA11_0==HAVING) ) {
				alt11=1;
			}
			switch (alt11) {
				case 1 :
					// hql.g:236:4: havingClause
					{
					pushFollow(FOLLOW_havingClause_in_queryRule923);
					havingClause41=havingClause();
					state._fsp--;

					adaptor.addChild(root_0, havingClause41.getTree());

					}
					break;

			}

			// hql.g:237:3: ( orderByClause )?
			int alt12=2;
			int LA12_0 = input.LA(1);
			if ( (LA12_0==ORDER) ) {
				alt12=1;
			}
			switch (alt12) {
				case 1 :
					// hql.g:237:4: orderByClause
					{
					pushFollow(FOLLOW_orderByClause_in_queryRule930);
					orderByClause42=orderByClause();
					state._fsp--;

					adaptor.addChild(root_0, orderByClause42.getTree());

					}
					break;

			}

			// hql.g:238:3: ( skipClause )?
			int alt13=2;
			int LA13_0 = input.LA(1);
			if ( (LA13_0==SKIP) ) {
				alt13=1;
			}
			switch (alt13) {
				case 1 :
					// hql.g:238:4: skipClause
					{
					pushFollow(FOLLOW_skipClause_in_queryRule937);
					skipClause43=skipClause();
					state._fsp--;

					adaptor.addChild(root_0, skipClause43.getTree());

					}
					break;

			}

			// hql.g:239:3: ( takeClause )?
			int alt14=2;
			int LA14_0 = input.LA(1);
			if ( (LA14_0==TAKE) ) {
				alt14=1;
			}
			switch (alt14) {
				case 1 :
					// hql.g:239:4: takeClause
					{
					pushFollow(FOLLOW_takeClause_in_queryRule944);
					takeClause44=takeClause();
					state._fsp--;

					adaptor.addChild(root_0, takeClause44.getTree());

					}
					break;

			}

			}

			retval.stop = input.LT(-1);

			retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
			adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
			retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
		}
		finally {
			// do for sure before leaving
		}
		return retval;
	}
786708
public final hqlParser.fromClause_return fromClause() throws RecognitionException {
		hqlParser.fromClause_return retval = new hqlParser.fromClause_return();
		retval.start = input.LT(1);

		CommonTree root_0 = null;

		Token FROM58=null;
		Token COMMA61=null;
		ParserRuleReturnScope fromRange59 =null;
		ParserRuleReturnScope fromJoin60 =null;
		ParserRuleReturnScope fromRange62 =null;

		CommonTree FROM58_tree=null;
		CommonTree COMMA61_tree=null;

		try {
			// hql.g:276:2: ( FROM ^ fromRange ( fromJoin | COMMA ! fromRange )* )
			// hql.g:276:4: FROM ^ fromRange ( fromJoin | COMMA ! fromRange )*
			{
			root_0 = (CommonTree)adaptor.nil();


			FROM58=(Token)match(input,FROM,FOLLOW_FROM_in_fromClause1121);
			FROM58_tree = (CommonTree)adaptor.create(FROM58);
			root_0 = (CommonTree)adaptor.becomeRoot(FROM58_tree, root_0);

			 WeakKeywords();
			pushFollow(FOLLOW_fromRange_in_fromClause1126);
			fromRange59=fromRange();
			state._fsp--;

			adaptor.addChild(root_0, fromRange59.getTree());

			// hql.g:276:40: ( fromJoin | COMMA ! fromRange )*
			loop19:
			while (true) {
				int alt19=3;
				int LA19_0 = input.LA(1);
				if ( (LA19_0==FULL||LA19_0==INNER||LA19_0==JOIN||LA19_0==LEFT||LA19_0==RIGHT) ) {
					alt19=1;
				}
				else if ( (LA19_0==COMMA) ) {
					alt19=2;
				}

				switch (alt19) {
				case 1 :
					// hql.g:276:42: fromJoin
					{
					pushFollow(FOLLOW_fromJoin_in_fromClause1130);
					fromJoin60=fromJoin();
					state._fsp--;

					adaptor.addChild(root_0, fromJoin60.getTree());

					}
					break;
				case 2 :
					// hql.g:276:53: COMMA ! fromRange
					{
					COMMA61=(Token)match(input,COMMA,FOLLOW_COMMA_in_fromClause1134);
					 WeakKeywords();
					pushFollow(FOLLOW_fromRange_in_fromClause1139);
					fromRange62=fromRange();
					state._fsp--;

					adaptor.addChild(root_0, fromRange62.getTree());

					}
					break;

				default :
					break loop19;
				}
			}

			}

			retval.stop = input.LT(-1);

			retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
			adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
			retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
		}
		finally {
			// do for sure before leaving
		}
		return retval;
	}
382445
@Override
    public void _openSubclause() {
        _currentClauseDepth++;

        List<QueryToken> tokens = getCurrentWhereTokens();
        appendOperatorIfNeeded(tokens);
        negateIfNeeded(tokens, null);

        tokens.add(OpenSubclauseToken.INSTANCE);
    }
207860
@Override
	public void mTokens() throws RecognitionException {
		// hql.g:1:8: ( ALL | AND | ANY | AS | ASCENDING | AVG | BETWEEN | BOTH | CASE | CLASS | COUNT | DELETE | DESCENDING | DISTINCT | ELEMENTS | ELSE | EMPTY | END | ESCAPE | EXISTS | FALSE | FETCH | FROM | FULL | GROUP | HAVING | IN | INDICES | INNER | INSERT | INTO | IS | JOIN | LEADING | LEFT | LIKE | LITERAL_by | MAX | MEMBER | MIN | NEW | NOT | NULL | OBJECT | OF | ON | OR | ORDER | OUTER | PROPERTIES | RIGHT | SELECT | SET | SKIP | SOME | SUM | TAKE | THEN | TRAILING | TRUE | UNION | UPDATE | VERSIONED | WHEN | WHERE | WITH | T__133 | T__134 | EQ | LT | GT | SQL_NE | NE | LE | GE | BOR | BXOR | BAND | BNOT | COMMA | OPEN | CLOSE | OPEN_BRACKET | CLOSE_BRACKET | CONCAT | PLUS | MINUS | STAR | DIV | COLON | PARAM | IDENT | QUOTED_String | WS | NUM_INT )
		int alt23=95;
		alt23 = dfa23.predict(input);
		switch (alt23) {
			case 1 :
				// hql.g:1:10: ALL
				{
				mALL(); if (state.failed) return;

				}
				break;
			case 2 :
				// hql.g:1:14: AND
				{
				mAND(); if (state.failed) return;

				}
				break;
			case 3 :
				// hql.g:1:18: ANY
				{
				mANY(); if (state.failed) return;

				}
				break;
			case 4 :
				// hql.g:1:22: AS
				{
				mAS(); if (state.failed) return;

				}
				break;
			case 5 :
				// hql.g:1:25: ASCENDING
				{
				mASCENDING(); if (state.failed) return;

				}
				break;
			case 6 :
				// hql.g:1:35: AVG
				{
				mAVG(); if (state.failed) return;

				}
				break;
			case 7 :
				// hql.g:1:39: BETWEEN
				{
				mBETWEEN(); if (state.failed) return;

				}
				break;
			case 8 :
				// hql.g:1:47: BOTH
				{
				mBOTH(); if (state.failed) return;

				}
				break;
			case 9 :
				// hql.g:1:52: CASE
				{
				mCASE(); if (state.failed) return;

				}
				break;
			case 10 :
				// hql.g:1:57: CLASS
				{
				mCLASS(); if (state.failed) return;

				}
				break;
			case 11 :
				// hql.g:1:63: COUNT
				{
				mCOUNT(); if (state.failed) return;

				}
				break;
			case 12 :
				// hql.g:1:69: DELETE
				{
				mDELETE(); if (state.failed) return;

				}
				break;
			case 13 :
				// hql.g:1:76: DESCENDING
				{
				mDESCENDING(); if (state.failed) return;

				}
				break;
			case 14 :
				// hql.g:1:87: DISTINCT
				{
				mDISTINCT(); if (state.failed) return;

				}
				break;
			case 15 :
				// hql.g:1:96: ELEMENTS
				{
				mELEMENTS(); if (state.failed) return;

				}
				break;
			case 16 :
				// hql.g:1:105: ELSE
				{
				mELSE(); if (state.failed) return;

				}
				break;
			case 17 :
				// hql.g:1:110: EMPTY
				{
				mEMPTY(); if (state.failed) return;

				}
				break;
			case 18 :
				// hql.g:1:116: END
				{
				mEND(); if (state.failed) return;

				}
				break;
			case 19 :
				// hql.g:1:120: ESCAPE
				{
				mESCAPE(); if (state.failed) return;

				}
				break;
			case 20 :
				// hql.g:1:127: EXISTS
				{
				mEXISTS(); if (state.failed) return;

				}
				break;
			case 21 :
				// hql.g:1:134: FALSE
				{
				mFALSE(); if (state.failed) return;

				}
				break;
			case 22 :
				// hql.g:1:140: FETCH
				{
				mFETCH(); if (state.failed) return;

				}
				break;
			case 23 :
				// hql.g:1:146: FROM
				{
				mFROM(); if (state.failed) return;

				}
				break;
			case 24 :
				// hql.g:1:151: FULL
				{
				mFULL(); if (state.failed) return;

				}
				break;
			case 25 :
				// hql.g:1:156: GROUP
				{
				mGROUP(); if (state.failed) return;

				}
				break;
			case 26 :
				// hql.g:1:162: HAVING
				{
				mHAVING(); if (state.failed) return;

				}
				break;
			case 27 :
				// hql.g:1:169: IN
				{
				mIN(); if (state.failed) return;

				}
				break;
			case 28 :
				// hql.g:1:172: INDICES
				{
				mINDICES(); if (state.failed) return;

				}
				break;
			case 29 :
				// hql.g:1:180: INNER
				{
				mINNER(); if (state.failed) return;

				}
				break;
			case 30 :
				// hql.g:1:186: INSERT
				{
				mINSERT(); if (state.failed) return;

				}
				break;
			case 31 :
				// hql.g:1:193: INTO
				{
				mINTO(); if (state.failed) return;

				}
				break;
			case 32 :
				// hql.g:1:198: IS
				{
				mIS(); if (state.failed) return;

				}
				break;
			case 33 :
				// hql.g:1:201: JOIN
				{
				mJOIN(); if (state.failed) return;

				}
				break;
			case 34 :
				// hql.g:1:206: LEADING
				{
				mLEADING(); if (state.failed) return;

				}
				break;
			case 35 :
				// hql.g:1:214: LEFT
				{
				mLEFT(); if (state.failed) return;

				}
				break;
			case 36 :
				// hql.g:1:219: LIKE
				{
				mLIKE(); if (state.failed) return;

				}
				break;
			case 37 :
				// hql.g:1:224: LITERAL_by
				{
				mLITERAL_by(); if (state.failed) return;

				}
				break;
			case 38 :
				// hql.g:1:235: MAX
				{
				mMAX(); if (state.failed) return;

				}
				break;
			case 39 :
				// hql.g:1:239: MEMBER
				{
				mMEMBER(); if (state.failed) return;

				}
				break;
			case 40 :
				// hql.g:1:246: MIN
				{
				mMIN(); if (state.failed) return;

				}
				break;
			case 41 :
				// hql.g:1:250: NEW
				{
				mNEW(); if (state.failed) return;

				}
				break;
			case 42 :
				// hql.g:1:254: NOT
				{
				mNOT(); if (state.failed) return;

				}
				break;
			case 43 :
				// hql.g:1:258: NULL
				{
				mNULL(); if (state.failed) return;

				}
				break;
			case 44 :
				// hql.g:1:263: OBJECT
				{
				mOBJECT(); if (state.failed) return;

				}
				break;
			case 45 :
				// hql.g:1:270: OF
				{
				mOF(); if (state.failed) return;

				}
				break;
			case 46 :
				// hql.g:1:273: ON
				{
				mON(); if (state.failed) return;

				}
				break;
			case 47 :
				// hql.g:1:276: OR
				{
				mOR(); if (state.failed) return;

				}
				break;
			case 48 :
				// hql.g:1:279: ORDER
				{
				mORDER(); if (state.failed) return;

				}
				break;
			case 49 :
				// hql.g:1:285: OUTER
				{
				mOUTER(); if (state.failed) return;

				}
				break;
			case 50 :
				// hql.g:1:291: PROPERTIES
				{
				mPROPERTIES(); if (state.failed) return;

				}
				break;
			case 51 :
				// hql.g:1:302: RIGHT
				{
				mRIGHT(); if (state.failed) return;

				}
				break;
			case 52 :
				// hql.g:1:308: SELECT
				{
				mSELECT(); if (state.failed) return;

				}
				break;
			case 53 :
				// hql.g:1:315: SET
				{
				mSET(); if (state.failed) return;

				}
				break;
			case 54 :
				// hql.g:1:319: SKIP
				{
				mSKIP(); if (state.failed) return;

				}
				break;
			case 55 :
				// hql.g:1:324: SOME
				{
				mSOME(); if (state.failed) return;

				}
				break;
			case 56 :
				// hql.g:1:329: SUM
				{
				mSUM(); if (state.failed) return;

				}
				break;
			case 57 :
				// hql.g:1:333: TAKE
				{
				mTAKE(); if (state.failed) return;

				}
				break;
			case 58 :
				// hql.g:1:338: THEN
				{
				mTHEN(); if (state.failed) return;

				}
				break;
			case 59 :
				// hql.g:1:343: TRAILING
				{
				mTRAILING(); if (state.failed) return;

				}
				break;
			case 60 :
				// hql.g:1:352: TRUE
				{
				mTRUE(); if (state.failed) return;

				}
				break;
			case 61 :
				// hql.g:1:357: UNION
				{
				mUNION(); if (state.failed) return;

				}
				break;
			case 62 :
				// hql.g:1:363: UPDATE
				{
				mUPDATE(); if (state.failed) return;

				}
				break;
			case 63 :
				// hql.g:1:370: VERSIONED
				{
				mVERSIONED(); if (state.failed) return;

				}
				break;
			case 64 :
				// hql.g:1:380: WHEN
				{
				mWHEN(); if (state.failed) return;

				}
				break;
			case 65 :
				// hql.g:1:385: WHERE
				{
				mWHERE(); if (state.failed) return;

				}
				break;
			case 66 :
				// hql.g:1:391: WITH
				{
				mWITH(); if (state.failed) return;

				}
				break;
			case 67 :
				// hql.g:1:396: T__133
				{
				mT__133(); if (state.failed) return;

				}
				break;
			case 68 :
				// hql.g:1:403: T__134
				{
				mT__134(); if (state.failed) return;

				}
				break;
			case 69 :
				// hql.g:1:410: EQ
				{
				mEQ(); if (state.failed) return;

				}
				break;
			case 70 :
				// hql.g:1:413: LT
				{
				mLT(); if (state.failed) return;

				}
				break;
			case 71 :
				// hql.g:1:416: GT
				{
				mGT(); if (state.failed) return;

				}
				break;
			case 72 :
				// hql.g:1:419: SQL_NE
				{
				mSQL_NE(); if (state.failed) return;

				}
				break;
			case 73 :
				// hql.g:1:426: NE
				{
				mNE(); if (state.failed) return;

				}
				break;
			case 74 :
				// hql.g:1:429: LE
				{
				mLE(); if (state.failed) return;

				}
				break;
			case 75 :
				// hql.g:1:432: GE
				{
				mGE(); if (state.failed) return;

				}
				break;
			case 76 :
				// hql.g:1:435: BOR
				{
				mBOR(); if (state.failed) return;

				}
				break;
			case 77 :
				// hql.g:1:439: BXOR
				{
				mBXOR(); if (state.failed) return;

				}
				break;
			case 78 :
				// hql.g:1:444: BAND
				{
				mBAND(); if (state.failed) return;

				}
				break;
			case 79 :
				// hql.g:1:449: BNOT
				{
				mBNOT(); if (state.failed) return;

				}
				break;
			case 80 :
				// hql.g:1:454: COMMA
				{
				mCOMMA(); if (state.failed) return;

				}
				break;
			case 81 :
				// hql.g:1:460: OPEN
				{
				mOPEN(); if (state.failed) return;

				}
				break;
			case 82 :
				// hql.g:1:465: CLOSE
				{
				mCLOSE(); if (state.failed) return;

				}
				break;
			case 83 :
				// hql.g:1:471: OPEN_BRACKET
				{
				mOPEN_BRACKET(); if (state.failed) return;

				}
				break;
			case 84 :
				// hql.g:1:484: CLOSE_BRACKET
				{
				mCLOSE_BRACKET(); if (state.failed) return;

				}
				break;
			case 85 :
				// hql.g:1:498: CONCAT
				{
				mCONCAT(); if (state.failed) return;

				}
				break;
			case 86 :
				// hql.g:1:505: PLUS
				{
				mPLUS(); if (state.failed) return;

				}
				break;
			case 87 :
				// hql.g:1:510: MINUS
				{
				mMINUS(); if (state.failed) return;

				}
				break;
			case 88 :
				// hql.g:1:516: STAR
				{
				mSTAR(); if (state.failed) return;

				}
				break;
			case 89 :
				// hql.g:1:521: DIV
				{
				mDIV(); if (state.failed) return;

				}
				break;
			case 90 :
				// hql.g:1:525: COLON
				{
				mCOLON(); if (state.failed) return;

				}
				break;
			case 91 :
				// hql.g:1:531: PARAM
				{
				mPARAM(); if (state.failed) return;

				}
				break;
			case 92 :
				// hql.g:1:537: IDENT
				{
				mIDENT(); if (state.failed) return;

				}
				break;
			case 93 :
				// hql.g:1:543: QUOTED_String
				{
				mQUOTED_String(); if (state.failed) return;

				}
				break;
			case 94 :
				// hql.g:1:557: WS
				{
				mWS(); if (state.failed) return;

				}
				break;
			case 95 :
				// hql.g:1:560: NUM_INT
				{
				mNUM_INT(); if (state.failed) return;

				}
				break;

		}
	}
917091
protected void appendClause(StringBuffer clause, Criteria crit, StringBuffer stmt)
    {
        /**
         * MBAIRD
         * when generating the "WHERE/HAVING" clause we need to append the criteria for multi-mapped
         * tables. We only need to do this for the root classdescriptor and not for joined tables
         * because we assume you cannot make a relation of the wrong type upon insertion. Of course,
         * you COULD mess the data up manually and this would cause a problem.
         */

        if (clause != null)
        {
            stmt.append(clause.toString());
        }
        if (crit != null)
        {
            if (clause == null)
            {
                stmt.append(asSQLStatement(crit));
            }
            else
            {
                stmt.append(" AND (");
                stmt.append(asSQLStatement(crit));
                stmt.append(")");
            }

        }
    }
372926
public static <T> List<T> listFromClause(Class<T> clazz, String clause, Object... args)
    {
       return SqlClosure.sqlExecute(c -> OrmElf.listFromClause(c, clazz, clause, args));
    }
1104268
@Override
    public StringBuilder getFilterClause() {
        StringBuilder builder = new StringBuilder();
        builder.append(columnName);
        builder.append(" LIKE ");
        builder.append(':').append(name);
        if (condition != null) {
            builder.append(" AND ");
            builder.append(condition);
        }
        return builder;
    }
494743
private void validateClause(MatchClause matchClause) {

        Disjunction<Conjunction<Pattern>> negationDNF = matchClause.getPatterns().getNegationDNF();

        // assert none of the statements have no properties (eg. `match $x; get;`)
        List<Statement> statementsWithoutProperties = negationDNF.getPatterns().stream()
                .flatMap(p -> p.statements().stream())
                .filter(statement -> statement.properties().size() == 0)
                .collect(toList());
        if (statementsWithoutProperties.size() != 0) {
            throw GraqlQueryException.matchWithoutAnyProperties(statementsWithoutProperties.get(0));
        }

        validateVarVarComparisons(negationDNF);

        negationDNF.getPatterns().stream()
                .flatMap(p -> p.statements().stream())
                .map(p -> Graql.and(Collections.singleton(p)))
                .forEach(pattern -> ReasonerQueries.createWithoutRoleInference(pattern, transaction).checkValid());
        if (!infer) {
            boolean containsNegation = negationDNF.getPatterns().stream()
                    .flatMap(p -> p.getPatterns().stream())
                    .anyMatch(Pattern::isNegation);
            if (containsNegation) {
                throw GraqlQueryException.usingNegationWithReasoningOff(matchClause.getPatterns());
            }
        }
    }
118380
public Rule CriteriaOnlyFindQuery() {
		return Sequence( !peek().isCliQuery(), JsonParameter( JsonObject() ) , peek().setOperation( Operation.FIND ), peek().setCriteria( match() ) );
	}
267142
def windowed_query(q, column, windowsize):
    "

    for whereclause in column_windows(q.session, column, windowsize):
        for row in q.filter(whereclause).order_by(column):
            yield row
1367715
@Override
    public boolean hasStatement(Resource subject, URI predicate, Value object, boolean includeInferred, Resource... contexts) throws RepositoryException {
        if(!this.isOpen()){throw new RepositoryException("Connection is closed.");}
        String queryString = null;
        if(contexts == null) {
            queryString="ASK { GRAPH ?ctx { ?s ?p ?o } filter (?ctx = (IRI(\""+DEFAULT_GRAPH_URI+"\")))}";
        }else if (contexts.length == 0) {
            queryString = SOMETHING;
        }
        else {
            StringBuilder sb= new StringBuilder();
            sb.append("ASK { GRAPH ?ctx { ?s ?p ?o } filter (?ctx = (");
                boolean first = true;
                for (Resource context : contexts) {
                    if (first) {
                        first = !first;
                    }
                    else {
                        sb.append(",");
                    }
                    if (context == null) {
                        sb.append("IRI(\""+DEFAULT_GRAPH_URI+"\")");
                    } else {
                        sb.append("IRI(\"" + context.toString() + "\")");
                    }
                }
                sb.append(") ) }");
            queryString = sb.toString();
        }
        try {
            logger.debug(queryString);
            MarkLogicBooleanQuery query = prepareBooleanQuery(queryString); // baseuri ?

            setBindings(query, subject, predicate, object, contexts);
            return query.evaluate();
        }
        catch (MalformedQueryException e) {
            throw new RepositoryException(e);
        }
        catch (QueryEvaluationException e) {
            throw new RepositoryException(e);
        }
    }
740383
public final hqlParser.withClause_return withClause() throws RecognitionException {
		hqlParser.withClause_return retval = new hqlParser.withClause_return();
		retval.start = input.LT(1);

		CommonTree root_0 = null;

		Token WITH86=null;
		ParserRuleReturnScope logicalExpression87 =null;

		CommonTree WITH86_tree=null;

		try {
			// hql.g:285:2: ( WITH ^ logicalExpression )
			// hql.g:285:4: WITH ^ logicalExpression
			{
			root_0 = (CommonTree)adaptor.nil();


			WITH86=(Token)match(input,WITH,FOLLOW_WITH_in_withClause1288);
			WITH86_tree = (CommonTree)adaptor.create(WITH86);
			root_0 = (CommonTree)adaptor.becomeRoot(WITH86_tree, root_0);

			pushFollow(FOLLOW_logicalExpression_in_withClause1291);
			logicalExpression87=logicalExpression();
			state._fsp--;

			adaptor.addChild(root_0, logicalExpression87.getTree());

			}

			retval.stop = input.LT(-1);

			retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
			adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
			retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
		}
		finally {
			// do for sure before leaving
		}
		return retval;
	}
1116819
public final hqlParser.intoClause_return intoClause() throws RecognitionException {
		hqlParser.intoClause_return retval = new hqlParser.intoClause_return();
		retval.start = input.LT(1);

		CommonTree root_0 = null;

		Token INTO30=null;
		ParserRuleReturnScope path31 =null;
		ParserRuleReturnScope insertablePropertySpec32 =null;

		CommonTree INTO30_tree=null;

		try {
			// hql.g:221:2: ( INTO ^ path insertablePropertySpec )
			// hql.g:221:4: INTO ^ path insertablePropertySpec
			{
			root_0 = (CommonTree)adaptor.nil();


			INTO30=(Token)match(input,INTO,FOLLOW_INTO_in_intoClause847);
			INTO30_tree = (CommonTree)adaptor.create(INTO30);
			root_0 = (CommonTree)adaptor.becomeRoot(INTO30_tree, root_0);

			pushFollow(FOLLOW_path_in_intoClause850);
			path31=path();
			state._fsp--;

			adaptor.addChild(root_0, path31.getTree());

			 WeakKeywords();
			pushFollow(FOLLOW_insertablePropertySpec_in_intoClause854);
			insertablePropertySpec32=insertablePropertySpec();
			state._fsp--;

			adaptor.addChild(root_0, insertablePropertySpec32.getTree());

			}

			retval.stop = input.LT(-1);

			retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
			adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
			retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
		}
		finally {
			// do for sure before leaving
		}
		return retval;
	}
1280301
@Override
	public SqlBatch by(final BiPredicate<SqlContext, Map<String, Object>> condition) {
		this.condition = condition;
		return this;
	}
188514
@Override
    public StringBuilder getFilterClause() {
        StringBuilder builder = new StringBuilder();
        builder.append(columnName);
        if (name.lastIndexOf('_') > 0) {
            String suffix = name.substring(name.lastIndexOf('_') + 1);
            if ("before".equals(suffix)) {
                builder.append(" < ");
            } else if ("after".equals(suffix)) {
                builder.append(" > ");
            } else {
                builder.append(" = ");
            }
        } else {
            builder.append(" = ");
        }
        builder.append(':').append(name);
        return builder;
    }
924976
private WithList XreadWithClause() {
        boolean recursive = false;
        if (withStatementDepth > 0) {
        	throw Error.error("With statements may not be nested.");
        }
        int oldStatementDepth = withStatementDepth;
        try {
        	session.clearLocalTables();
	        withStatementDepth += 1;
	        readThis(Tokens.WITH);
	        if (token.tokenType == Tokens.RECURSIVE) {
	            recursive = true;
	            read();
	        }
	        WithList withList = new WithList(recursive);
	        XreadWithList(withList);
	        return withList;
        } finally {
        	withStatementDepth = oldStatementDepth;
        }
    }
1187355
private String buildSelectClause() {
        StringBuilder sqlBuf = new StringBuilder();

        sqlBuf.append("SELECT ");

        String column = null;
        for (Enumeration select = mColumns.elements(); select.hasMoreElements();) {
            column = (String) select.nextElement();

            /*
              String subColumn = column.substring(column.indexOf(".") + 1);
              // System.err.println("DEBUG: col=" + subColumn);
              String mapType = (String) mMapTypes.get(mColumnMap.get(subColumn));
            */
            String mapType = (String) mMapTypes.get(getProperty(column));

            if (mapType == null || mapType.equals(DIRECTMAP)) {
                sqlBuf.append(column);

                sqlBuf.append(select.hasMoreElements() ? ", " : " ");
            }
        }
	
        return sqlBuf.toString();
    }