Beispiel #1
0
        public Author getAuthStatistics(string authUrl)
        {
            CSXAuth a = new CSXAuth(authUrl);
            Author authObj = new Author(a.authName, a.affiliation, a.homePageURL, a.hIndex, a.i10Index);

            for (int i = 0; i < a.numPub; i++)
            {
                Paper p = new Paper(a.publiList[i].title, a.authName, a.publiList[i].year, a.publiList[i].journal, "", a.publiList[i].numCit,a.publiList[i].url,0);
                authObj.addPaper(p);
            }

            return authObj;
        }
        public SG.Author getAuthors(string authName, string affiliation, string keywords, int noResults=20)
        {
            SG.Author auth = new SG.Author(authName);

            Request requestPaper = new Request();
            requestPaper.AppID = "c49b4e59-08dd-4f27-a53b-53cc72f169af";
               // Response response2;

            requestPaper.ResultObjects = ObjectType.Publication;
            requestPaper.AuthorQuery = authName;
            //requestPaper.FulltextQuery = keywords;
            requestPaper.StartIdx = 1;
            requestPaper.EndIdx = 20;

            List<SG.Paper> papers = generatePaper(requestPaper, 20);

            for (int i = 0; i < papers.Count; i++)
            {
                auth.addPaper(papers[i]);
            }

            return auth;
        }
Beispiel #3
0
        public bool returnAuthorNext(ref Author auth)
        {
            HtmlNode mainTable = CiteDoc.DocumentNode.SelectSingleNode("//*[@id=\"result_list\"]");
            HtmlNode entryNoNode, paperNode, authorNode, journalNode, yearNode, citationNode;
            string paperName, authorName, journalName, publishYear, noCitations, citationLink, paperURL;
            int citno;

            if (noResult == 0)
                return false;
            if (CiteDoc.DocumentNode.SelectSingleNode("//*[@id=\"result_list\"]") == null)
                return false;

            mainTable = CiteDoc.DocumentNode.SelectSingleNode("//*[@id=\"result_list\"]");
            for (int i = 1; i <= 10; i++)
            {
                entryNoNode = mainTable.SelectSingleNode("div[" + i + "]");
                if (entryNoNode == null)
                    break;

                paperURL = "";
                paperNode = entryNoNode.SelectSingleNode("h3/a");
                if (paperNode == null)
                {
                    paperNode = entryNoNode.SelectSingleNode("h3/span");
                    paperName = paperNode.InnerText;

                    paperName = paperName.Substring(37);
                }
                else
                {
                    paperName = paperNode.InnerText.Substring(19);

                    if (paperNode.Attributes["href"] != null)
                        paperURL = "http://citeseer.ist.psu.edu" + paperNode.Attributes["href"].Value;
                }

                //Console.WriteLine(paperName);
                //Now remove unwanted preceding character and spaces from paperName


                authorNode = entryNoNode.SelectSingleNode("div[1]/span[1]");
                authorName = authorNode.InnerText;
                authorName = authorName.Substring(22);
                //Now remove unwanted preceding character and spaces from authorName

                if (entryNoNode.SelectSingleNode("div[1]/span[3]") == null)
                {
                    journalName = "";
                    yearNode = entryNoNode.SelectSingleNode("div[1]/span[2]");
                    if (yearNode == null)
                        publishYear = "0";
                    else
                    {
                        publishYear = yearNode.InnerText;
                        publishYear = publishYear.Substring(2);
                    }
                }
                else
                {
                    journalNode = entryNoNode.SelectSingleNode("div[1]/span[2]");
                    journalName = journalNode.InnerText;
                    journalName = journalName.Substring(2);

                    yearNode = entryNoNode.SelectSingleNode("div[1]/span[3]");
                    publishYear = yearNode.InnerText;
                    publishYear = publishYear.Substring(2);
                }
                //Process publishYear and journalNode to get important data

                citationNode = entryNoNode.SelectSingleNode("div[3]/a");
                if (citationNode.InnerText == "Abstract")
                    citationNode = entryNoNode.SelectSingleNode("div[3]/a[2]");
                noCitations = citationNode.InnerText;   //remove unnecessary details from the number of citations
                noCitations = noCitations.Substring(9);
                // Console.WriteLine(noCitations);
                if (citationNode.Attributes["href"] == null)
                    citationLink = "";
                else
                    citationLink = "http://citeseer.ist.psu.edu" + citationNode.Attributes["href"].Value;


                citno = 0;
                if (noCitations[0] != 't')
                    for (int j = 0; noCitations[j] != ' '; j++)
                    {
                        citno = citno * 10 + Convert.ToInt32(noCitations[j]) - 48;
                    }

                //Now the processed strings are to be entered on the type of author
                int year;

                try
                {
                    year = Convert.ToInt32(publishYear);
                }
                catch (Exception e)
                {
                    year = 0;
                }

                Paper paper1 = new Paper(paperName, paperURL, authorName, year, journalName, "", citno, citationLink, (PageNo - 1) * 10 + i);
                auth.addPaper(paper1);
            }

            int check = LoadNextPage();

            if (check == 1)
                return true;
            else
                return false;
        }
        public SG.Author getAuthStatistics(string authid, int noResults=20)
        {
            SG.Author auth;
            string name, affiliation, homePageURl;
            int Hindex;

            Request requestAuth = new Request();
            requestAuth.AppID = "c49b4e59-08dd-4f27-a53b-53cc72f169af";
            Response response1;

            requestAuth.ResultObjects = ObjectType.Author;
            requestAuth.AuthorID = Convert.ToUInt32(authid);
            requestAuth.StartIdx = 1;
            requestAuth.EndIdx = 1;

            try
            {
                response1 = client.Search(requestAuth);
            }
            catch (Exception e)
            {
                auth = new SG.Author("");
                return auth;
            }

            name = generateName(response1.Author.Result[0].FirstName, response1.Author.Result[0].MiddleName, response1.Author.Result[0].LastName);
            Hindex = Convert.ToInt32(response1.Author.Result[0].HIndex);

            try
            {
                affiliation = response1.Author.Result[0].Affiliation.Name;
                homePageURl = response1.Author.Result[0].HomepageURL;
            }
            catch (Exception e)
            {
                affiliation = "";
                homePageURl = "";
            }
            auth = new SG.Author(name,affiliation,homePageURl,-1,-1);

            Request requestPaper = new Request();
            requestPaper.AppID = "c49b4e59-08dd-4f27-a53b-53cc72f169af";

            requestPaper.ResultObjects = ObjectType.Publication;
            requestPaper.AuthorID = Convert.ToUInt32(authid);
            requestPaper.StartIdx = 1;
            requestPaper.EndIdx = 20;

            List<SG.Paper> papers = generatePaper(requestPaper, 20);

            for (int i = 0; i < papers.Count; i++)
            {
                auth.addPaper(papers[i]);
            }

            return auth;
        }