Exemplo n.º 1
0
 public static void CreateJConstellation(Constellation constellation)
 {
     using (var driver = GraphDatabase.Driver(new Uri("bolt://localhost:7687"), AuthTokens.Basic(Program.db_username, Program.db_password)))
     {
         using (var session = driver.Session())
         {
             Console.WriteLine($"Added {constellation.name}");
             SystemDB.textlog.WriteLine($"Added {constellation.name}");
             session.WriteTransaction(tx =>
             {
                 tx.Run($"CREATE (a:JConstellation{{name:'{constellation.name}', class:'{GetJProps.GetClass(constellation.SList.First().id)}'}})");
             });
         }
     }
 }
Exemplo n.º 2
0
 public static void CreateSystem(System system, bool jSystem = false)
 {
     if (!jSystem)
     {
         using (var driver = GraphDatabase.Driver(new Uri("bolt://localhost:7687"), AuthTokens.Basic(Program.db_username, Program.db_password)))
         {
             using (var session = driver.Session())
             {
                 Console.WriteLine($"Added {system.name} {system.security} in {system.constname} in {system.regionname}");
                 SystemDB.textlog.WriteLine($"Added {system.name} {system.security} in {system.constname} in {system.regionname}");
                 session.WriteTransaction(tx =>
                 {
                     tx.Run($"CREATE (a:System{{name:'{system.name}', security:'{system.security}', region:'{system.regionname}', constellation:'{system.constname}', constid:'{system.constid}', regionid:'{system.regionid}', systemid:'{system.id}'}})");
                 });
             }
         }
     }
     else // add class, statics and effect in case it's j-space
     {
         using (var driver = GraphDatabase.Driver(new Uri("bolt://localhost:7687"), AuthTokens.Basic(Program.db_username, Program.db_password)))
         {
             using (var session = driver.Session())
             {
                 Console.WriteLine($"Added {system.name} {system.security} in {system.constname} in {system.regionname}");
                 SystemDB.textlog.WriteLine($"Added {system.name} {system.security} in {system.constname} in {system.regionname}");
                 session.WriteTransaction(tx =>
                 {
                     tx.Run($"CREATE (a:System{{name:'{system.name}', security:'{system.security}', region:'{system.regionname}', constellation:'{system.constname}', constid:'{system.constid}', regionid:'{system.regionid}', systemid:'{system.id}', class:'{GetJProps.GetClass(system.id)}', effect: '{GetJProps.GetEffect(system.id)}'}})");
                     foreach (string _static in GetJProps.GetStaticList(system.id))
                     {
                         Console.WriteLine($"Added {_static} static to {system.name}");
                         SystemDB.textlog.WriteLine($"Added {_static} static to {system.name}");
                         tx.Run($"MATCH (a:System {{name:'{system.name}'}}) CREATE (b:Static {{name:'{_static}'}}) MERGE (a)-[r:HAS_STATIC]->(b)");
                     }
                 });
             }
         }
     }
 }