Beispiel #1
0
 public GremlinOrderVariable(GremlinVariable inputVariable, List <Tuple <GremlinToSqlContext, IComparer> > byModulatingList, GremlinKeyword.Scope scope)
     : base(inputVariable.GetVariableType())
 {
     this.ByModulatingList = byModulatingList;
     this.Scope            = scope;
     this.InputVariable    = inputVariable;
 }
Beispiel #2
0
        internal void DropProperties(GremlinVariable belongToVariable, List <string> PropertyKeys)
        {
            List <object> properties = new List <object>();

            foreach (var propertyKey in PropertyKeys)
            {
                properties.Add(propertyKey);
                properties.Add(null);
            }
            if (PropertyKeys.Count == 0)
            {
                properties.Add(GremlinKeyword.Star);
                properties.Add(null);
            }

            GremlinUpdatePropertiesVariable dropVariable = null;

            switch (belongToVariable.GetVariableType())
            {
            case GremlinVariableType.Vertex:
                dropVariable = new GremlinUpdateVertexPropertiesVariable(belongToVariable, properties);
                break;

            case GremlinVariableType.Edge:
                dropVariable = new GremlinUpdateEdgePropertiesVariable(belongToVariable, properties);
                break;
            }

            VariableList.Add(dropVariable);
            TableReferences.Add(dropVariable);
            SetPivotVariable(dropVariable);
        }
Beispiel #3
0
 public GremlinUnfoldVariable(GremlinVariable unfoldVariable) : base(
         unfoldVariable.GetVariableType() == GremlinVariableType.Map
         ? GremlinVariableType.MapEntry
         : GremlinVariableType.Unknown)
 {
     this.UnfoldVariable = unfoldVariable;
 }
Beispiel #4
0
 public GremlinSampleVariable(GremlinVariable inputVariable, GremlinKeyword.Scope scope, int amountToSample,
                              GremlinToSqlContext probabilityContext) : base(inputVariable.GetVariableType())
 {
     this.InputVariable      = inputVariable;
     this.Scope              = scope;
     this.AmountToSample     = amountToSample;
     this.ProbabilityContext = probabilityContext;
 }
 public GremlinDedupVariable(GremlinVariable inputVariable,
                             List <GremlinVariable> dedupVariables,
                             GremlinToSqlContext dedupContext,
                             GremlinKeyword.Scope scope) : base(inputVariable.GetVariableType())
 {
     this.InputVariable  = inputVariable;
     this.DedupVariables = new List <GremlinVariable>(dedupVariables);
     this.DedupContext   = dedupContext;
     this.Scope          = scope;
 }
Beispiel #6
0
        public GremlinEdgeToVertexVariable(GremlinVariable edgeVariable)
        {
            GremlinVariableType inputVariableType = edgeVariable.GetVariableType();

            if (!(inputVariableType <= GremlinVariableType.Unknown && inputVariableType != GremlinVariableType.Vertex))
            {
                throw new SyntaxErrorException("The inputVariable of VertexToEdgeVariable must be a Edge");
            }

            this.EdgeVariable = edgeVariable;
        }
Beispiel #7
0
        public GremlinMeanLocalVariable(GremlinVariable inputVariable)
        {
            GremlinVariableType inputVariableType = inputVariable.GetVariableType();

            if (!(inputVariableType == GremlinVariableType.List || GremlinVariableType.NULL <= inputVariableType && inputVariableType <= GremlinVariableType.Unknown))
            {
                throw new SyntaxErrorException("The inputVariable of mean(local) can not be " + inputVariableType);
            }

            this.InputVariable = inputVariable;
        }
Beispiel #8
0
        public GremlinLabelVariable(GremlinVariable projectVariable)
        {
            GremlinVariableType inputVariableType = projectVariable.GetVariableType();

            if (!(inputVariableType <= GremlinVariableType.Unknown))
            {
                throw new SyntaxErrorException("The inputVariable of label() can not be " + inputVariableType);
            }

            this.ProjectVariable = projectVariable;
        }
        public GremlinValuesVariable(GremlinVariable projectVariable, List <string> propertyKeys)
        {
            GremlinVariableType inputVariableType = projectVariable.GetVariableType();

            if (!(inputVariableType <= GremlinVariableType.Unknown))
            {
                throw new SyntaxErrorException("The inputVariable of values() can not be " + inputVariableType);
            }

            this.ProjectVariable = projectVariable;
            this.PropertyKeys    = new List <string>(propertyKeys);
        }
        public GremlinPropertyMapVariable(GremlinVariable inputVariable, List <string> propertyKeys)
        {
            GremlinVariableType inputVariableType = inputVariable.GetVariableType();

            if (!(inputVariableType <= GremlinVariableType.Unknown))
            {
                throw new SyntaxErrorException("The inputVariable of propertyMap() can not be " + inputVariableType);
            }

            this.InputVariable = inputVariable;
            this.PropertyKeys  = propertyKeys;
        }
        public GremlinIdVariable(GremlinVariable projectVariable)
        {
            GremlinVariableType inputVariableType = projectVariable.GetVariableType();

            if (!(inputVariableType <= GremlinVariableType.Unknown || inputVariableType == GremlinVariableType.VertexProperty ||
                  inputVariableType == GremlinVariableType.Property))
            {
                throw new SyntaxErrorException("The inputVariable of id() can not be " + inputVariableType);
            }

            this.ProjectVariable = projectVariable;
        }
        public GremlinPropertiesVariable(GremlinVariable inputVariable, List <string> propertyKeys)
        {
            GremlinVariableType inputVariableType = inputVariable.GetVariableType();

            if (!(inputVariableType <= GremlinVariableType.Unknown || inputVariableType == GremlinVariableType.VertexProperty))
            {
                throw new SyntaxErrorException("The inputVariable of properties() can not be " + inputVariableType);
            }

            this.InputVariable = inputVariable;
            this.PropertyKeys  = new List <string>(propertyKeys);
        }
Beispiel #13
0
        public GremlinSelectColumnVariable(GremlinVariable inputVariable, GremlinKeyword.Column column) : base(GremlinVariableType.Unknown)
        {
            GremlinVariableType inputVariableType = inputVariable.GetVariableType();

            if (!(GremlinVariableType.NULL <= inputVariableType && inputVariableType <= GremlinVariableType.Map ||
                  inputVariableType == GremlinVariableType.Path || inputVariableType == GremlinVariableType.Tree))
            {
                throw new SyntaxErrorException("The inputVariable of select() can not be " + inputVariableType);
            }

            this.InputVariable = inputVariable;
            this.Column        = column;
        }
Beispiel #14
0
        public GremlinValueMapVariable(GremlinVariable inputVariable, bool isIncludeTokens, List <string> propertyKeys)
        {
            GremlinVariableType inputVariableType = inputVariable.GetVariableType();

            if (!(inputVariableType <= GremlinVariableType.Unknown))
            {
                throw new SyntaxErrorException("The inputVariable of valueMap() can not be " + inputVariableType);
            }

            this.InputVariable   = inputVariable;
            this.IsIncludeTokens = isIncludeTokens;
            this.PropertyKeys    = propertyKeys;
        }
Beispiel #15
0
        public static GremlinRepeatVariable Create(GremlinVariable inputVariable, GremlinToSqlContext repeatContext,
                                                   RepeatCondition repeatCondition)
        {
            if (repeatContext.PivotVariable.GetVariableType() == inputVariable.GetVariableType())
            {
                switch (inputVariable.GetVariableType())
                {
                case GremlinVariableType.Vertex:
                    return(new GremlinRepeatVertexVariable(inputVariable, repeatContext, repeatCondition));

                case GremlinVariableType.Edge:
                    return(new GremlinRepeatEdgeVariable(inputVariable, repeatContext, repeatCondition));

                case GremlinVariableType.Scalar:
                    return(new GremlinRepeatScalarVariable(inputVariable, repeatContext, repeatCondition));

                case GremlinVariableType.Property:
                    return(new GremlinRepeatPropertyVariable(inputVariable, repeatContext, repeatCondition));
                }
            }
            return(new GremlinRepeatTableVariable(inputVariable, repeatContext, repeatCondition));
        }
Beispiel #16
0
        public static GremlinContextVariable Create(GremlinVariable contextVariable)
        {
            switch (contextVariable.GetVariableType())
            {
            case GremlinVariableType.Vertex:
                return(new GremlinContextVertexVariable(contextVariable));

            case GremlinVariableType.Edge:
                return(new GremlinContextEdgeVariable(contextVariable));

            case GremlinVariableType.Scalar:
                return(new GremlinContextScalarVariable(contextVariable));

            case GremlinVariableType.Property:
                return(new GremlinContextPropertyVariable(contextVariable));
            }
            return(new GremlinContextTableVariable(contextVariable));
        }
Beispiel #17
0
        public static GremlinOptionalVariable Create(GremlinVariable inputVariable, GremlinToSqlContext context)
        {
            if (inputVariable.GetVariableType() == context.PivotVariable.GetVariableType())
            {
                switch (context.PivotVariable.GetVariableType())
                {
                case GremlinVariableType.Vertex:
                    return(new GremlinOptionalVertexVariable(context, inputVariable));

                case GremlinVariableType.Edge:
                    return(new GremlinOptionalEdgeVariable(context, inputVariable));

                case GremlinVariableType.Scalar:
                    return(new GremlinOptionalScalarVariable(context, inputVariable));

                case GremlinVariableType.Property:
                    return(new GremlinOptionalPropertyVariable(context, inputVariable));
                }
            }
            return(new GremlinOptionalTableVariable(context, inputVariable));
        }
        public static GremlinGhostVariable Create(GremlinVariable realVariable, GremlinVariable attachedVariable, string label)
        {
            if (realVariable is GremlinGhostVariable)
            {
                return(realVariable as GremlinGhostVariable);
            }
            switch (realVariable.GetVariableType())
            {
            case GremlinVariableType.Vertex:
                return(new GremlinGhostVertexVariable(realVariable, attachedVariable, label));

            case GremlinVariableType.Edge:
                return(new GremlinGhostEdgeVariable(realVariable, attachedVariable, label));

            case GremlinVariableType.Scalar:
                return(new GremlinGhostScalarVariable(realVariable, attachedVariable, label));

            case GremlinVariableType.Property:
                return(new GremlinGhostPropertyVariable(realVariable, attachedVariable, label));
            }
            return(new GremlinGhostVariable(realVariable, attachedVariable, label));
        }
Beispiel #19
0
 public GremlinCoinVariable(GremlinVariable inputVariable, double probability) : base(inputVariable.GetVariableType())
 {
     this.Probability = probability;
 }
Beispiel #20
0
 public GremlinOrderLocalInitVariable(GremlinVariable inputVariable) : base(inputVariable.GetVariableType())
 {
     this.VariableName = GremlinKeyword.Compose1TableDefaultName;
 }
Beispiel #21
0
 public GremlinInjectVariable(GremlinVariable inputVariable, object injection) : base(
         inputVariable?.GetVariableType() == GremlinVariableType.Scalar ? GremlinVariableType.Scalar : GremlinVariableType.Mixed)
 {
     this.InputVariable = inputVariable;
     this.Injection     = injection;
 }
Beispiel #22
0
 public GremlinBarrierVariable(GremlinVariable inputVariable) : base(inputVariable.GetVariableType())
 {
 }
Beispiel #23
0
 public GremlinCommitVariable(GremlinVariable inputVariable) : base(inputVariable.GetVariableType())
 {
 }
Beispiel #24
0
 public GremlinRangeVariable(GremlinVariable inputVariable, int low, int high, GremlinKeyword.Scope scope, bool isReverse) : base(inputVariable.GetVariableType())
 {
     this.InputVariable = inputVariable;
     this.Low           = low;
     this.High          = high;
     this.Scope         = scope;
     this.IsReverse     = isReverse;
 }
Beispiel #25
0
 public GremlinFilterVariable(GremlinVariable inputVariable, WBooleanExpression newPredicate) : base(inputVariable.GetVariableType())
 {
     this.Predicate = newPredicate;
 }