コード例 #1
0
ファイル: SchemaUtil.cs プロジェクト: inthefabric/Fabric
        /*--------------------------------------------------------------------------------------------*/
        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());
        }
コード例 #2
0
ファイル: SchemaUtil.cs プロジェクト: inthefabric/Fabric
        /*--------------------------------------------------------------------------------------------*/
        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());
        }
コード例 #3
0
        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());
        }