예제 #1
0
        /// <summary>
        /// Adds an edge to this edge.
        /// </summary>
        /// <param name="myContainedEdge">The edges that will be contained by this hyper edge.</param>
        /// <returns>The reference of the current object. (fluent interface).</returns>
        public EdgePredefinition AddEdge(EdgePredefinition myContainedEdge)
        {
            _edges = _edges ?? new List <EdgePredefinition>();
            _edges.Add(myContainedEdge);

            return(this);
        }
예제 #2
0
        internal ServiceEdgePredefinition(EdgePredefinition myEdgePredefinition)
        {
            this.EdgeName = myEdgePredefinition.EdgeName;
            this.Comment = myEdgePredefinition.Comment;

            this.ContainedEdges = (myEdgePredefinition.ContainedEdges == null)
                ? null : myEdgePredefinition.ContainedEdges.Select(x => new ServiceEdgePredefinition(x)).ToList();

            this.VertexIDsByID = (myEdgePredefinition.VertexIDsByVertexTypeID == null)
                ? null : myEdgePredefinition.VertexIDsByVertexTypeID.Select(x => new Tuple<Int64, List<Int64>>(x.Key, x.Value.ToList())).ToList();

            this.StructuredProperties = (myEdgePredefinition.StructuredProperties == null)
                ? null : myEdgePredefinition.StructuredProperties.Select(x => new StructuredProperty(x.Key, x.Value)).ToList();

            this.UnstructuredProperties = (myEdgePredefinition.UnstructuredProperties == null)
                ? null : myEdgePredefinition.UnstructuredProperties.Select(x => new UnstructuredProperty(x.Key, x.Value)).ToList();
        }
예제 #3
0
        internal ServiceEdgePredefinition(EdgePredefinition myEdgePredefinition)
        {
            this.EdgeName = myEdgePredefinition.EdgeName;
            this.Comment = myEdgePredefinition.Comment;

            this.ContainedEdges = (myEdgePredefinition.ContainedEdges == null)
                ? null : myEdgePredefinition.ContainedEdges.Select(x => new ServiceEdgePredefinition(x)).ToArray();

            this.VertexIDsByID = (myEdgePredefinition.VertexIDsByVertexTypeID == null)
                ? null : myEdgePredefinition.VertexIDsByVertexTypeID.ToDictionary(_ => _.Key, _ =>_.Value.ToArray());

            this.StructuredProperties = (myEdgePredefinition.StructuredProperties == null)
                ? null : myEdgePredefinition.StructuredProperties.Select(x => new StructuredProperty(x.Key, x.Value)).ToArray();

            this.UnstructuredProperties = (myEdgePredefinition.UnstructuredProperties == null)
                ? null : myEdgePredefinition.UnstructuredProperties.Select(x => new UnstructuredProperty(x.Key, x.Value)).ToArray();
        }
예제 #4
0
        public EdgePredefinition ToEdgePredefinition()
        {
            EdgePredefinition EdgePredef = new EdgePredefinition(this.EdgeName);
            if (!String.IsNullOrEmpty(Comment))
                EdgePredef.Comment = this.Comment;

            if (ContainedEdges != null)
            {
                foreach (var Edge in this.ContainedEdges)
                {
                    EdgePredef.AddEdge(Edge.ToEdgePredefinition());
                }
            }

            if (StructuredProperties != null)
            {
                foreach (var Property in this.StructuredProperties)
                {
                    EdgePredef.AddStructuredProperty(Property.PropertyName, Property.PropertyValue as IComparable);
                }
            }

            if (UnstructuredProperties != null)
            {
                foreach (var Property in this.UnstructuredProperties)
                {
                    EdgePredef.AddUnstructuredProperty(Property.PropertyName, Property.PropertyValue);
                }
            }

            if (VertexIDsByID != null)
            {
                foreach (var VertexTypeSet in this.VertexIDsByID)
                {
                    foreach (var Vertex in VertexTypeSet.Value)
                    {
                        EdgePredef.AddVertexID(VertexTypeSet.Key, Vertex);
                    }
                }
            }

            return EdgePredef;
        }