Example #1
0
        public async Task <IHttpActionResult> GetTest()
        {
            var th = new TinkerHelper();
            var z  = await th.ProcessCommand("g.V()");

            return(Ok(z));
        }
Example #2
0
        public async Task <List <dynamic> > getResultsAsync(string gremlin)
        {
            List <dynamic> retValue = new List <dynamic>();

            // await initGraph();
            // var query = client.CreateGremlinQuery<dynamic>(graph, gremlin);

            //while (query.HasMoreResults)
            //{
            //    foreach (dynamic result in await query.ExecuteNextAsync())
            //    {
            //        retValue.Add(result);
            //    }
            //}

            var th        = new TinkerHelper();
            var qryResult = await th.ProcessCommand(gremlin);

            var query = JsonConvert.DeserializeObject <FeedResponse <object> >(qryResult);

            foreach (var res in query)
            {
                retValue.Add(res);
            }

            return(retValue);
        }
Example #3
0
        public async Task <FeedResponse <object> > getPassthroughResult(string gremlin)
        {
            //await initGraph();

            // var query = client.CreateGremlinQuery<dynamic>(graph, gremlin);
            // return (await query.ExecuteNextAsync() as FeedResponse<object>);

            var th        = new TinkerHelper();
            var qryResult = await th.ProcessCommand(gremlin);

            return(JsonConvert.DeserializeObject <FeedResponse <object> >(qryResult));
        }
Example #4
0
        // query that expects only 1 result -- return null if 0 or 2+ results in resultset
        public async Task <JObject> getResultAsync(string gremlin)
        {
            // await initGraph();
            var th = new TinkerHelper();

            // var query = client.CreateGremlinQuery<dynamic>(graph, gremlin);
            // var result = (await query.ExecuteNextAsync() as FeedResponse<object>);
            var qryResult = await th.ProcessCommand(gremlin);

            var result = JsonConvert.DeserializeObject <FeedResponse <object> >(qryResult);

            if (result.Count() == 1)
            {
                return(result.First() as JObject);
            }
            else
            {
                return(null);
            }
        }