コード例 #1
0
ファイル: GremlinVariable.cs プロジェクト: georgeycliu/k-core
        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);
        }
コード例 #2
0
 public virtual void ModulateBy(GremlinKeyword.Column column, IComparer comparer)
 {
     ModulateBy(GraphTraversal2.__().Select(column), comparer);
 }
コード例 #3
0
 public virtual void ModulateBy(GremlinKeyword.Column column, GremlinKeyword.Order order)
 {
     ModulateBy(GraphTraversal2.__().Select(column), order);
 }
コード例 #4
0
 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));
 }
コード例 #7
0
 public virtual void ModulateBy(string key, GremlinKeyword.Order order)
 {
     ModulateBy(GraphTraversal2.__().Values(key), order);
 }
コード例 #8
0
 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
ファイル: GremlinAddEOp.cs プロジェクト: Sun-Jc/GC-GraphView
 public GremlinToOp(string stepLabel)
 {
     ToVertexTraversal = GraphTraversal2.__().Select(stepLabel);
 }
コード例 #11
0
ファイル: GremlinAddEOp.cs プロジェクト: Sun-Jc/GC-GraphView
 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
ファイル: GraphTraversal2.cs プロジェクト: georgeycliu/k-core
        public GraphTraversal2 Choose(Predicate choosePredicate, GraphTraversal2 trueChoice, GraphTraversal2 falseChoice = null)
        {
            GraphTraversal2 traversalPredicate = GraphTraversal2.__().Is(choosePredicate);

            return(Choose(traversalPredicate, trueChoice, falseChoice));
        }
コード例 #14
0
 public virtual void ModulateBy(GremlinKeyword.Order order)
 {
     ModulateBy(GraphTraversal2.__(), order);
 }
コード例 #15
0
 public override void ModulateBy(string key)
 {
     ByList.Add(GraphTraversal2.__().Values(key));
 }
コード例 #16
0
 public virtual void ModulateBy(IComparer comparer)
 {
     ModulateBy(GraphTraversal2.__(), comparer);
 }
コード例 #17
0
 public override void ModulateBy()
 {
     ByList.Add(GraphTraversal2.__());
 }
コード例 #18
0
 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.__();
 }
コード例 #21
0
 public GraphTraversal2 Where(string startKey, Predicate predicate)
 {
     //AddGremlinOperator(new GremlinWhereOp(startKey, predicate));
     AddGremlinOperator(new GremlinWhereOp(GraphTraversal2.__().V().Has(startKey, predicate)));
     return(this);
 }