Ejemplo n.º 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;
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 public GremlinUnfoldVariable(GremlinVariable unfoldVariable) : base(
         unfoldVariable.GetVariableType() == GremlinVariableType.Map
         ? GremlinVariableType.MapEntry
         : GremlinVariableType.Unknown)
 {
     this.UnfoldVariable = unfoldVariable;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 5
0
 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;
 }
Ejemplo n.º 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;
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 9
0
        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;
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 18
0
        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));
        }
Ejemplo n.º 19
0
 public GremlinCoinVariable(GremlinVariable inputVariable, double probability) : base(inputVariable.GetVariableType())
 {
     this.Probability = probability;
 }
Ejemplo n.º 20
0
 public GremlinOrderLocalInitVariable(GremlinVariable inputVariable) : base(inputVariable.GetVariableType())
 {
     this.VariableName = GremlinKeyword.Compose1TableDefaultName;
 }
Ejemplo n.º 21
0
 public GremlinInjectVariable(GremlinVariable inputVariable, object injection) : base(
         inputVariable?.GetVariableType() == GremlinVariableType.Scalar ? GremlinVariableType.Scalar : GremlinVariableType.Mixed)
 {
     this.InputVariable = inputVariable;
     this.Injection     = injection;
 }
Ejemplo n.º 22
0
 public GremlinBarrierVariable(GremlinVariable inputVariable) : base(inputVariable.GetVariableType())
 {
 }
Ejemplo n.º 23
0
 public GremlinCommitVariable(GremlinVariable inputVariable) : base(inputVariable.GetVariableType())
 {
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 25
0
 public GremlinFilterVariable(GremlinVariable inputVariable, WBooleanExpression newPredicate) : base(inputVariable.GetVariableType())
 {
     this.Predicate = newPredicate;
 }