Esempio n. 1
0
 //everytime a new search is made, new entity has to be added to the history list using this function.
 public void addEntity(Author a)
 {
     for (int i = pos + 1; i < history.Count; i++)
     {
         history.RemoveAt(pos);
     }
     history.Add(a);
     pos++;
 }
Esempio n. 2
0
 public void AddAuthor(Author a)
 {
     // ADD id TO THE AUTHOR
     //Console.WriteLine("URL:" + a.HomePageURL);
     ListofAuthor.Add(a);
     // add to file
     Stream stream = File.Open(@"Favorites\Author", FileMode.Create);
     BinaryFormatter bFormatter = new BinaryFormatter();
     bFormatter.Serialize(stream, ListofAuthor);
     stream.Close();
 }
Esempio n. 3
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;
        }
Esempio n. 4
0
 public bool getAuthorsNext(string authName, string affiliation, string keywords, ref Author auth)
 {
     return newAuthorSearch.returnAuthorNext(ref auth);
 }
Esempio n. 5
0
 public void Add(Author a)
 {
     authors.Add(a);
 }
Esempio n. 6
0
        public CiteSeerJournal_FinalAuthorSearch(string searchEle, int searchTy, string affISSN, string key)  //searchType 0 for authorSearch, 1 for journalSearch
        {

            SettingsRecord sett = new SettingsRecord();
            Settings set = sett.ReadSettings();
            maxResults = set.CiteSeerMaxResults;

            searchElement = searchEle;
            searchType = searchTy;
            keyword = key;
            affiliation = "";
            ISSN = "";

            auth1 = new Author(searchEle);
            journ1 = new Journal(searchEle);

            keyword = keyword.Trim();
            keyword = Regex.Replace(keyword, @"\s+", " ");
            keyword = keyword.Replace(" ", "+");

            searchElement = searchElement.Trim();
            searchElement = Regex.Replace(searchElement, @"\s+", " ");
            searchElement = searchElement.Replace(" ", "+");

            if (searchType == 0)
            {
                //initialURL = "http://citeseerx.ist.psu.edu/search?q=author%3A%28" + searchElement + "%29&submit=Search&ic=1&sort=cite&t=doc";
                affiliation = affISSN;
                affiliation = affiliation.Trim();
                affiliation = Regex.Replace(affiliation, @"\s+", " ");
                affiliation = affiliation.Replace(" ", "+");

                initialURL = "http://citeseerx.ist.psu.edu/search?q=author%3A%28" + searchElement + "%29&submit=Search&ic=1&sort=cite&t=doc";
            }
            else if (searchType == 1)
            {
                ISSN = ISSN.Trim();
                ISSN = ISSN.Replace(" ", "");

                //Console.WriteLine(searchElement + ",  " + keyword + ",  " + ISSN);
                initialURL = "http://citeseerx.ist.psu.edu/search?q=venue%3A%28" + searchElement + "%29&submit=Search&ic=1&sort=cite&t=doc";
                
                //Console.WriteLine(initialURL);
            }
            else
            {
                initialURL = "";
            }
            CitePage = new HtmlWeb();

            noResult = 10;
            try
            {
                CiteDoc = CitePage.Load(initialURL);
            }
            catch (Exception e)
            {
                noResult = 0;
            }
            PageNo = 1;

            //Console.WriteLine("Document opened");

            getNoResult();
        }
Esempio n. 7
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;
        }
Esempio n. 8
0
        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;
        }
Esempio n. 9
0
        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;
        }