/// <summary> /// Traverses from a "user" to a "movie" over the "rated" edge, filtering those edges as specified. If both /// arguments are zero then there is no rating filter. /// </summary> public static GraphTraversal <Vertex, Vertex> Rated(this GraphTraversal <Vertex, Vertex> t, int min, int max) { if (min < 0 || max > 10) { throw new ArgumentException("min must be a value between 0 and 10"); } if (max < 0 || max > 10) { throw new ArgumentException("min must be a value between 0 and 10"); } if (min != 0 && max != 0 && min > max) { throw new ArgumentException("min cannot be greater than max"); } if (min == 0 && max == 0) { return(t.Out(EdgeRated)); } else if (min == 0) { return(t.OutE(EdgeRated).Has(KeyRating, Gt(min)).InV()); } else if (max == 0) { return(t.OutE(EdgeRated).Has(KeyRating, Lt(min)).InV()); } else { return(t.OutE(EdgeRated).Has(KeyRating, Between(min, max)).InV()); } }
public static GraphTraversal <Vertex, long> CreatedAtLeast(this GraphTraversal <Vertex, Vertex> t, long number) { return(t.OutE("created").Count().Is(P.Gte(number))); }
/// <summary> /// Traverses from a "user" to an "videos" over the "rated" edge. /// </summary> public static GraphTraversal <Vertex, Vertex> RatedVideos(this GraphTraversal <Vertex, Vertex> t, int minRate) { return(t.OutE(EdgeRated).Has(PropertyRating, Gt(minRate)).InV()); }