Example #1
0
        /// <summary>
        /// Returns a vectorised OPTIONAL MATCH statement for <typeparamref name="TVector"/>.
        /// </summary>
        /// <typeparam name="TVector"></typeparam>
        /// <param name="query"></param>
        /// <param name="from"></param>
        /// <param name="rel"></param>
        /// <param name="relPath"></param>
        /// <param name="to"></param>
        /// <returns></returns>
        public static ICypherFluentQuery OptMatch <TVector>(this ICypherFluentQuery query, string path = null, string from = null, string rel = null, string relPath = null, string to = null) where TVector : Vector
        {
            var vars = ProcessVars(path);

            if (vars.Successful())
            {
                var result = vars.Data;
                from    = result.From;
                rel     = result.Rel;
                relPath = result.RelPath;
                to      = result.To;
            }
            var pattern = Common.Vector <TVector>(rel, from, to, relPath);

            query = query.OptionalMatch(pattern);
            return(query);
        }
Example #2
0
        /// <summary>
        /// Returns an OPTIONAL MATCH statement for a hypernode starting with <typeparamref name="TFirstVector"/> and ending in <typeparamref name="TSecondVector"/>.
        /// </summary>
        /// <typeparam name="TFirstVector"></typeparam>
        /// <typeparam name="TSecondVector"></typeparam>
        /// <param name="query"></param>
        /// <param name="from"></param>
        /// <param name="rel"></param>
        /// <param name="relPath"></param>
        /// <param name="to"></param>
        /// <param name="rel2"></param>
        /// <param name="relPath2"></param>
        /// <param name="to2"></param>
        /// <returns></returns>
        public static ICypherFluentQuery OptMatch <TFirstVector, TSecondVector>(this ICypherFluentQuery query, string path = null, string from = null, string rel = null, string relPath = null, string to = null, string rel2 = null, string relPath2 = null, string to2 = null) where TFirstVector : Vector where TSecondVector : Vector
        {
            var vars = ProcessVars(path);

            if (vars.Successful())
            {
                var result = vars.Data;
                from     = result.From;
                rel      = result.Rel;
                relPath  = result.RelPath;
                to       = result.To;
                rel2     = result.Rel2;
                relPath2 = result.RelPath2;
                to2      = result.To2;
            }
            var pattern = HyperNodeVector <TFirstVector, TSecondVector>(from, rel, relPath, to, rel2, relPath2, to2);

            query = query.OptionalMatch(pattern);
            return(query);
        }
        public void Execute(ICypherFluentQuery cypher)
        {

            ProcessStacks();

            foreach (var query in _queryStack)
            {

                if (query.QueryType == QueryTypeEnum.Match)
                {
                    cypher = cypher.Match(query.QueryString);
                    continue;
                }
                if (query.QueryType == QueryTypeEnum.OptionalMatch)
                {
                    cypher = cypher.OptionalMatch(query.QueryString);
                    continue;
                }

                if (query.QueryType == QueryTypeEnum.Where)
                {
                    cypher = cypher.Where(query.QueryString);
                    continue;
                }

                if (query.QueryType == QueryTypeEnum.Create)
                {
                    cypher = cypher.Create(query.QueryString);
                    continue;
                }

                if (query.QueryType == QueryTypeEnum.Merge)
                {
                    cypher = cypher.Merge(query.QueryString);
                    continue;
                }

                if (query.QueryType == QueryTypeEnum.Delete)
                {
                    cypher = cypher.Delete(query.QueryString);
                    continue;
                }

                if (query.QueryType == QueryTypeEnum.With)
                {
                    cypher = cypher.With(query.QueryString);
                    continue;
                }

            }

            cypher.ExecuteWithoutResults();
        }
Example #4
0
 public static ICypherFluentQuery OptMatch <TVector>(this ICypherFluentQuery query) where TVector : Vector
 {
     query = query.OptionalMatch(Common.Vector <TVector>());
     return(query);
 }