|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--org.bioquery.query.QuerySubmitter
|
+--org.bioquery.query.NCBIQuerySubmitter
The NCBIQuerySubmitter class handles the submission of 8 types of Querys associated
with databases at the NCBI (National Center of Biotechnology Information) through
their website at www.ncbi.nlm.nih.gov .
Like all QuerySubmitter subclasses, this class should not be instantiated directly,
but instead is returned when the getQuerySubmitter method is called
on a Query object.
The submission routine works through 2 scipts at NCBI: ESearch and their web-based
query.fcgi. While query.fcgi is largely undocumented, details about ESearch are
available at:
http://www.ncbi.nlm.nih.gov/entrez/query/static/esearch_help.html
Should these scripts, their formats, or their URLs change this class may have to be rewritten or overwritten to restore functionality. The internal methods of this class are protected so that subclasses can access them. This would allow a developer to correct for changes in NCBI's scripts by making a subclass that only alters the necessary methods needed to correct the problem. The subclass could be placed in the bioquery directory and used without recompiling bioquery.jar, as long as all of the NCBI Querys listed in querys.xml are given the appropriate class name of the new QuerySubmitter
Please see the parent class QuerySubmitter for details on how to
submit Querys and receive the results.
| Field Summary | |
protected static java.lang.String |
EFETCH_ADDRESS
Deprecated in favor of the RETRIEVE_ADDRESS and query.fcgi script. Web address of the EFetch utility at NCBI/NIH Note: This is no longer used. |
protected static java.lang.String |
EFETCH_MODE
Deprecated in favor of the RETRIEVE_ADDRESS and query.fcgi script. The mode is the file format of the results (html, file, text). |
protected static java.lang.String |
ESEARCH_ADDRESS
Web address of the ESearch utility at NCBI/NIH ESearch retrieves the counts (when getQueryData is called) and a list
of unique identifiers to pass to the retrieve scipt when getQueryResults
is called. |
protected java.lang.String |
idListURL
URL to create the links in the id list format. |
protected static int |
MAX_NUM_DISPLAYED
The max number displayed is determined by how long the PMID-containing URL can be before it exceeds the URL size limit set by the NCBI Entrez server. |
protected static java.lang.String |
RETRIEVE_ADDRESS
Web address of the query.fcgi script used to retrieve QueryResults from NCBI This QuerySubmitter passes unique ids retrieved via ESearch to this script, though it is possible to directly pass the submittable Query text in the form of term=exampleterm[FIELD] |
| Fields inherited from class org.bioquery.query.QuerySubmitter |
endDate, myQuery, startDate |
| Constructor Summary | |
protected |
NCBIQuerySubmitter()
Empty constructor is protected. |
| Method Summary | |
protected java.lang.StringBuffer |
addBioQueryInfo(java.lang.StringBuffer URLString)
Courtesy to NCBI that lets them know who is using their utilites and how to contact us. |
protected java.lang.String |
filterByDate(java.lang.String eSearchURL)
Helper method adjusts the Query text to search for results added or modified between 2 specific dates: startDate and endDate. |
protected java.lang.String |
getCount(org.jdom.Document doc)
Pulls the reference count out of the returned xml document when ESearch is asked to provide counts, such as when getQueryData is called. |
protected java.lang.String |
getDatabaseCode()
Returns a database code that can be added to the URLs to all NCBI scripts to tell it which database to search. |
protected java.lang.String |
getFormatCode(Query theQuery)
Deprecated in favor of the RETRIEVE_ADDRESS and query.fcgi script. |
protected java.util.List |
getIDs(org.jdom.Document doc)
Takes the xml document returned by ESearch and pulls out all of the unique IDs and puts them into a List as Strings. |
java.io.BufferedReader |
getQueryData()
Finds the number of references returned by each line of the Query. |
java.io.BufferedReader |
getQueryResults()
Submits this QuerySubmitter's Query object to the appropriate database and returns a BufferedReader containing the text results. |
protected java.lang.String |
getResultsFooter()
Returns a footer String that simply ends the body and html tags. |
protected java.lang.String |
getResultsHeader()
Returns a header containing details about the Query in HTML format. |
protected java.lang.String |
getSubmittableText()
Returns the text to be submitted of the Query. |
protected java.lang.String |
parseQueryText(java.lang.String queryText)
Helper method takes the queryText and converts it to a String that can be directly submitted to NCBI. |
java.io.BufferedReader |
parseWebPage(java.io.BufferedReader webpage)
Parses the HTML query results returned by the query.fcgi script. |
protected void |
setInitParams(java.util.HashMap parameters)
Loads the idListUrl from the query.xml, which is only used
by the ID List format. |
protected java.io.BufferedReader |
submitEFetch(java.util.List PMIDs)
Deprecated in favor of the RETRIEVE_ADDRESS and query.fcgi script. This helper method does the second of a 2-step process for submitting Querys to NCBI. |
protected java.util.List |
submitESearch(java.lang.String queryText,
boolean count)
This helper method does the first of a 2-step process for submitting Querys to NCBI. |
protected java.util.List |
submitESearch(java.lang.String queryText,
int startNum,
int endNum)
startNum less than 0 means we should just get the number of items, not the items themselves (getQueryData, not getQueryResults). |
protected java.io.BufferedReader |
submitRetrieveUrl(java.util.List PMIDs)
Returns the full results of the Query. |
protected java.io.BufferedReader |
submitURL(java.lang.StringBuffer URLString)
Submits a URL and returns a BufferedReader containing the response. |
protected java.io.BufferedReader |
writeLinks(java.util.List PMIDs)
Returns the Query results in the ID List format. |
| Methods inherited from class org.bioquery.query.QuerySubmitter |
convertOperatorCase, parseQueryLine, resetEndDate, resetStartDate, setEndDate, setQuery, setStartDate |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static java.lang.String ESEARCH_ADDRESS
getQueryData is called) and a list
of unique identifiers to pass to the retrieve scipt when getQueryResults
is called.protected static java.lang.String RETRIEVE_ADDRESS
protected static int MAX_NUM_DISPLAYED
protected java.lang.String idListURL
protected static java.lang.String EFETCH_ADDRESS
protected static java.lang.String EFETCH_MODE
| Constructor Detail |
protected NCBIQuerySubmitter()
getQuerySubmitter
on a Query object.| Method Detail |
protected void setInitParams(java.util.HashMap parameters)
Loads the idListUrl from the query.xml, which is only used
by the ID List format.
Loads URLs and parsing parameters from the
setInitParams in class QuerySubmitter
public java.io.BufferedReader getQueryResults()
throws InvalidQueryException,
InvalidQueryLineException
getQueryResults in class QuerySubmitter
public java.io.BufferedReader getQueryData()
throws InvalidQueryException,
InvalidQueryLineException
getQueryData in class QuerySubmitterprotected java.lang.String filterByDate(java.lang.String eSearchURL)
eSearchURL - The URL to be passed to the ESearch utility, which will have
2 additional parameters added to the end.protected java.lang.String parseQueryText(java.lang.String queryText)
queryText - the text from a QueryLine which has already had
any line numbers removed via the QuerySubmitter.parseQueryLine() method
protected java.util.List submitESearch(java.lang.String queryText,
boolean count)
throws InvalidQueryException
queryText - the text of searchable terms from the Query.
The queryText should already be converted into a format understood
by ESearch (by the submitQuery() method).
protected java.util.List submitESearch(java.lang.String queryText,
int startNum,
int endNum)
throws InvalidQueryException
protected java.lang.StringBuffer addBioQueryInfo(java.lang.StringBuffer URLString)
protected java.io.BufferedReader submitURL(java.lang.StringBuffer URLString)
throws java.io.IOException
URLString - A StringBuffer containing a full URL address as text.protected java.lang.String getCount(org.jdom.Document doc)
getQueryData is called.doc - the JDOM document for the returned xml document.protected java.util.List getIDs(org.jdom.Document doc)
doc - A JDOM document created from the xml document returned by ESearch.
protected java.lang.String getDatabaseCode()
throws InvalidQueryException
protected java.lang.String getSubmittableText()
throws InvalidQueryLineException
protected java.io.BufferedReader submitRetrieveUrl(java.util.List PMIDs)
throws InvalidQueryException
PMIDs - a List containing the unique IDs of the entries to be retrieved, as Strings.public java.io.BufferedReader parseWebPage(java.io.BufferedReader webpage)
Parses the HTML query results returned by the query.fcgi script. This method may be the most fragile section of this QuerySubmitter. If the results are returned but are no longer parsed correctly, NCBI may have changed the format of the returned web page. The problem can be corrected by altering or overwriting this method
This parser does 3 things:
webpage - The BufferedReader returned by the submitRetrieveUrl
method, which contains the response from the query.fcgi script at NCBI.protected java.io.BufferedReader writeLinks(java.util.List PMIDs)
PMIDs - The list of IDs returned by ESearch via the
submitESearch methodprotected java.lang.String getResultsHeader()
protected java.lang.String getResultsFooter()
protected java.io.BufferedReader submitEFetch(java.util.List PMIDs)
throws InvalidQueryException
PMIDs - the List of IDs that is returned from the
submitESearch() method.
protected java.lang.String getFormatCode(Query theQuery)
throws InvalidQueryException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||