示例#1
0
        internal virtual GremlinSelectVariable GetSelectVar(GremlinToSqlContext currentContext, GremlinKeyword.Pop pop, List <string> selectKeys, List <GraphTraversal2> byList = null)
        {
            //TODO: refactor
            if (byList == null)
            {
                byList = new List <GraphTraversal2>()
                {
                    GraphTraversal2.__()
                };
            }
            List <GremlinToSqlContext> byContexts          = new List <GremlinToSqlContext>();
            List <GremlinVariable>     steps               = currentContext.GetGlobalPathStepList();
            List <GremlinVariable>     sideEffectVariables = currentContext.GetSideEffectVariables();

            GremlinGlobalPathVariable pathVariable = new GremlinGlobalPathVariable(steps);

            currentContext.VariableList.Add(pathVariable);
            currentContext.TableReferences.Add(pathVariable);

            foreach (var by in byList)
            {
                GremlinToSqlContext       newContext = new GremlinToSqlContext();
                GremlinDecompose1Variable decompose1 = new GremlinDecompose1Variable(pathVariable);
                newContext.VariableList.Add(decompose1);
                newContext.TableReferences.Add(decompose1);
                newContext.SetPivotVariable(decompose1);

                by.GetStartOp().InheritedContextFromParent(newContext);
                byContexts.Add(by.GetEndOp().GetContext());
            }

            GremlinSelectVariable newVariable = new GremlinSelectVariable(this, pathVariable, sideEffectVariables, pop, selectKeys, byContexts);

            currentContext.VariableList.Add(newVariable);
            currentContext.TableReferences.Add(newVariable);

            return(newVariable);
        }
 public virtual void ModulateBy(GremlinKeyword.Column column, IComparer comparer)
 {
     ModulateBy(GraphTraversal2.__().Select(column), comparer);
 }
 public virtual void ModulateBy(GremlinKeyword.Column column, GremlinKeyword.Order order)
 {
     ModulateBy(GraphTraversal2.__().Select(column), order);
 }
 public virtual void ModulateBy(string key, IComparer comparer)
 {
     ModulateBy(GraphTraversal2.__().Values(key), comparer);
 }
示例#5
0
 public override void ModulateBy()
 {
     ByTraversal = GraphTraversal2.__();
 }
示例#6
0
 public override void ModulateBy(string key, IComparer comparer)
 {
     ByModulatingMap.Add(new Tuple <object, IComparer>(GraphTraversal2.__().Values(key), comparer));
 }
 public virtual void ModulateBy(string key, GremlinKeyword.Order order)
 {
     ModulateBy(GraphTraversal2.__().Values(key), order);
 }
 public virtual void ModulateBy()
 {
     ModulateBy(GraphTraversal2.__());
 }
示例#9
0
        /// <summary>
        /// Only valid for VertexProperty
        /// </summary>
        internal virtual void HasKeyOrValue(GremlinToSqlContext currentContext, GremlinHasType hasType, List <object> valuesOrPredicates)
        {
            GraphTraversal2 traversal2 = hasType == GremlinHasType.HasKey ? GraphTraversal2.__().Key() : GraphTraversal2.__().Value();

            traversal2.GetStartOp().InheritedVariableFromParent(currentContext);
            GremlinToSqlContext existContext = traversal2.GetEndOp().GetContext();

            List <WBooleanExpression> booleanExprList         = new List <WBooleanExpression>();
            GremlinVariableProperty   defaultVariableProperty = existContext.PivotVariable.DefaultProjection();

            foreach (var valuesOrPredicate in valuesOrPredicates)
            {
                booleanExprList.Add(CreateBooleanExpression(defaultVariableProperty, valuesOrPredicate));
            }
            existContext.AddPredicate(SqlUtil.ConcatBooleanExprWithOr(booleanExprList));

            currentContext.AddPredicate(SqlUtil.GetExistPredicate(existContext.ToSelectQueryBlock()));
        }
示例#10
0
 public GremlinToOp(string stepLabel)
 {
     ToVertexTraversal = GraphTraversal2.__().Select(stepLabel);
 }
示例#11
0
 public GremlinFromOp(string stepLabel)
 {
     FromVertexTraversal = GraphTraversal2.__().Select(GremlinKeyword.Pop.last, stepLabel);
 }
示例#12
0
 public GremlinDedupOp(params string[] dedupLabels)
 {
     this.DedupLabels = new List <string>(dedupLabels);
     this.ByTraversal = GraphTraversal2.__();
 }
示例#13
0
        public GraphTraversal2 Choose(Predicate choosePredicate, GraphTraversal2 trueChoice, GraphTraversal2 falseChoice = null)
        {
            GraphTraversal2 traversalPredicate = GraphTraversal2.__().Is(choosePredicate);

            return(Choose(traversalPredicate, trueChoice, falseChoice));
        }
 public virtual void ModulateBy(GremlinKeyword.Order order)
 {
     ModulateBy(GraphTraversal2.__(), order);
 }
示例#15
0
 public override void ModulateBy(string key)
 {
     ByList.Add(GraphTraversal2.__().Values(key));
 }
 public virtual void ModulateBy(IComparer comparer)
 {
     ModulateBy(GraphTraversal2.__(), comparer);
 }
示例#17
0
 public override void ModulateBy()
 {
     ByList.Add(GraphTraversal2.__());
 }
 public virtual void ModulateBy(string key)
 {
     ModulateBy(GraphTraversal2.__().Values(key));
 }
示例#19
0
 public override void ModulateBy(string key)
 {
     ByTraversal = GraphTraversal2.__().Values(key);
 }
示例#20
0
 public GremlinAggregateOp(string sideEffectKey)
 {
     SideEffectKey = sideEffectKey;
     ByTraversal   = GraphTraversal2.__();
 }
 public GraphTraversal2 Where(string startKey, Predicate predicate)
 {
     //AddGremlinOperator(new GremlinWhereOp(startKey, predicate));
     AddGremlinOperator(new GremlinWhereOp(GraphTraversal2.__().V().Has(startKey, predicate)));
     return(this);
 }