Пример #1
0
        public GremlinRepeatVariable(
            GremlinVariable inputVariable,
            GremlinToSqlContext repeatContext,
            RepeatCondition repeatCondition,
            GremlinVariableType variableType) : base(variableType)
        {
            this.InputVariable   = new GremlinContextVariable(inputVariable);
            this.RepeatContext   = repeatContext;
            this.RepeatCondition = repeatCondition;
            this.Count           = 0;
            GremlinRepeatContextVariable repeatContextVariable = this.RepeatContext.VariableList.First() as GremlinRepeatContextVariable;
            GremlinUntilContextVariable  untilContextVariable  = null;

            if (this.RepeatCondition.TerminationContext?.VariableList.Count > 0)
            {
                untilContextVariable = this.RepeatCondition.TerminationContext.VariableList.First() as GremlinUntilContextVariable;
            }
            GremlinEmitContextVariable emitContextVariable = null;

            if (this.RepeatCondition.EmitContext?.VariableList.Count > 0)
            {
                emitContextVariable = this.RepeatCondition.EmitContext?.VariableList?.First() as GremlinEmitContextVariable;
            }
            if (repeatContextVariable?.LabelPropertyList.Count > 0 ||
                untilContextVariable?.LabelPropertyList.Count > 0 || emitContextVariable?.LabelPropertyList.Count > 0)
            {
                this.PopulateLocalPath();
                repeatContextVariable?.SetContextLocalPath(this.RepeatContext.ContextLocalPath);
                untilContextVariable?.SetContextLocalPath(this.RepeatContext.ContextLocalPath);
                emitContextVariable?.SetContextLocalPath(this.RepeatContext.ContextLocalPath);
            }
        }
Пример #2
0
        internal override GremlinToSqlContext GetContext()
        {
            if (InheritedContext != null)
            {
                return(InheritedContext);
            }
            GremlinToSqlContext newContext = new GremlinToSqlContext {
                ParentContext = ParentContext
            };

            if (InheritedPivotVariable != null)
            {
                GremlinRepeatContextVariable newVariable = new GremlinRepeatContextVariable(InheritedPivotVariable);
                newContext.VariableList.Add(newVariable);
                newContext.SetPivotVariable(newVariable);
            }
            return(newContext);
        }