Beispiel #1
0
 protected static void Tried_to_find_celebrity_in_the_db(string name)
 {
     var celebFinderContext = new CelebFinderContext {Name = name};
     new DbFinder(CelebrityRepository.Object).Execute(celebFinderContext);
     Celebrity = celebFinderContext.Celebrity;
 }
        private static Dictionary<string, Celebrity> GetCelebrities(Stream csv)
        {
            Log.Debug("Loading dbpedia resource types");

            var resources = new Dictionary<string, Celebrity>();
            foreach (var row in new StreamReader(csv).ReadToEnd().Split('\n'))
            {
                if (string.IsNullOrEmpty(row))
                    continue;

                var cols = row.Split('\t');
                var resource = cols[Resource].ToLower();
                var type = cols[Type].ToLower();

                type = type.Substring(type.LastIndexOf('/') + 1);

                if (resources.ContainsKey(cols[Resource]))
                {
                    Log.Warn("The resource " + cols[Resource] + " is found in the list of types more than once");
                    continue;
                }

                resources[resource] = new Celebrity {DbpediaResourceId = resource, Type = type, WikipediaUrl = "http://en.wikipedia.org/" + resource};
            }

            return resources;
        }