org.eaglei.search.provider.nif
Class NIFQueryUtil

java.lang.Object
  extended by org.eaglei.search.provider.nif.NIFQueryUtil

public final class NIFQueryUtil
extends java.lang.Object

Contains logic for using NIF ESearch.

Author:
rfrost, tbashor

Nested Class Summary
static class NIFQueryUtil.ESearchResult
          Simple representation of an eSearch result and, optionally, the results of a subsequent set of sSummary or eFetch calls.
 
Field Summary
static java.lang.String DB
           
static java.lang.String EUTILS_URL
           
static java.lang.String ID
           
static java.lang.String ID_PARAM
           
static java.lang.String IDLIST
           
static java.lang.String RETMAX
           
static java.lang.String RETMODE
           
static java.lang.String RETSTART
           
static java.lang.String TERM
           
static java.lang.String TOOL
           
 
Constructor Summary
NIFQueryUtil()
           
 
Method Summary
static java.lang.String buildSearchURL(java.lang.String query, java.lang.String db, java.lang.String tool, int start, int max)
           
static java.lang.String buildServiceURL(java.lang.String serviceURL, java.util.List<java.lang.String> ids, java.lang.String db, int max, java.lang.String tool)
          Builds a query URL for executing an eUtils service that retrieves information for a set of IDs.
static org.w3c.dom.Document executeNIFRequest(java.lang.String url)
          Executes an NCBI request at the specified eUtils URL and returns the XML response as a DOM Document
static org.w3c.dom.Document search(java.lang.String query, java.lang.String db, java.lang.String tool, int startIndex, int maxResults)
          Executes an NCBI search.
static java.lang.String serializeDocument(org.w3c.dom.Document doc)
          Utility method to serialize an XML document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EUTILS_URL

public static final java.lang.String EUTILS_URL
See Also:
Constant Field Values

DB

public static final java.lang.String DB
See Also:
Constant Field Values

TERM

public static final java.lang.String TERM
See Also:
Constant Field Values

RETMAX

public static final java.lang.String RETMAX
See Also:
Constant Field Values

RETSTART

public static final java.lang.String RETSTART
See Also:
Constant Field Values

TOOL

public static final java.lang.String TOOL
See Also:
Constant Field Values

ID_PARAM

public static final java.lang.String ID_PARAM
See Also:
Constant Field Values

RETMODE

public static final java.lang.String RETMODE
See Also:
Constant Field Values

IDLIST

public static final java.lang.String IDLIST
See Also:
Constant Field Values

ID

public static final java.lang.String ID
See Also:
Constant Field Values
Constructor Detail

NIFQueryUtil

public NIFQueryUtil()
Method Detail

search

public static org.w3c.dom.Document search(java.lang.String query,
                                          java.lang.String db,
                                          java.lang.String tool,
                                          int startIndex,
                                          int maxResults)
                                   throws java.io.IOException
Executes an NCBI search.

Throws:
java.io.IOException

buildSearchURL

public static java.lang.String buildSearchURL(java.lang.String query,
                                              java.lang.String db,
                                              java.lang.String tool,
                                              int start,
                                              int max)

executeNIFRequest

public static org.w3c.dom.Document executeNIFRequest(java.lang.String url)
                                              throws java.io.IOException
Executes an NCBI request at the specified eUtils URL and returns the XML response as a DOM Document

Parameters:
url - eUtils URL with all params.
Returns:
Response as DOM Document.
Throws:
java.io.IOException - Thrown if there is an error.

buildServiceURL

public static java.lang.String buildServiceURL(java.lang.String serviceURL,
                                               java.util.List<java.lang.String> ids,
                                               java.lang.String db,
                                               int max,
                                               java.lang.String tool)
Builds a query URL for executing an eUtils service that retrieves information for a set of IDs.

Parameters:
serviceURL - Base URL for the service
ids - IDs of artifacts whose information is being retrieved
db - The target db
max - Max number of results
tool - The source tool
Returns:
Query URL.

serializeDocument

public static java.lang.String serializeDocument(org.w3c.dom.Document doc)
Utility method to serialize an XML document.

Parameters:
doc - The DOM document.
Returns:
String serialization.


Copyright © 2009-2011 Eagle-I. All Rights Reserved.