Example #1
0
        public Chair(DatabaseLibrary.DatabaseModel.Chair chair, IUnitOfWork unitOfWork, IIndex index)
        {
            I10Index i10Index = new I10Index();

            ChairId      = chair.ChairId;
            ChairName    = chair.ChairName;
            GoogleHIndex = index.GetIndex(unitOfWork.Publications.Find(item => item.AccountPublications
                                                                       .Any(publication => publication.Account.TypeId == 3 && publication.Account.ResearcherAccounts
                                                                            .Any(researcher => researcher.Researcher.ChairId == ChairId))).Select(item => item.CitationCount));

            GoogleHIndex5 = i10Index.GetIndex(unitOfWork.Publications.Find(item => item.AccountPublications
                                                                           .Any(publication => publication.Account.TypeId == 3 && publication.Account.ResearcherAccounts
                                                                                .Any(researcher => researcher.Researcher.ChairId == ChairId))).Select(item => item.CitationCount));

            PublonsHIndex = index.GetIndex(unitOfWork.Publications.Find(item => item.AccountPublications
                                                                        .Any(publication => publication.Account.TypeId == 2 && publication.Account.ResearcherAccounts
                                                                             .Any(researcher => researcher.Researcher.ChairId == ChairId))).Select(item => item.CitationCount));

            PublonsHIndex5 = i10Index.GetIndex(unitOfWork.Publications.Find(item => item.AccountPublications
                                                                            .Any(publication => publication.Account.TypeId == 2 && publication.Account.ResearcherAccounts
                                                                                 .Any(researcher => researcher.Researcher.ChairId == ChairId))).Select(item => item.CitationCount));

            ScopusHIndex = index.GetIndex(unitOfWork.Publications.Find(item => item.AccountPublications
                                                                       .Any(publication => publication.Account.TypeId == 1 && publication.Account.ResearcherAccounts
                                                                            .Any(researcher => researcher.Researcher.ChairId == ChairId))).Select(item => item.CitationCount));

            ScopusHIndex5 = i10Index.GetIndex(unitOfWork.Publications.Find(item => item.AccountPublications
                                                                           .Any(publication => publication.Account.TypeId == 1 && publication.Account.ResearcherAccounts
                                                                                .Any(researcher => researcher.Researcher.ChairId == ChairId))).Select(item => item.CitationCount));
        }
Example #2
0
        public FullResearcher(DatabaseLibrary.DatabaseModel.Researcher researcher, IUnitOfWork unitOfWork)
        {
            HIndex   hIndex   = new HIndex();
            I10Index i10Index = new I10Index();

            ResearcherId = researcher.ResearcherId;
            FullName     = researcher.LastName + " " + researcher.FirstName + " " + researcher.MiddleName;
            GoogleHIndex = hIndex.GetIndex(unitOfWork.Publications.Find(item => item.AccountPublications
                                                                        .Any(publication => publication.Account.TypeId == 3 && publication.Account.ResearcherAccounts
                                                                             .Any(item1 => item1.ResearcherId == ResearcherId))).Select(item => item.CitationCount));

            GoogleHIndex5 = i10Index.GetIndex(unitOfWork.Publications.Find(item => item.AccountPublications
                                                                           .Any(publication => publication.Account.TypeId == 3 && publication.Account.ResearcherAccounts
                                                                                .Any(item1 => item1.ResearcherId == ResearcherId))).Select(item => item.CitationCount));

            PublonsHIndex = hIndex.GetIndex(unitOfWork.Publications.Find(item => item.AccountPublications
                                                                         .Any(publication => publication.Account.TypeId == 2 && publication.Account.ResearcherAccounts
                                                                              .Any(item1 => item1.ResearcherId == ResearcherId))).Select(item => item.CitationCount));

            PublonsHIndex5 = i10Index.GetIndex(unitOfWork.Publications.Find(item => item.AccountPublications
                                                                            .Any(publication => publication.Account.TypeId == 2 && publication.Account.ResearcherAccounts
                                                                                 .Any(item1 => item1.ResearcherId == ResearcherId))).Select(item => item.CitationCount));

            ScopusHIndex = hIndex.GetIndex(unitOfWork.Publications.Find(item => item.AccountPublications
                                                                        .Any(publication => publication.Account.TypeId == 1 && publication.Account.ResearcherAccounts
                                                                             .Any(item1 => item1.ResearcherId == ResearcherId))).Select(item => item.CitationCount));

            ScopusHIndex5 = i10Index.GetIndex(unitOfWork.Publications.Find(item => item.AccountPublications
                                                                           .Any(publication => publication.Account.TypeId == 1 && publication.Account.ResearcherAccounts
                                                                                .Any(item1 => item1.ResearcherId == ResearcherId))).Select(item => item.CitationCount));
        }
Example #3
0
        public static Researcher GetResearcherAsync(string userId)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            if (string.IsNullOrWhiteSpace(userId))
            {
                throw new ArgumentException("message", nameof(userId));
            }

            var researcher = new Researcher
            {
                Id     = userId,
                TypeId = 1
            };

            IWebDriver driver = WebSocket.ScopusDriver;

            lock (driver)
            {
                driver.Url = "https://www.scopus.com/authid/detail.uri?authorId=" + userId;

                HtmlDocument htmlDocument = new HtmlDocument();
                htmlDocument.LoadHtml(driver.PageSource);
                var document = htmlDocument.DocumentNode;

                researcher.FullName = document.QuerySelector("#authDetailsNameSection > div >" +
                                                             " div:nth-child(1) > div.nameSection.pull-left.col-md-5.noPadding > h2").InnerText;
                if (!Int32.TryParse(document.QuerySelector("#totalCiteCount").InnerText, out int citationCount))
                {
                    citationCount = -1;
                }
                researcher.CitationCount = citationCount;

                if (!Int32.TryParse(document.QuerySelector("#authorDetailsHindex > div > " +
                                                           "div.panel-body > span").InnerText, out int hIndex))
                {
                    hIndex = -1;
                }
                researcher.HIndex = hIndex;

                driver.Url = "https://www.scopus.com/author/document/retrieval.uri?authorId=" + userId +
                             "&tabSelected=docLi&sortType=cp-f&resultCount=200";

                htmlDocument.LoadHtml(driver.PageSource);
                document = htmlDocument.DocumentNode;

                var publicationsList = document.QuerySelectorAll("tr.searchArea");
                int i = 0;
                foreach (var item in publicationsList)
                {
                    i++;
                    try
                    {
                        var publication = new Publication
                        {
                            Title   = item.QuerySelector("td:nth-child(2)").InnerText,
                            Authors = item.QuerySelector("td:nth-child(3)").InnerText,
                            Source  = item.QuerySelector("td:nth-child(5)").InnerText
                        };

                        if (Int32.TryParse(item.QuerySelector("td:nth-child(6)").InnerText, out citationCount))
                        {
                            publication.CitationCount = citationCount;
                        }
                        else
                        {
                            publication.CitationCount = -1;
                        }

                        if (DateTime.TryParseExact(item.QuerySelector("td:nth-child(4)").InnerText,
                                                   "yyyy", System.Globalization.CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime date))
                        {
                            publication.Date = date;
                        }

                        researcher.Publications.Add(publication);
                    }
                    catch
                    {
                        Console.WriteLine(i);
                    }
                }
            }
            //driver.Quit();
            I10Index index = new I10Index();

            researcher.I10Index = index.GetIndex(researcher.Publications.Select(item => item.CitationCount));
            stopwatch.Stop();
            Console.WriteLine("scopus: " + stopwatch.Elapsed.TotalSeconds + " seconds");
            return(researcher);
        }
Example #4
0
        public static Researcher GetResearcherAsync(string userId)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            if (string.IsNullOrWhiteSpace(userId))
            {
                throw new ArgumentException("message", nameof(userId));
            }

            var researcher = new Researcher
            {
                TypeId = 2
            };

            IWebDriver driver = WebSocket.PublonsDriver;

            lock (driver)
            {
                driver.Url = @"https://publons.com/researcher/" + userId;

                string url = driver.Url;

                researcher.Id = url.Substring("https://publons.com/researcher/".Length).Split('/').First();

                HtmlDocument htmlDocument = new HtmlDocument();
                htmlDocument.LoadHtml(driver.PageSource);
                var document = htmlDocument.DocumentNode;

                researcher.FullName = document.QuerySelector("#researcher-profile-page-content >" +
                                                             " div > div.researcher-profile-page-header > div > div.researcher-card-container.no-badges >" +
                                                             " div.researcher-card-header > h2").InnerText;

                if (!Int32.TryParse(document.QuerySelector("#researcher-profile-page-content > div > " +
                                                           "div.researcher-profile-page-header > div > div.researcher-card-container.no-badges > " +
                                                           "div.researcher-card-metrics.left-bar-figures > div:nth-child(2) > p").InnerText, out int citationCount))
                {
                    citationCount = -1;
                }
                researcher.CitationCount = citationCount;

                if (!Int32.TryParse(document.QuerySelector("#researcher-profile-page-content > div >" +
                                                           " div.researcher-profile-page-header > div > div.researcher-card-container.no-badges >" +
                                                           " div.researcher-card-metrics.left-bar-figures > div.left-bar-figure.left-bar-figure-large" +
                                                           " > p").InnerText.Split(' ').First(), out int hIndex))
                {
                    hIndex = -1;
                }
                researcher.HIndex = hIndex;

                int page = 1;
                while (true)
                {
                    var url1 = "https://publons.com/researcher/api/" + researcher.Id +
                               "/publications/?ordering=citations&page=" + page + "&per_page=30";

                    var result = Newtonsoft.Json.JsonConvert.DeserializeObject <Account>(WebSocket.GetPageAsync(url1));

                    foreach (var item in result.results)
                    {
                        var publication = new Publication
                        {
                            Title   = item.title,
                            Authors = string.Empty
                        };
                        if (item.journal != null)
                        {
                            publication.Source = item.journal.title;
                        }

                        citationCount = 0;
                        if (item.citationCount != null)
                        {
                            if (!Int32.TryParse(item.citationCount, out citationCount))
                            {
                            }
                        }
                        publication.CitationCount = citationCount;

                        if (DateTime.TryParseExact(item.datePublished, "MMM yyyy",
                                                   System.Globalization.CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime date))
                        {
                            publication.Date = date;
                        }
                        else if (DateTime.TryParseExact(item.datePublished, " yyyy",
                                                        System.Globalization.CultureInfo.InvariantCulture, DateTimeStyles.None, out date))
                        {
                            publication.Date = date;
                        }

                        researcher.Publications.Add(publication);
                    }
                    if (result.count - page * 30 <= 0)
                    {
                        break;
                    }

                    page++;
                }
            }
            //driver.Quit();
            I10Index index = new I10Index();

            researcher.I10Index = index.GetIndex(researcher.Publications.Select(item => item.CitationCount));
            stopwatch.Stop();
            Console.WriteLine("publons: " + stopwatch.Elapsed.TotalSeconds + " seconds");
            return(researcher);
        }