Example #1
0
        /// <summary>
        /// Gets users by their identifier
        /// </summary>
        public static GraphTraversal <Vertex, Vertex> Users(this GraphTraversalSource g, string userId, params string[] additionalUserIds)
        {
            var userIds = new List <string>();

            userIds.Add(userId);
            userIds.AddRange(additionalUserIds);
            GraphTraversal <Vertex, Vertex> t = g.V().HasLabel(VertexUser);

            if (userIds.Count == 1)
            {
                t = t.Has(KeyUserId, userIds[0]);
            }
            else if (userIds.Count > 1)
            {
                t = t.Has(KeyUserId, P.Within(userIds.ToArray()));
            }
            return(t);
        }
Example #2
0
        /// <summary>
        /// Gets movies by their title.
        /// </summary>
        public static GraphTraversal <Vertex, Vertex> Movies(this GraphTraversalSource g, string title, params string[] additionalTitles)
        {
            var titles = new List <string>();

            titles.Add(title);
            titles.AddRange(additionalTitles);
            GraphTraversal <Vertex, Vertex> t = g.V().HasLabel(VertexMovie);

            if (titles.Count == 1)
            {
                t = t.Has(KeyTitle, titles[0]);
            }
            else if (titles.Count > 1)
            {
                t = t.Has(KeyTitle, P.Within(titles.ToArray()));
            }
            return(t);
        }
Example #3
0
        public static GraphTraversal <Vertex, Vertex> Persons(this GraphTraversalSource g, params string[] personNames)
        {
            GraphTraversal <Vertex, Vertex> t = g.V().HasLabel("person");

            if (personNames.Length > 0)
            {
                t = t.Has("name", P.Within(personNames));
            }

            return(t);
        }