Ejemplo n.º 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);
        }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 8
0
 public GremlinOptionalPropertyVariable(GremlinToSqlContext context, GremlinVariable inputVariable)
     : base(context, inputVariable, GremlinVariableType.Property)
 {
 }
Ejemplo n.º 9
0
 internal override void Key(GremlinToSqlContext currentContext)
 {
     currentContext.Key(this);
 }
Ejemplo n.º 10
0
 public GremlinOptionalVertexVariable(GremlinToSqlContext context, GremlinVariable inputVariable)
     : base(context, inputVariable, GremlinVariableType.Vertex)
 {
 }
Ejemplo n.º 11
0
 public GremlinOptionalScalarVariable(GremlinToSqlContext context, GremlinVariable inputVariable)
     : base(context, inputVariable, GremlinVariableType.Scalar)
 {
 }
Ejemplo n.º 12
0
 public GremlinAggregateVariable(GremlinToSqlContext projectContext, string sideEffectKey)
 {
     this.ProjectContext = projectContext;
     this.SideEffectKey  = sideEffectKey;
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 14
0
 internal virtual void Select(GremlinToSqlContext currentContext, GremlinKeyword.Pop pop, List <string> selectKeys)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 15
0
 internal override void HasLabel(GremlinToSqlContext currentContext, List <object> values)
 {
     currentContext.HasLabel(this, values);
 }
Ejemplo n.º 16
0
 internal override void Value(GremlinToSqlContext currentContext)
 {
     currentContext.Value(this);
 }
Ejemplo n.º 17
0
 internal override void HasLabel(GremlinToSqlContext currentContext, Predicate predicate)
 {
     currentContext.HasLabel(this, predicate);
 }
Ejemplo n.º 18
0
 public GremlinOptionalTableVariable(GremlinToSqlContext context, GremlinVariable inputVariable)
     : base(context, inputVariable, GremlinVariableType.Table)
 {
 }
Ejemplo n.º 19
0
 public GremlinStoreVariable(GremlinToSqlContext projectContext, string sideEffectKey)
 {
     ProjectContext = projectContext;
     SideEffectKey  = sideEffectKey;
     Labels.Add(sideEffectKey);
 }
Ejemplo n.º 20
0
 internal override void OtherV(GremlinToSqlContext currentContext)
 {
     currentContext.OtherV(this);
 }
 public GremlinSumVariable(GremlinToSqlContext subqueryContext) : base(subqueryContext, GremlinVariableType.Scalar)
 {
 }
Ejemplo n.º 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;
        }
Ejemplo n.º 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;
 }
Ejemplo n.º 26
0
 internal override void Has(GremlinToSqlContext currentContext, string label, string propertyKey, object value)
 {
     currentContext.Has(this, label, propertyKey, value);
 }
Ejemplo n.º 27
0
 public GremlinLocalVariable(GremlinToSqlContext localContext, GremlinVariableType variableType)
     : base(variableType)
 {
     this.LocalContext = localContext;
 }
Ejemplo n.º 28
0
 internal override void Has(GremlinToSqlContext currentContext, string label, string propertyKey, Predicate predicate)
 {
     currentContext.Has(this, label, propertyKey, predicate);
 }
Ejemplo n.º 29
0
 internal override void Drop(GremlinToSqlContext currentContext)
 {
     currentContext.DropVertex(this);
 }
Ejemplo n.º 30
0
 internal virtual void Path(GremlinToSqlContext currentContext, List <GraphTraversal2> byList)
 {
     currentContext.SetPivotVariable(generatePath(currentContext, byList));
 }