Example #1
0
        static void PrintOut(string connectionString)
        {
            Console.WriteLine("Print out store data using Entity Framework...");
            //connect to the same store using the BrightstarDB entity framework context
            var ctx = new Ifc2x3Context(connectionString);

            //loop through all the Person entities and print out their properties and other people that they 'know'
            Console.WriteLine(@"{0} Entities found in raw RDF data", ctx.ENTITYs.Count());
            Console.WriteLine(@"{0} IfcRoots found in raw RDF data", ctx.IfcRoots.Count());
            Console.WriteLine();
            
            foreach (var rt in ctx.ENTITYs)
            {
                //var n = rt as ENTITY;
                Console.WriteLine("GUID:\t\t{0}", rt.UriId);
                Console.WriteLine("ELabel:\t\t{0}", rt.EntityLabel);
                
                var temp = rt as IfcRoot;
                if(temp != null)
                {
                    Console.WriteLine("GlobalId:\t\t{0}", temp.GlobalId.ToString());
                    Console.WriteLine("Name:\t\t{0}", temp.Name);
                    Console.WriteLine("Description:\t\t{0}", temp.Description);

                }
                
                
                //
                //Console.WriteLine("check: {0}", rt.RefLatitude.first.ToString());
                Console.WriteLine();
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Please enter IFC File Name: ");
            string filename = "Resources/sample.ifc"; //Console.ReadLine();

            BSConfig.Register();
            var client = BrightstarService.GetClient(BSConfig.ConnectionString());
            if(client.ListStores().Any(x => x == "ifcRDF"))
            {
                client.DeleteStore("ifcRDF");
            }
            client.CreateStore("ifcRDF");
            BrightstarService.Shutdown();

            var ctx = new Ifc2x3Context(BSConfig.ConnectionString("ifcRDF"));
            var model = new XbimModel();

            if(OpenIfcFile(model, filename))
            {
                ctx.ConvertToRDF(model);
                ctx.SaveChanges();
            }

            PrintOut(BSConfig.ConnectionString("ifcRDF"));

            Console.ReadKey();

        }