Beispiel #1
0
        /// <summary>
        /// Create VideoVertex
        /// </summary>
        public static GraphTraversal <Vertex, Vertex> CreateEdgeUploadedForUserAndVideo(
            this GraphTraversal <Vertex, Vertex> t, String userId)
        {
            return(t.SideEffect(
                       __.As("^" + VertexVideo).Coalesce <Vertex>(

                           __.In(EdgeUploaded)
                           .HasLabel(VertexUser)
                           .Has(PropertyUserId, userId),

                           __.V()
                           .Has(VertexUser, PropertyUserId, userId)
                           .AddE(EdgeUploaded)
                           .To("^" + VertexVideo)
                           .InV()
                           )
                       ));
        }
Beispiel #2
0
        /// <summary>
        /// Create VideoVertex
        /// </summary>
        public static GraphTraversal <Vertex, Vertex> CreateTagVertexAndEdgeToVideo(
            this GraphTraversal <Vertex, Vertex> t, String tag)
        {
            return(t.SideEffect(
                       __.As("^" + VertexVideo).Coalesce <Vertex>(

                           __.Out(EdgeTagWith)
                           .HasLabel(VertexTag)
                           .Has(PropertyName, tag),

                           __.Coalesce <Vertex>(
                               __.V().Has(VertexTag, PropertyName, tag),

                               __.AddV(VertexTag)
                               .Property(PropertyName, tag)
                               .Property(PropertyTaggedDate, DateTimeOffset.UtcNow)
                               )
                           .AddE(EdgeTagWith)
                           .From("^" + VertexVideo).InV()
                           )
                       ));
        }
 /// <summary>
 /// This step is an alias for the <code>SideEffect()</code> step. As an alias, it makes certain aspects of the DSL more
 /// readable.
 /// </summary>
 public static GraphTraversal <S, E> Ensure <S, S1, E>(
     this GraphTraversal <S, E> t, GraphTraversal <S1, E> mutationTraversal)
 {
     return(t.SideEffect(mutationTraversal));
 }