示例#1
0
        public ResultList getMSASCitations(soid s)
        {
            Searcher   searcher   = new Searcher();
            ResultList resultList = new ResultList();

            String URL;

            s.c.ReportProgress(10, null);
            if (s.c.CancellationPending)
            {
                return(null);
            }
            MSASQueryURLBuilder citationBuild = new MSASQueryURLBuilder();

            s.c.ReportProgress(40, null);
            URL = citationBuild.buildCitationUrl(s.i, s.sOrder, s.start);
            if (s.c.CancellationPending)
            {
                return(null);
            }
            s.c.ReportProgress(60, null);
            resultList = searcher.MSASsearchCitationUrl(URL);
            s.c.ReportProgress(90, null);
            if (s.c.CancellationPending)
            {
                return(null);
            }
            return(resultList);
            //tab.setResult(resultList);
        }
示例#2
0
        public ResultList MSASbuildQuery(Query query)
        {
            MSASQueryURLBuilder MSB = new MSASQueryURLBuilder();
            String URL = MSB.buildQuery(query);

            this.query = query;

            var strUrl = new Uri(URL);

            Console.WriteLine(URL);
            this.resultList.resultType = query.resultType;
            this.resultList.loadType();
            this.resultList = MSASConnectFetch(strUrl);
            return(this.resultList);
        }
示例#3
0
        public ResultList initiateSearch(data d)
        {
            String queryString = d.qs;
                       //tab.getSearchBoxText();
            if (d.b.CancellationPending)
            {
                return null;
            }
            if (queryString == null || queryString == "")
                   {
                       TabPage.displayError("Please Enter a Query");
                       return null;
                   }
                   
                   d.b.ReportProgress(0, null);
                   int ylo = d.yl;
                   int yhi = d.yh;  //tab.getYhi();
                   Boolean includeCitations = d.ic;  // tab.getIncludePatents();
                   SortOrder sortOrder = d.so;  //tab.getSortOrder();
                   ResultType resultType = d.rt; // tab.getResultType();

                   d.b.ReportProgress(10, null);
                   Query query = new Query();
                   query.setqueryString(queryString);
                   if (ylo != 0)
                       query.setylo(ylo);
                   if (yhi != 0)
                       query.setyhi(yhi);
                   query.setincludePatents(includeCitations);
                   query.sortOrder = sortOrder;
                   query.resultType = resultType;
                   query.setpageid(d.pageId);

                   if (d.b.CancellationPending)
                   {
                       return null;
                   }

                   //bool networkUp = System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable();
                   bool networkUp = Controller.CheckForInternetConnection();
                   Console.WriteLine(networkUp);
                   if (networkUp)
                   {
                       Searcher searcher = new Searcher();
                       ResultList resultListGS = new ResultList();

                       ResultList resultListMS = new ResultList();

                       ResultList resultList = new ResultList();


                       SearchType type;
                       d.b.ReportProgress(20, null);
                       resultListGS = searcher.GSsearch(query);
                       if (d.b.CancellationPending)
                       {
                           return null;
                       }
                       d.b.ReportProgress(50, null);
                       resultListMS = searcher.MSASsearch(query);
                       if (d.b.CancellationPending)
                       {
                           return null;
                       }
                       d.b.ReportProgress(70, null);

                       if (resultListMS != null)
                           resultList = resultListMS;
                       else if (resultListMS == null && resultListGS != null)
                           resultList = resultListGS;
                       else
                       {
                           TabPage.displayError("Cannot connect to Data Sources.");
                           return null;
                       }
                       if (d.b.CancellationPending)
                       {
                           return null;
                       }

                       d.b.ReportProgress(85, null);

                       if (resultListGS != null)
                       {
                           if (resultListGS.type != null)
                           resultList.type = resultListGS.type;
                           
                       }
                       else
                       {
                           MSASQueryURLBuilder MSQ = new MSASQueryURLBuilder();
                           String URL = "";
                           if (resultType == ResultType.AUTHOR)
                           {
                               URL = MSQ.buildAuthorUrl(queryString);
                           }
                           else if (resultType == ResultType.JOURNAL)
                           {
                               URL = MSQ.buildJournalUrl(queryString);
                           }
                           
                           Uri url = new Uri(URL);
                           Console.WriteLine(url.ToString());
                           MSASParser parser = new MSASParser();
                           if (resultType == ResultType.AUTHOR)
                           {
                               resultList.resultType = ResultType.AUTHOR;
                               resultList.type = parser.MSParseProfile(url, queryString, resultType);
                           }
                           else
                           {
                               resultList.resultType = ResultType.JOURNAL;
                               resultList.loadType();
                               Console.WriteLine("Reached");
                               resultList.type =(Journal) parser.MSParseJournal(queryString);
                               Console.WriteLine(";;;;;"+resultList.type);
                           }
                           if (d.b.CancellationPending)
                           {
                               return null;
                           }

                       }

                       //      tab.setResult(resultList);    

                       if (d.b.CancellationPending)
                       {
                           
                           return null;
                       }

                       d.b.ReportProgress(100, null);
                       return resultList;
                   }

                   else
                   {
                       TabPage.displayError("Oops !! No Internet Connection !!!");

                       return null;

                   }
        }
示例#4
0
        public ResultList getMSASCitations(soid s)
       {
           Searcher searcher = new Searcher();
           ResultList resultList = new ResultList();

           String URL;
           s.c.ReportProgress(10, null);
           if (s.c.CancellationPending) return null;
           MSASQueryURLBuilder citationBuild = new MSASQueryURLBuilder();
           s.c.ReportProgress(40, null);
           URL = citationBuild.buildCitationUrl(s.i,s.sOrder,s.start);
           if (s.c.CancellationPending) return null;
           s.c.ReportProgress(60, null);
           resultList = searcher.MSASsearchCitationUrl(URL);
           s.c.ReportProgress(90, null);
           if (s.c.CancellationPending) return null;
           return resultList;
            //tab.setResult(resultList);


       }
示例#5
0
        public ResultList MSASbuildQuery(Query query)
        {

            MSASQueryURLBuilder MSB = new MSASQueryURLBuilder();
            String URL = MSB.buildQuery(query);
            this.query = query;

            var strUrl = new Uri(URL);
            Console.WriteLine(URL);
            this.resultList.resultType = query.resultType;
            this.resultList.loadType();
            this.resultList = MSASConnectFetch(strUrl);
            return this.resultList;


        }
示例#6
0
        public ResultList initiateSearch(data d)
        {
            String queryString = d.qs;

            //tab.getSearchBoxText();
            if (d.b.CancellationPending)
            {
                return(null);
            }
            if (queryString == null || queryString == "")
            {
                TabPage.displayError("Please Enter a Query");
                return(null);
            }

            d.b.ReportProgress(0, null);
            int        ylo = d.yl;
            int        yhi = d.yh;              //tab.getYhi();
            Boolean    includeCitations = d.ic; // tab.getIncludePatents();
            SortOrder  sortOrder        = d.so; //tab.getSortOrder();
            ResultType resultType       = d.rt; // tab.getResultType();

            d.b.ReportProgress(10, null);
            Query query = new Query();

            query.setqueryString(queryString);
            if (ylo != 0)
            {
                query.setylo(ylo);
            }
            if (yhi != 0)
            {
                query.setyhi(yhi);
            }
            query.setincludePatents(includeCitations);
            query.sortOrder  = sortOrder;
            query.resultType = resultType;
            query.setpageid(d.pageId);

            if (d.b.CancellationPending)
            {
                return(null);
            }

            //bool networkUp = System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable();
            bool networkUp = Controller.CheckForInternetConnection();

            Console.WriteLine(networkUp);
            if (networkUp)
            {
                Searcher   searcher     = new Searcher();
                ResultList resultListGS = new ResultList();

                ResultList resultListMS = new ResultList();

                ResultList resultList = new ResultList();


                SearchType type;
                d.b.ReportProgress(20, null);
                resultListGS = searcher.GSsearch(query);
                if (d.b.CancellationPending)
                {
                    return(null);
                }
                d.b.ReportProgress(50, null);
                resultListMS = searcher.MSASsearch(query);
                if (d.b.CancellationPending)
                {
                    return(null);
                }
                d.b.ReportProgress(70, null);

                if (resultListMS != null)
                {
                    resultList = resultListMS;
                }
                else if (resultListMS == null && resultListGS != null)
                {
                    resultList = resultListGS;
                }
                else
                {
                    TabPage.displayError("Cannot connect to Data Sources.");
                    return(null);
                }
                if (d.b.CancellationPending)
                {
                    return(null);
                }

                d.b.ReportProgress(85, null);

                if (resultListGS != null)
                {
                    if (resultListGS.type != null)
                    {
                        resultList.type = resultListGS.type;
                    }
                }
                else
                {
                    MSASQueryURLBuilder MSQ = new MSASQueryURLBuilder();
                    String URL = "";
                    if (resultType == ResultType.AUTHOR)
                    {
                        URL = MSQ.buildAuthorUrl(queryString);
                    }
                    else if (resultType == ResultType.JOURNAL)
                    {
                        URL = MSQ.buildJournalUrl(queryString);
                    }

                    Uri url = new Uri(URL);
                    Console.WriteLine(url.ToString());
                    MSASParser parser = new MSASParser();
                    if (resultType == ResultType.AUTHOR)
                    {
                        resultList.resultType = ResultType.AUTHOR;
                        resultList.type       = parser.MSParseProfile(url, queryString, resultType);
                    }
                    else
                    {
                        resultList.resultType = ResultType.JOURNAL;
                        resultList.loadType();
                        Console.WriteLine("Reached");
                        resultList.type = (Journal)parser.MSParseJournal(queryString);
                        Console.WriteLine(";;;;;" + resultList.type);
                    }
                    if (d.b.CancellationPending)
                    {
                        return(null);
                    }
                }

                //      tab.setResult(resultList);

                if (d.b.CancellationPending)
                {
                    return(null);
                }

                d.b.ReportProgress(100, null);
                return(resultList);
            }

            else
            {
                TabPage.displayError("Oops !! No Internet Connection !!!");

                return(null);
            }
        }