Example #1
0
        public GraphTraversal2 Property(string key, object value, params object[] keyValues)
        {
            if (keyValues.Length % 2 != 0)
            {
                throw new Exception("The parameter of property should be even");
            }

            GremlinAddEOp addE = GetEndOp() as GremlinAddEOp;
            GremlinAddVOp addV = GetEndOp() as GremlinAddVOp;

            if (addE != null)
            {
                if (keyValues.Length > 0)
                {
                    throw new SyntaxErrorException("Edge can't have meta properties");
                }
                addE.EdgeProperties.Add(new GremlinProperty(GremlinKeyword.PropertyCardinality.Single, key, value, null));
            }
            else if (addV != null && keyValues.Length == 0)
            {
                addV.VertexProperties.Add(new GremlinProperty(GremlinKeyword.PropertyCardinality.List, key, value, null));
            }
            else
            {
                return(this.Property(GremlinKeyword.PropertyCardinality.Single, key, value, keyValues));
            }
            return(this);
        }
Example #2
0
        public GraphTraversal2 From(GraphTraversal2 fromVertexTraversal)
        {
            GremlinAddEOp addEOp = GetEndOp() as GremlinAddEOp;

            if (addEOp != null)
            {
                addEOp.FromVertexTraversal = fromVertexTraversal;
            }
            else
            {
                throw new SyntaxErrorException($"{GetEndOp()} cannot be cast to GremlinAddEOp");
            }
            return(this);
        }
Example #3
0
        public GraphTraversal2 From(string fromLabel)
        {
            GremlinAddEOp addEOp = GetEndOp() as GremlinAddEOp;

            if (addEOp != null)
            {
                addEOp.FromVertexTraversal = GraphTraversal2.__().Select(fromLabel);
            }
            else
            {
                throw new SyntaxErrorException($"{GetEndOp()} cannot be cast to GremlinAddEOp");
            }
            return(this);
        }