示例#1
0
        public static void GenerateTypeRelationTriples()
        {
            var pokemonTypeTriples = PokemonRepo.GetTypeRelations();

            foreach (var item in pokemonTypeTriples)
            {
                var       name = item.Subject.Replace("https://pokemon.ereskovsky.com", "") + item.Object.Replace("https://pokemon.ereskovsky.com", "");
                var       path = $"../../typeRelation/{name}.json";
                TripleDoc trip = new TripleDoc {
                    Triple = item
                };
                System.IO.File.WriteAllText(path, JsonConvert.SerializeObject(trip));
                Thread.Sleep(100);
                Console.WriteLine(name);
            }
            Console.ReadKey();
        }
示例#2
0
        public static void GeneratePokemonTypeTriples()
        {
            var pokemonTypeTriples = PokemonRepo.GetPokemonTypeTripleFiles();

            foreach (var item in pokemonTypeTriples)
            {
                Random    rnd    = new Random();
                int       random = rnd.Next(1000000, 999999999);
                var       path   = "../../pokemonTypeTriples/pokemonHasType" + random + ".json";
                TripleDoc trip   = new TripleDoc {
                    Triple = item
                };
                System.IO.File.WriteAllText(path, JsonConvert.SerializeObject(trip));
                Thread.Sleep(100);
                Console.WriteLine(item.Subject);
            }
            Console.ReadKey();
        }