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.Item2)
                    {
                        EdgePredef.AddVertexID(VertexTypeSet.Item1, Vertex);
                    }
                }
            }

            return(EdgePredef);
        }
Example #2
0
        private void AddDefaultValues(ref EdgePredefinition edgeDef, IEdgeType myEdgeType)
        {
            var mandatoryProps = myEdgeType.GetPropertyDefinitions(true).Where(_ => _.IsMandatory);

            foreach (var propertyDefinition in mandatoryProps)
            {
                if (edgeDef.StructuredProperties == null || 
                    !edgeDef.StructuredProperties.ContainsKey(propertyDefinition.Name))
                    edgeDef.AddStructuredProperty(propertyDefinition.Name, propertyDefinition.DefaultValue);
            }
        }
Example #3
0
 /// <summary>
 /// Adds edge default properties like CreationDate, ModifactionDate sao. to the predefinition if not already existing
 /// </summary>
 /// <param name="myPredef">The to be chaged Predefinition</param>
 /// <param name="myAttrDef">The outgoing edge definition</param>
 /// <param name="myDate">actual date long</param>
 private void AddDefaultPropertiesToEdgePredefinition(ref EdgePredefinition myPredef, 
                                                         IOutgoingEdgeDefinition myAttrDef, 
                                                         long myDate)
 {
     foreach (var item in new Dictionary<String, IComparable>
                                 { { "CreationDate", myDate },
                                   { "ModificationDate", myDate },
                                   { "EdgeTypeName", (myAttrDef.InnerEdgeType == null) 
                                                     ? myAttrDef.EdgeType.Name 
                                                     : myAttrDef.InnerEdgeType.Name },
                                   { "EdgeTypeID", (myAttrDef.InnerEdgeType == null) 
                                                     ? myAttrDef.EdgeType.ID 
                                                     : myAttrDef.InnerEdgeType.ID } })
     {
         if (myPredef.StructuredProperties == null || 
             !myPredef.StructuredProperties.ContainsKey(item.Key))
             myPredef.AddStructuredProperty(item.Key, item.Value );
     }
 }