54 bool error(
const string& message);
55 bool warning(
const string& message);
58 bool text(
const string& contents);
75 return "pubmed_search_citation_top_20.1";
78 return "pubmed_search_citation.1";
84 return "pmc_citation.1";
87 return "pmc_citation_top_6.1";
90 return "pubmed_search_citation_top_20.1";
98 string hostname =
"www.ncbi.nlm.nih.gov";
99 string path =
"/projects/hydra/hydra_search.cgi";
100 string args =
"search=@SEARCHTYPE@&query=";
109 for (
int attempt = 1; attempt <= 5; attempt++) {
128 int sleep_secs = ::sqrt((
double)attempt);
152 attrs_type::const_iterator it = attrs.find(
"score");
153 if (it != attrs.end()) {
169 if (
m_Score.empty() )
return true;
170 if ( contents.find_first_not_of(
" \n\r\t") ==
NPOS )
return true;
This stream exchanges data with an HTTP server located at the URL: http[s]://host[:port]/path[?...
bool DoHydraSearch(const string &query, vector< int > &uids, ESearch search=ESearch::ePUBMED_TOP_20, EScoreCutoff cutoff=EScoreCutoff::eCutoff_Low)
bool warning(const string &message)
bool start_element(const string &name, const attrs_type &attrs)
bool end_element(const string &name)
CHydraServer(vector< int > &uids)
bool text(const string &contents)
CHydraSearch::EScoreCutoff m_Cutoff
bool RunHydraSearch(const string &query, CHydraSearch::ESearch search, CHydraSearch::EScoreCutoff cutoff)
bool error(const string &message)
The xml::error_messages class is used to store all the error message which are collected while parsin...
bool has_fatal_errors(void) const
Check if there are fatal errors in the error messages.
bool has_errors(void) const
Check if there are errors in the error messages.
std::string print(void) const
Convert error messages into a single printable string.
The xml::event_parser is used to parse an XML document by calling member functions when certain thing...
std::map< std::string, std::string > attrs_type
a type for holding XML node attributes
bool parse_stream(std::istream &stream, error_messages *messages, warnings_as_errors_type how=type_warnings_not_errors)
Parse what ever data that can be read from the given stream.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
void Error(CExceptionArgs_Base &args)
void Warning(CExceptionArgs_Base &args)
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
static double StringToDouble(const CTempStringEx str, TStringToNumFlags flags=0)
Convert string to double.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
static string & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
static string URLEncode(const CTempString str, EUrlEncode flag=eUrlEnc_SkipMarkChars)
URL-encode string.
static string GetSearchType(CHydraSearch::ESearch search)
API (CHydraSearch) for citation lookup.
void SleepSec(unsigned long sec, EInterruptOnSignal onsignal=eRestartOnSignal)
Sleep.