예제 #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;
        }
예제 #2
0
        public CitationsTab(Paper paper, int type)
        {
            InitializeComponent();
            authorResultsListView.ColumnClick += new ColumnClickEventHandler(authorResultsListView_ColumnClick);
            authorResultsListView.FullRowSelect = true;
            authorResultsListView.MouseClick += new MouseEventHandler(authorResultsListView_MouseClick);
            authorResultsListView.MouseDoubleClick += new MouseEventHandler(authorResultsListView_MouseDoubleClick);
            authorResultsListView.DrawItem += ListView_DrawItem;
            authorResultsListView.DrawColumnHeader += ListView_DrawColumnHeader;
            abstractBox.GotFocus += abstractBox_GotFocus;

            CSParser = new CSXParser();
            GSScraper = new GSScraper();
            MSParser = new MicrosoftScholarParser();

            this.paper = paper;
            this.type = type;
            lastCount = 0;
            STOP = false;

            showStatistics();

            getCitations();
        }
예제 #3
0
파일: Paper.cs 프로젝트: patwaria/pubcite
 //add a paper p to the list of citations of the Paper - read only
 public void addCitation(Paper p)
 {
     citations.Add(p);
 }
예제 #4
0
 //url pointing to web page of a paper
 public List<Paper> getCitations(string url)
 {
     CSXPubli c = new CSXPubli(url);
     List<Paper> p=new List<Paper>();
     Paper pEle;
     if (c.citeList != null)
     {
         for (int i = 0; i < c.citeList.Count; i++)
         {
             pEle = new Paper(c.citeList[i].title, c.citeList[i].url, c.citeList[i].authNames, c.citeList[i].abs, c.citeList[i].year, "", "", c.citeList[i].numCit, c.citeList[i].url, 0);
             p.Add(pEle);
         }
     }
     return p;
 }
예제 #5
0
        public bool getCitationsNext(string url,ref List<Paper> p)
        {
            HtmlWeb web; web = new HtmlWeb();
            HtmlDocument doc;
            HtmlNode n;

            if (url.Contains("viewdoc"))//e.g. http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.31.3487
            {
                doc = web.Load(url);
                HtmlNode citUrl = doc.DocumentNode.SelectSingleNode("//*[@id=\"docCites\"]/td[2]/a");
                if (citUrl == null)
                    return false;
                url = "http://citeseer.ist.psu.edu" + citUrl.GetAttributeValue("href", "");
            }

            SettingsRecord sr = new SettingsRecord();
            Settings s = sr.ReadSettings();
            if (p.Count % 10 != 0 || p.Count >= s.CiteSeerMaxResults)
                return false;

            int pagen = p.Count;
            url = url + "&sort=cite&start=" + p.Count;

            doc = web.Load(url);

            if (doc != null)
                Console.WriteLine("Document Loaded!");
            else
            {
                Console.WriteLine("Load Error!");
                return false;
            }

            HtmlNodeCollection rows;
            Paper tempPaperObj;

            rows = doc.DocumentNode.SelectNodes("//*[@id=\"result_list\"]/div");
            if(rows==null)
            {
                Console.WriteLine("Load Error! Next page doesn't exist! Returned.");
                return false;
            }

            for (int i = 0; i < rows.Count; i++)
            {
                int numCit=0, year=0;
                string title="", authNames="", abs, pUrl="";
                if (rows[i].SelectSingleNode("div[3]/a[@title=\"number of citations\"]") != null)
                {
                    try
                    {
                        int comI = rows[i].SelectSingleNode("div[3]/a[@title=\"number of citations\"]").InnerText.Substring(9).IndexOf(' ');
                        if (rows[i].SelectSingleNode("div[3]/a[@title=\"number of citations\"]").InnerText.Substring(9).Remove(comI) != null)
                            numCit = Convert.ToInt32((rows[i].SelectSingleNode("div[3]/a[@title=\"number of citations\"]").InnerText.Substring(9).Remove(comI)));
                    }
                    catch (Exception e) { }
                }
                else
                    numCit = 0;

                try
                {
                    title = rows[i].SelectSingleNode("h3/a").InnerText.Trim();
                    authNames = rows[i].SelectSingleNode("div[1]/span[1]").InnerText.Substring(3).Trim();
                }
                catch (Exception e) { }

                String tempYear;
                if (rows[i].SelectSingleNode("div[1]/span[@class=\"pubyear\"]") != null)
                {
                    try
                    {
                        tempYear = rows[i].SelectSingleNode("div[1]/span[@class=\"pubyear\"]").InnerText;
                        if (tempYear != null)
                            year = Convert.ToInt32(tempYear.Substring(2));
                    }
                    catch (Exception e) { }
                }
                else year = 0;

                if (rows[i].SelectSingleNode("div[2]") != null)
                    abs = rows[i].SelectSingleNode("div[2]").InnerText;
                else
                    abs = "";

                try
                {
                    pUrl = "http://citeseer.ist.psu.edu" + rows[i].SelectSingleNode("h3/a").GetAttributeValue("href", "");
                }
                catch (Exception e) { }

                tempPaperObj = new Paper(title, pUrl, authNames, abs, year, "", "", numCit, pUrl, 0);

                //if (tempPaperObj.NumberOfCitations > 0)
                    p.Add(tempPaperObj);
            }

            return true;
        }
예제 #6
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;
        }
예제 #7
0
 //function to add paper to the paper list
 public void addPaper(Paper p)
 {
     papers.Add(p);
 }
예제 #8
0
        private void viewCitationsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
                MessageBox.Show("Warning: Please check your Internet connection!");
            else
            {
                for (int i = 0; i < 4; i++) prevSortedColum[i] = false;
                citationIndex = authorResultsListView.FocusedItem.Index;

                if (Papers[citationIndex].NumberOfCitations != 0)
                {
                    paper = Papers[citationIndex];

                    showStatistics();

                    getCitations();
                }
            }
        }
예제 #9
0
        //--------------------------------------------------------------------------------------------------------//
        public List<Paper> generatePaper(Request request, int numberofResult, int initialNO=0)
        {
            List<Paper> papers = new List<Paper>();
            Response response;
            try
            {
                response = client.Search(request);
            }
            catch (Exception e)
            {
                return papers;
            }

            if (response.Publication == null)
                return papers;

            for (int i = 0; i <response.Publication.Result.Length; i++)
            {
                initialNO++;
                if (initialNO > masMaxResults)
                    break;

                Paper paper;
                String title, authors, publication, pap_abstract, url, id_;
                int numOfCitations, year;

                authors = "";
                title = response.Publication.Result[i].Title;
                for (int j = 0; j < response.Publication.Result[i].Author.Length; j++)
                {
                    authors = authors + generateName(response.Publication.Result[i].Author[j].FirstName, response.Publication.Result[i].Author[j].MiddleName, response.Publication.Result[i].Author[j].LastName) + ", ";
                }

                numOfCitations = Convert.ToInt32(response.Publication.Result[i].CitationCount);
                year = Convert.ToInt32(response.Publication.Result[i].Year);

                publication = "";
                if (response.Publication.Result[i].Journal != null)
                    publication = response.Publication.Result[i].Journal.FullName;

                url = "";
                if (response.Publication.Result[i].FullVersionURL.Length != 0)
                    url = response.Publication.Result[i].FullVersionURL[0];

                id_ = Convert.ToString(response.Publication.Result[i].ID);

                pap_abstract = response.Publication.Result[i].Abstract;
                if (pap_abstract == null)
                    pap_abstract = "";

                paper = new Paper(title, url, authors, pap_abstract, year, publication, "", numOfCitations, id_, 0);

                papers.Add(paper);
            }

            return papers;
        }
예제 #10
0
        public bool getCitationsNext(String id, ref List<Paper> cited)
        {
            int no = cited.Count;
            int flag = 0;

            UInt32 paperID;
            try
            {
                paperID = Convert.ToUInt32(id);
            }
            catch (Exception e)
            {
                return false;
            }

            int stIndex, endIndex;
            Request requestCitedPaper = new Request();
            requestCitedPaper.AppID = "c49b4e59-08dd-4f27-a53b-53cc72f169af";
            Response response;

            stIndex = cited.Count + 1;
            endIndex = cited.Count + 100;

            requestCitedPaper.ResultObjects = ObjectType.Publication;
            requestCitedPaper.ReferenceType = ReferenceRelationship.Citation;
            requestCitedPaper.PublicationID = paperID;
            requestCitedPaper.StartIdx = Convert.ToUInt32(stIndex);
            requestCitedPaper.EndIdx = Convert.ToUInt32(endIndex);

            try
            {
                response = client.Search(requestCitedPaper);
            }
            catch (Exception e)
            {
                return false;
            }

            for (int i = 0; i < response.Publication.Result.Length; i++)
            {
                no++;
                if (no > masMaxResults)
                {
                    flag = 1;
                    break;
                }

                Paper paper;
                String title, authors, publication, pap_abstract;
                int numOfCitations, year;

                authors = "";
                title = response.Publication.Result[i].Title;
                for (int j = 0; j < response.Publication.Result[i].Author.Length; j++)
                {
                    authors = authors + generateName(response.Publication.Result[i].Author[j].FirstName, response.Publication.Result[i].Author[j].MiddleName, response.Publication.Result[i].Author[j].LastName) + ", ";
                }
                numOfCitations = Convert.ToInt32(response.Publication.Result[i].CitationCount);
                year = Convert.ToInt32(response.Publication.Result[i].Year);

                publication = "";
                if (response.Publication.Result[i].Journal != null)
                    publication = response.Publication.Result[i].Journal.FullName;

                String url = "";
                if (response.Publication.Result[i].FullVersionURL.Length != 0)
                    url = response.Publication.Result[i].FullVersionURL[0];

                String id_ = Convert.ToString(response.Publication.Result[i].ID);

                pap_abstract = response.Publication.Result[i].Abstract;
                if (pap_abstract == null)
                    pap_abstract = "";

                paper = new Paper(title, url, authors, pap_abstract, year, publication, "", numOfCitations, id_, 0);

                cited.Add(paper);
            }

            if (response.Publication.Result.Length < 100 || flag==1)
                return false;
            else
                return true;
        }
예제 #11
0
        public List<Paper> getCitations(String id, int noResults=20)
        {
            //Console.WriteLine("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

            List<Paper> cited = new List<Paper>();
            UInt32 paperID;
            try
            {
                paperID = Convert.ToUInt32(id);
            }
            catch (Exception e)
            {
                return cited;
            }

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

            requestCitedPaper.ResultObjects = ObjectType.Publication;
            requestCitedPaper.ReferenceType = ReferenceRelationship.Citation;
            requestCitedPaper.PublicationID = paperID;
            requestCitedPaper.StartIdx = 1;
            requestCitedPaper.EndIdx = Convert.ToUInt32(noResults);

            try
            {
                response = client.Search(requestCitedPaper);
            }
            catch (Exception e)
            {
                return cited;
            }

            uint range = response.Publication.TotalItem;
            range = range > noResults ? Convert.ToUInt32(noResults) : range;

            for (int i = 0; i < range; i++)
            {
                Paper paper;
                String title, authors, publication, pap_abstract;
                int numOfCitations, year;

                authors = "";
                title = response.Publication.Result[i].Title;
                for (int j = 0; j < response.Publication.Result[i].Author.Length; j++)
                {
                    authors = authors + generateName(response.Publication.Result[i].Author[j].FirstName, response.Publication.Result[i].Author[j].MiddleName, response.Publication.Result[i].Author[j].LastName) + ", ";
                }
                numOfCitations = Convert.ToInt32(response.Publication.Result[i].CitationCount);
                year = Convert.ToInt32(response.Publication.Result[i].Year);

                publication = "";
                if (response.Publication.Result[i].Journal != null)
                    publication = response.Publication.Result[i].Journal.FullName;

                String url = "";
                if (response.Publication.Result[i].FullVersionURL.Length != 0)
                    url = response.Publication.Result[i].FullVersionURL[0];

                String id_ = Convert.ToString(response.Publication.Result[i].ID);

                pap_abstract = response.Publication.Result[i].Abstract;
                if (pap_abstract == null)
                    pap_abstract = "";

                paper = new Paper(title, url, authors,pap_abstract, year, publication, "", numOfCitations, id_, Convert.ToInt32(i + (range / 100) * 100));

                cited.Add(paper);

                /*Console.WriteLine(title);
                Console.WriteLine(authors);
                Console.WriteLine(year);
                Console.WriteLine(numOfCitations);
                Console.ReadLine();*/
            }

            return cited;
        }