Example #1
0
 public void addEntity(Journal j)
 {
     for (int i = pos+1; i < history.Count; i++)
     {
         history.RemoveAt(pos);
     }
     history.Add(j);
     pos++;
 }
Example #2
0
        public void AddJournal(Journal a)
        {
            // add ID TO THE jOURNAL

            ListofJournal.Add(a);
            // add to file
            Stream stream = File.Open(@"Favorites\Journal", FileMode.Create);
            BinaryFormatter bFormatter = new BinaryFormatter();
            bFormatter.Serialize(stream, ListofJournal);
            stream.Close();
        }
Example #3
0
 public bool getJournalsNext(string journalName, string ISSN, string keywords, ref Journal journ)
 {
     return newJournalSearch.returnJournalNext(ref journ);
 }
Example #4
0
        public bool returnJournalNext(ref Journal journ)
        {
            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);
                journ.addPaper(paper1);
            }

            int check = LoadNextPage();

            if (check == 1)
                return true;
            else
                return false;
        }
Example #5
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();
        }
Example #6
0
 public void Add(Journal j)
 {
     journals.Add(j);
 }
        public SG.Journal getJournals(string journalName, string ISSN, string keywords, int noResults = 20)
        {
            Request requestJournal = new Request();
            requestJournal.AppID = "c49b4e59-08dd-4f27-a53b-53cc72f169af";
            //Response response;

            SG.Journal journ = new SG.Journal(journalName);

            requestJournal.ResultObjects = ObjectType.Publication;
            requestJournal.JournalQuery = journalName;

            //requestJournal.FulltextQuery = keywords;

            requestJournal.StartIdx = 1;
            requestJournal.EndIdx = 20;

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

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

            return journ;
        }