示例#1
0
        //internal virtual void Sack() //Deprecated
        //internal virtual void Sack(BiFunction<V, U, V>) sackOperator) //Deprecated
        //internal virtual void Sack(BiFunction<V, U, V>) sackOperator, string, elementPropertyKey) //Deprecated

        internal virtual void Sample(GremlinToSqlContext currentContext, GremlinKeyword.Scope scope, int amountToSample, GremlinToSqlContext probabilityContext)
        {
            GremlinSampleVariable newVariable = new GremlinSampleVariable(scope, amountToSample, probabilityContext);

            currentContext.VariableList.Add(newVariable);
            currentContext.TableReferences.Add(newVariable);
        }
示例#2
0
 public GremlinAddETableVariable(GremlinVariable inputVariable, string edgeLabel, List <GremlinProperty> edgeProperties, GremlinToSqlContext fromContext, GremlinToSqlContext toContext)
 {
     EdgeProperties    = edgeProperties;
     EdgeLabel         = edgeLabel;
     InputVariable     = inputVariable;
     EdgeType          = WEdgeType.OutEdge;
     OtherVIndex       = 1;
     FromVertexContext = fromContext;
     ToVertexContext   = toContext;
 }
示例#3
0
 internal override void OutE(GremlinToSqlContext currentContext, List <string> edgeLabels)
 {
     currentContext.OutE(this, edgeLabels);
 }
 public GremlinTreeVariable(GremlinToSqlContext subqueryContext, GremlinVariable pathVariable) : base(subqueryContext, GremlinVariableType.Tree)
 {
     PathVariable = pathVariable;
 }
 public GremlinFoldVariable(GremlinToSqlContext subqueryContext) : base(subqueryContext, GremlinVariableType.List)
 {
     FoldVariable = subqueryContext.PivotVariable;
 }
示例#6
0
 internal override void Values(GremlinToSqlContext currentContext, List <string> propertyKeys)
 {
     currentContext.Values(this, propertyKeys);
 }
 public GremlinDerivedTableVariable(GremlinToSqlContext subqueryContext, GremlinVariableType variableType) : base(variableType)
 {
     this.SubqueryContext = subqueryContext;
 }
示例#8
0
 public GremlinOptionalPropertyVariable(GremlinToSqlContext context, GremlinVariable inputVariable)
     : base(context, inputVariable, GremlinVariableType.Property)
 {
 }
示例#9
0
 internal override void Key(GremlinToSqlContext currentContext)
 {
     currentContext.Key(this);
 }
示例#10
0
 public GremlinOptionalVertexVariable(GremlinToSqlContext context, GremlinVariable inputVariable)
     : base(context, inputVariable, GremlinVariableType.Vertex)
 {
 }
示例#11
0
 public GremlinOptionalScalarVariable(GremlinToSqlContext context, GremlinVariable inputVariable)
     : base(context, inputVariable, GremlinVariableType.Scalar)
 {
 }
示例#12
0
 public GremlinAggregateVariable(GremlinToSqlContext projectContext, string sideEffectKey)
 {
     this.ProjectContext = projectContext;
     this.SideEffectKey  = sideEffectKey;
 }
示例#13
0
        internal override GremlinToSqlContext GetContext()
        {
            GremlinToSqlContext inputContext = GetInputContext();

            if (inputContext.PivotVariable == null)
            {
                throw new TranslationException("The PivotVariable of has()-step can't be null.");
            }

            switch (Type)
            {
            //has(key)
            case GremlinHasType.HasProperty:
                inputContext.PivotVariable.Has(inputContext, PropertyKey);
                break;

            //hasNot(key)
            case GremlinHasType.HasNotProperty:
                inputContext.PivotVariable.HasNot(inputContext, PropertyKey);
                break;

            //has(key, value) | has(key, predicate)
            case GremlinHasType.HasPropertyValueOrPredicate:
                inputContext.PivotVariable.Has(inputContext, PropertyKey, ValueOrPredicate);
                break;

            //has(key, traversal)
            case GremlinHasType.HasPropertyTraversal:
                Traversal.GetStartOp().InheritedVariableFromParent(inputContext);
                if (Traversal.GetStartOp() is GremlinParentContextOp)
                {
                    if (Traversal.GremlinTranslationOpList.Count > 1)
                    {
                        Traversal.InsertGremlinOperator(1, new GremlinValuesOp(PropertyKey));
                    }
                    else
                    {
                        Traversal.AddGremlinOperator(new GremlinValuesOp(PropertyKey));
                    }
                }
                GremlinToSqlContext hasContext = Traversal.GetEndOp().GetContext();
                inputContext.AllTableVariablesInWhereClause.AddRange(hasContext.FetchAllTableVars());
                inputContext.AddPredicate(hasContext.ToSqlBoolean());
                break;

            //has(label, key, value) | has(label, key, predicate)
            case GremlinHasType.HasLabelPropertyValue:
                inputContext.PivotVariable.Has(inputContext, GremlinKeyword.Label, Label);
                inputContext.PivotVariable.Has(inputContext, PropertyKey, ValueOrPredicate);
                break;

            //hasId(values)
            case GremlinHasType.HasId:
            case GremlinHasType.HasLabel:
                inputContext.PivotVariable.HasIdOrLabel(inputContext, Type, ValuesOrPredicates);
                break;

            //===================================================================
            //hasKey(values) || hasValue(values)
            case GremlinHasType.HasKey:
            case GremlinHasType.HasValue:
                inputContext.PivotVariable.HasKeyOrValue(inputContext, Type, ValuesOrPredicates);
                break;
            }
            return(inputContext);
        }
示例#14
0
 internal virtual void Select(GremlinToSqlContext currentContext, GremlinKeyword.Pop pop, List <string> selectKeys)
 {
     throw new NotImplementedException();
 }
示例#15
0
 internal override void HasLabel(GremlinToSqlContext currentContext, List <object> values)
 {
     currentContext.HasLabel(this, values);
 }
示例#16
0
 internal override void Value(GremlinToSqlContext currentContext)
 {
     currentContext.Value(this);
 }
示例#17
0
 internal override void HasLabel(GremlinToSqlContext currentContext, Predicate predicate)
 {
     currentContext.HasLabel(this, predicate);
 }
示例#18
0
 public GremlinOptionalTableVariable(GremlinToSqlContext context, GremlinVariable inputVariable)
     : base(context, inputVariable, GremlinVariableType.Table)
 {
 }
示例#19
0
 public GremlinStoreVariable(GremlinToSqlContext projectContext, string sideEffectKey)
 {
     ProjectContext = projectContext;
     SideEffectKey  = sideEffectKey;
     Labels.Add(sideEffectKey);
 }
示例#20
0
 internal override void OtherV(GremlinToSqlContext currentContext)
 {
     currentContext.OtherV(this);
 }
 public GremlinSumVariable(GremlinToSqlContext subqueryContext) : base(subqueryContext, GremlinVariableType.Scalar)
 {
 }
示例#22
0
 internal override void BothV(GremlinToSqlContext currentContext)
 {
     currentContext.BothV(this);
 }
        }                                                              // such as aggregate("a"), sotre("a"), as("a")

        public GremlinCapVariable(GremlinToSqlContext subqueryContext, List <GremlinVariable> sideEffectVariables, List <string> sideEffectKeys)
            : base(subqueryContext, GremlinVariableType.List)
        {
            SideEffectKeys      = sideEffectKeys;
            SideEffectVariables = sideEffectVariables;
        }
示例#24
0
 internal override void Has(GremlinToSqlContext currentContext, string propertyKey, GremlinToSqlContext propertyContext)
 {
     currentContext.Has(this, propertyKey, propertyContext);
 }
 public GremlinLocalVariable(GremlinToSqlContext localContext, GremlinVariableType variableType)
     : base(variableType)
 {
     LocalContext = localContext;
     LocalContext.HomeVariable = this;
 }
示例#26
0
 internal override void Has(GremlinToSqlContext currentContext, string label, string propertyKey, object value)
 {
     currentContext.Has(this, label, propertyKey, value);
 }
示例#27
0
 public GremlinLocalVariable(GremlinToSqlContext localContext, GremlinVariableType variableType)
     : base(variableType)
 {
     this.LocalContext = localContext;
 }
示例#28
0
 internal override void Has(GremlinToSqlContext currentContext, string label, string propertyKey, Predicate predicate)
 {
     currentContext.Has(this, label, propertyKey, predicate);
 }
示例#29
0
 internal override void Drop(GremlinToSqlContext currentContext)
 {
     currentContext.DropVertex(this);
 }
示例#30
0
 internal virtual void Path(GremlinToSqlContext currentContext, List <GraphTraversal2> byList)
 {
     currentContext.SetPivotVariable(generatePath(currentContext, byList));
 }