Beispiel #1
0
 public Boolean Equals(Query q)
 {
     if (!(queryString.Equals(q.getqueryString())))
     {
         return(false);
     }
     if (!(ylo.Equals(q.getylo())))
     {
         return(false);
     }
     if (!(yhi.Equals(q.getyhi())))
     {
         return(false);
     }
     if (!(includePatents.Equals(q.getincludePatents())))
     {
         return(false);
     }
     if (!(id.Equals(q.getpageid())))
     {
         return(false);
     }
     if (!(sortOrder.Equals(q.sortOrder)))
     {
         return(false);
     }
     if (!(resultType.Equals(q.resultType)))
     {
         return(false);
     }
     return(true);
 }
        public String buildQuery(Query query)
        {
            //normal search (sort by citations)
            // sort by citations not implemented
            String queryURL, queryURLStat1, queryURLStat2;
            queryURL = null;
            String queryPart1 = "http://scholar.google.co.in/scholar?as_q=&as_occt=any&";
            String searchString = null;
            searchString = query.getqueryString();

            searchString = searchString.Replace(" ", "+");

            if (query.resultType == ResultType.AUTHOR)
            {
                queryPart1 = queryPart1 + "as_sauthors=" + "\"" + searchString + "\"";
            }

            else if (query.resultType == ResultType.JOURNAL)
            {
                queryPart1 = queryPart1 + "as_publication=" + "\"" + searchString + "\"";
            }

            int patentChoice;
            String queryPart2 = "&hl=en&as_sdt=";
            if (!query.getincludePatents())
                patentChoice = 0;
            else
                patentChoice = 1;
            queryPart2 += patentChoice;
            queryPart2 += "%2C5&as_vis=1";

            //sort by citations
            if (query.sortOrder == SortOrder.CITATIONS && (query.issetyhi() && query.issetylo()))
            {
                queryURL = queryPart1 + queryPart2;
                queryURLStat1 = queryURL;
            }

            //sort by date
            else if (query.sortOrder == SortOrder.CITATIONS && !(query.issetyhi() && query.issetylo()))
            {
                int year = 2013;
                queryURL = queryPart1 + "&as_ylo=&as_yhi=" + queryPart2;
                year--;


            }

            //search for custom year range and sorted by citations
            else if ((query.issetyhi() && query.issetylo()) && query.sortOrder == SortOrder.CITATIONS)
            {

                queryURL = queryPart1 + "&as_ylo=" + query.getylo() + "&as_yhi=" + query.getyhi() + queryPart2;
                queryURLStat2 = queryURL;
            }

            //search for custome year range and sorted by date
            else if (query.sortOrder == SortOrder.DATE && (query.issetyhi() && query.issetylo()))
            {
                queryURL = queryPart1 + "&as_ylo=" + query.getylo() + "&as_yhi=" + query.getyhi() + queryPart2;
            }

            else if (query.sortOrder == SortOrder.DATE && !(query.issetyhi() && query.issetylo()))
            {
                queryURL = queryPart1 + "&as_ylo=&as_yhi=" + queryPart2;
            }

            //TODO : Need to get the correct URL.
            // #Srikar


            return queryURL;
        }
Beispiel #3
0
 public Boolean Equals(Query q)
 {
     if (!(queryString.Equals(q.getqueryString())))
         return false;
     if (!(ylo.Equals(q.getylo())))
         return false;
     if (!(yhi.Equals(q.getyhi())))
         return false;
     if (!(includePatents.Equals(q.getincludePatents())))
         return false;
     if (!(id.Equals(q.getpageid())))
         return false;
     if (!(sortOrder.Equals(q.sortOrder)))
         return false;
     if (!(resultType.Equals(q.resultType)))
         return false;
     return true;
 }
Beispiel #4
0
        public String buildQuery(Query query)
        {
            //normal search (sort by citations)
            // sort by citations not implemented
            String queryURL, queryURLStat1, queryURLStat2;

            queryURL = null;
            String queryPart1   = "http://scholar.google.co.in/scholar?as_q=&as_occt=any&";
            String searchString = null;

            searchString = query.getqueryString();

            searchString = searchString.Replace(" ", "+");

            if (query.resultType == ResultType.AUTHOR)
            {
                queryPart1 = queryPart1 + "as_sauthors=" + "\"" + searchString + "\"";
            }

            else if (query.resultType == ResultType.JOURNAL)
            {
                queryPart1 = queryPart1 + "as_publication=" + "\"" + searchString + "\"";
            }

            int    patentChoice;
            String queryPart2 = "&hl=en&as_sdt=";

            if (!query.getincludePatents())
            {
                patentChoice = 0;
            }
            else
            {
                patentChoice = 1;
            }
            queryPart2 += patentChoice;
            queryPart2 += "%2C5&as_vis=1";

            //sort by citations
            if (query.sortOrder == SortOrder.CITATIONS && (query.issetyhi() && query.issetylo()))
            {
                queryURL      = queryPart1 + queryPart2;
                queryURLStat1 = queryURL;
            }

            //sort by date
            else if (query.sortOrder == SortOrder.CITATIONS && !(query.issetyhi() && query.issetylo()))
            {
                int year = 2013;
                queryURL = queryPart1 + "&as_ylo=&as_yhi=" + queryPart2;
                year--;
            }

            //search for custom year range and sorted by citations
            else if ((query.issetyhi() && query.issetylo()) && query.sortOrder == SortOrder.CITATIONS)
            {
                queryURL      = queryPart1 + "&as_ylo=" + query.getylo() + "&as_yhi=" + query.getyhi() + queryPart2;
                queryURLStat2 = queryURL;
            }

            //search for custome year range and sorted by date
            else if (query.sortOrder == SortOrder.DATE && (query.issetyhi() && query.issetylo()))
            {
                queryURL = queryPart1 + "&as_ylo=" + query.getylo() + "&as_yhi=" + query.getyhi() + queryPart2;
            }

            else if (query.sortOrder == SortOrder.DATE && !(query.issetyhi() && query.issetylo()))
            {
                queryURL = queryPart1 + "&as_ylo=&as_yhi=" + queryPart2;
            }

            //TODO : Need to get the correct URL.
            // #Srikar


            return(queryURL);
        }