Beispiel #1
0
        internal virtual void And(GremlinToSqlContext currentContext, List <GremlinToSqlContext> andContexts)
        {
            List <WBooleanExpression> booleanExprList = new List <WBooleanExpression>();

            foreach (var context in andContexts)
            {
                booleanExprList.Add(context.ToSqlBoolean());
            }
            currentContext.AddPredicate(SqlUtil.ConcatBooleanExprWithAnd(booleanExprList));
        }
Beispiel #2
0
        internal WBooleanExpression GetWherePredicate(GremlinToSqlContext currentContext, GremlinVariable firstVar, Predicate predicate, TraversalRing traversalRing)
        {
            AndPredicate andPredicate = predicate as AndPredicate;

            if (andPredicate != null)
            {
                List <WBooleanExpression> booleanList = new List <WBooleanExpression>();
                foreach (var p in andPredicate.PredicateList)
                {
                    booleanList.Add(GetWherePredicate(currentContext, firstVar, p, traversalRing));
                }
                return(SqlUtil.ConcatBooleanExprWithAnd(booleanList));
            }

            OrPredicate orPredicate = predicate as OrPredicate;

            if (orPredicate != null)
            {
                List <WBooleanExpression> booleanList = new List <WBooleanExpression>();
                foreach (var p in orPredicate.PredicateList)
                {
                    booleanList.Add(GetWherePredicate(currentContext, firstVar, p, traversalRing));
                }
                return(SqlUtil.ConcatBooleanExprWithOr(booleanList));
            }

            var selectKeys = new List <string>()
            {
                predicate.Value as string
            };
            var selectTraversal = new List <GraphTraversal2>()
            {
                traversalRing.Next()
            };
            var selectVar  = GetSelectVar(currentContext, GremlinKeyword.Pop.Last, selectKeys, selectTraversal);
            var firstExpr  = firstVar.GetDefaultProjection().ToScalarExpression();
            var secondExpr = selectVar.GetDefaultProjection().ToScalarExpression();

            return(SqlUtil.GetBooleanComparisonExpr(firstExpr, secondExpr, predicate));
        }
Beispiel #3
0
        internal virtual void And(GremlinToSqlContext currentContext, List <GremlinToSqlContext> andContexts)
        {
            List <WBooleanExpression> booleanExprList = andContexts.Select(context => context.ToSqlBoolean()).ToList();

            currentContext.AddPredicate(SqlUtil.ConcatBooleanExprWithAnd(booleanExprList));
        }