/*--------------------------------------------------------------------------------------------*/ public static IList <EdgeProperty> GetEdgeProperties(IEdgeSchema pEdge) { Type ept = typeof(EdgeProperty); return(pEdge .GetType() .GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance) .Where(x => x.PropertyType.IsSubclassOf(ept)) .Select(x => (EdgeProperty)x.GetValue(pEdge, null)) .ToList()); }
/*--------------------------------------------------------------------------------------------*/ public static IEdgeSchema GetReverseEdgeSchema(IVertexSchema pVertex, IEdgeSchema pEdge) { Type vt = pVertex.GetType(); Type et = pEdge.GetType(); return(GetEdgeSchemas() .Where(x => x.ToVertexType == vt) .Where(x => (x.FabToVertexId.CreateAccess != Access.None && x.CreateFromOtherDirection == et)) .Take(1) .SingleOrDefault()); }
public string CreateScript(IEdgeSchema edge) { StringBuilder sb = new StringBuilder(); sb.AppendLine($"CREATE TABLE edge.{edge.Name} ("); sb.Append(new AttributeSchemaScript().CreateScript(edge.Attributes)); if (edge.Constraints != null && edge.Constraints.Count > 0) { sb.AppendLine($"CONSTRAINT EC_{edge.Name.ToUpper()} CONNECTION ("); for (int i = 0; i < edge.Constraints.Count; i++) { sb.Append($"node.{Parent.Name} TO node.{edge.Constraints[i].Name}"); if (i < edge.Constraints.Count - 1) { sb.Append(","); } sb.AppendLine(); } sb.AppendLine(")"); } sb.AppendLine($") AS EDGE;"); return(sb.ToString()); }