*
error=
nullptr;
80 error=
"operational-error";
83 error=
"citation-not-found";
86 error=
"citation-ambiguous";
89 error=
"cannot-connect-pmdb";
92 error=
"cannot-connect-searchbackend-pmdb";
114 return static_cast<eCitMatchFlags>(
static_cast<int>(
a) |
static_cast<int>(
b));
123 if(!
N.GetMl().empty()) {
124 return N.GetMl().front();
126}
else if(
N.IsStd()) {
128 if(!
N.GetStd().empty()) {
129 const CAuthor& first_author(*
N.GetStd().front());
135 stringname(name_std.
GetLast());
160 if(
A.IsSetAuthors()) {
164 if(
A.IsSetFrom() &&
A.GetFrom().IsJournal()) {
166 if(
J.IsSetTitle()) {
168 if(
T.IsSet() && !
T.Get().empty()) {
172 if(
J.IsSetImp()) {
177 autoyear =
D.GetStd().GetYear();
179this->
Year= to_string(year);
188 autopos = this->
Page.find(
'-');
189 if(pos != string::npos) {
190this->
Page.resize(pos);
202 if(
A.IsSetTitle()) {
204 if(
T.IsSet() && !
T.Get().empty()) {
220 static voidNormalizeJournal(
string& s)
222 for(
char& c : s) {
240 for(
char& c : s) {
265 if((rule &
e_Y) && cm.
Year.empty()) {
268 if((rule &
e_V) && cm.
Volume.empty()) {
271 if((rule &
e_P) && cm.
Page.empty()) {
274 if((rule &
e_A) && cm.
Author.empty()) {
277 if((rule &
e_I) && cm.
Issue.empty()) {
280 if((rule &
e_T) && cm.
Title.empty()) {
288v.push_back(
journal+
"[Journal]");
291v.push_back(cm.
Year+
"[pdat]");
294v.push_back(cm.
Volume+
"[vol]");
297 stringpage = cm.
Page;
298 autopos = page.find(
'-');
299 if(pos != string::npos) {
302v.push_back(page +
"[page]");
305v.push_back(cm.
Author+
"[auth]");
308v.push_back(cm.
Issue+
"[iss]");
311 stringtitle = cm.
Title;
313v.push_back(title +
"[title]");
323 stringargs =
"db=pubmed&field=title&retmax=2&rettype=ulist&term=";
341esearch::CESearchResult
result;
345 if(
result.IsSetData()) {
347 if(
D.IsInfo() &&
D.GetInfo().IsSetContent() &&
D.GetInfo().GetContent().IsSetIdList()) {
348 const auto& idList =
D.GetInfo().GetContent().GetIdList();
349 if(idList.IsSetId()) {
350 const auto& ids = idList.GetId();
351 if(ids.size() == 0) {
353}
else if(ids.size() == 1) {
354 string id= ids.front();
397CSearch_Request req(
m_Ctx);
420 const auto& ruleset = cm.
InPress? ruleset_in_press : ruleset_single;
421 const unsigned n= cm.
Option1? 6 : 5;
423 for(
unsigned i= 0;
i<
n; ++
i) {
427 if(CSearch_Request::BuildSearchTerm(cm,
r, term)) {
428 TEntrezIdpmid = req.GetResponse(err, term);
448 if(
A.IsSetTitle() && !
A.GetTitle().Get().empty()) {
449 auto& title =
A.SetTitle().Set().front();
450 if(title->IsName()) {
451 string& name = title->SetName();
452 if(! name.empty()) {
453 charch = name.back();
458name.push_back(
'.');
465 if(
A.IsSetIds()) {
466 auto& ids =
A.SetIds().Set();
471 const CDbtag& dbt =
id->GetOther();
473 const string& dbn = dbt.
GetDb();
481ids.remove_if(IsELocationID);
488 const CDbtag& dbtl =
l->GetOther();
489 const CDbtag& dbtr =
r->GetOther();
491 const string& dbnl = dbtl.
GetDb();
492 const string& dbnr = dbtr.
GetDb();
511 if(
A.IsSetFrom() &&
A.GetFrom().IsBook()) {
514book.
SetImp().ResetHistory();
542 stringGetURL()
const override 544 strings(
"https://pubmed.ncbi.nlm.nih.gov/api/pubone/pubmed/");
556CFetch_Request req(
m_Ctx, pmid);
559CPubOneRequest req(
m_Ctx, pmid);
564eutils::CPubmedArticleSet pas;
566 if(pas.IsSetPP() && pas.GetPP().IsSetPP()) {
567 const auto& pp = pas.GetPP().GetPP();
569 const auto& ppf = *pp.front();
570 if(ppf.IsPubmedArticle()) {
571 consteutils::CPubmedArticle& article = ppf.GetPubmedArticle();
572 returnarticle.ToPubmed_entry();
573}
else if(ppf.IsPubmedBookArticle()) {
574 consteutils::CPubmedBookArticle& article = ppf.GetPubmedBookArticle();
575 returnarticle.ToPubmed_entry();
593eutils::CPubmedBookArticleSet pbas;
595 if(pbas.IsSetPubmedBookArticle()) {
596 const auto& articles = pbas.GetPubmedBookArticle();
597 if(! articles.empty()) {
598 consteutils::CPubmedBookArticle& article = *articles.front();
599 returnarticle.ToPubmed_entry();
625 if(pme && pme->IsSetMedent()) {
695 static bool ParseJson(
const string& json, vector<TEntrezId>& pmids,
string&
msg)
700 _ASSERT(dobj[
"version"].GetValue().GetString() ==
"1.0");
701 _ASSERT(dobj[
"operation"].GetValue().GetString() ==
"citmatch");
702 if(! dobj[
"success"].GetValue().GetBool()) {
707 const auto&
result= dobj.
at(
"result");
708 if(!
result.IsObject()) {
709 msg=
"result is not an object";
713 const auto& result_obj =
result.GetObject();
715 const auto&
count= result_obj.at(
"count");
717 const auto&
type= result_obj.at(
"type");
718 _ASSERT(
type.GetValue().GetString() ==
"uids");
720 const auto& uids = result_obj.at(
"uids");
721 if(! uids.IsArray()) {
722 msg=
"uids is not an array";
726 const auto& uids_array = uids.GetArray();
727 for(
autoit = uids_array.begin(); it != uids_array.end(); ++it) {
728 if(it->IsObject()) {
729 const auto& uid_obj = it->GetObject();
730 autoit2 = uid_obj.find(
"pubmed");
731 if(it2 != uid_obj.end()) {
732 const autosPubmed = it2->value.GetValue().GetString();
733 TEntrezIdpmid = NStr::StringToNumeric<TEntrezId>(sPubmed);
734pmids.push_back(pmid);
744 static const stringhostname =
"pubmed.ncbi.nlm.nih.gov";
745 static const stringpath =
"/api/citmatch";
746 static const stringargs =
"method=heuristic&raw-text=";
749 for(
unsignedattempt = 1; attempt <= 5; ++attempt) {
756 while(! http.fail()) {
757http.read(
buf,
sizeof(
buf));
766 return! pmids.empty();
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
@Auth_list.hpp User-defined methods of the data storage class.
This stream exchanges data with an HTTP server located at the URL: http[s]://host[:port]/path[?...
CRef< CPub > GetPubmedEntry(TEntrezId pmid, EPubmedError *=nullptr) override
void ReportStats(std::ostream &)
map< TEntrezId, CConstRef< CPub > > m_cache
EPubmedSource m_pubmed_src
CRef< CEUtils_ConnContext > m_Ctx
static bool DoPubSearch(const std::vector< string > &query, std::vector< TEntrezId > &pmids)
TPubInterceptor m_pub_interceptor
CEUtilsUpdater(ENormalize=ENormalize::Off, EPubmedSource=EPubmedSource::EUtils)
CRef< CPub > GetPub(TEntrezId pmid, EPubmedError *=nullptr)
virtual CRef< CPub > GetPubmedEntry(TEntrezId pmid, EPubmedError *=nullptr)
CRef< CPub > x_GetPub(TEntrezId pmid, EPubmedError *)
virtual TEntrezId CitMatch(const CPub &, EPubmedError *=nullptr)
CRef< CPubmed_entry > x_GetPubmedEntry(TEntrezId pmid, EPubmedError *)
CJson_Object SetObject(void)
Get JSON object contents of the node.
CJson_Node at(const CJson_Node::TKeyType &name)
Access an element with a given name.
@Name_std.hpp User-defined methods of the data storage class.
Root class for all serialization exceptions.
const string & GetTitle(C_E::E_Choice type=C_E::e_not_set) const
If the internal list contains a title (of the specified type, if given), returns the corresponding st...
const_iterator end() const
const_iterator find(const key_type &key) const
User-defined methods of the data storage class.
static bool ParseJson(const string &json, vector< TEntrezId > &pmids, string &msg)
constexpr eCitMatchFlags operator|(eCitMatchFlags a, eCitMatchFlags b)
static void Normalize(CPub &pub)
static string GetFirstAuthor(const CAuth_list &authors)
@ cannot_connect_searchbackend_pmdb
SStrictId_Entrez::TId TEntrezId
TEntrezId type for entrez ids which require the same strictness as TGi.
#define ENTREZ_ID_FROM(T, value)
string GetQueryString(EAmpEncoding amp_enc, EUrlEncode encode) const
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
static void SetBaseURL(const string &url)
Set new base url for all e-utils requests.
void Warning(CExceptionArgs_Base &args)
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
ESerialDataFormat
Data file format.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
static TNumeric StringToNumeric(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to a numeric value.
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
static string URLEncode(const CTempString str, EUrlEncode flag=eUrlEnc_SkipMarkChars)
URL-encode string.
@ fConvErr_NoThrow
Do not throw an exception on error.
@ eUrlEnc_ProcessMarkChars
Convert all non-alphanumeric chars, spaces are converted to '+'.
@ eNocase
Case insensitive compare.
bool IsSetVolume(void) const
Check if a value has been assigned to Volume data member.
const TVolume & GetVolume(void) const
Get the Volume member data.
const TPages & GetPages(void) const
Get the Pages member data.
bool IsSetPrepub(void) const
Check if a value has been assigned to Prepub data member.
bool IsSetHistory(void) const
dates for this record Check if a value has been assigned to History data member.
const TIssue & GetIssue(void) const
Get the Issue member data.
E_Choice
Choice variants.
TPrepub GetPrepub(void) const
Get the Prepub member data.
const TName & GetName(void) const
Get the Name member data.
void SetImp(TImp &value)
Assign a value to Imp data member.
bool IsSetNames(void) const
Check if a value has been assigned to Names data member.
bool IsSetIssue(void) const
Check if a value has been assigned to Issue data member.
bool IsSetDate(void) const
date of publication Check if a value has been assigned to Date data member.
bool IsSetName(void) const
Author, Primary or Secondary Check if a value has been assigned to Name data member.
const TNames & GetNames(void) const
Get the Names member data.
const TDate & GetDate(void) const
Get the Date member data.
const TAuthors & GetAuthors(void) const
Get the Authors member data.
const TImp & GetImp(void) const
Get the Imp member data.
bool IsSetPages(void) const
Check if a value has been assigned to Pages data member.
bool IsSetImp(void) const
Check if a value has been assigned to Imp data member.
@ e_Other
generic catch all
@ ePrepub_in_press
accepted, not published
bool CanGetDb(void) const
Check if it is safe to call GetDb method.
const TInitials & GetInitials(void) const
Get the Initials member data.
bool IsName(void) const
Check if variant Name is selected.
const TDb & GetDb(void) const
Get the Db member data.
bool IsSetInitials(void) const
first + middle initials Check if a value has been assigned to Initials data member.
bool IsSetLast(void) const
Check if a value has been assigned to Last data member.
const TLast & GetLast(void) const
Get the Last member data.
const TName & GetName(void) const
Get the variant data.
void SetCit(TCit &value)
Assign a value to Cit data member.
bool IsSetCit(void) const
article citation Check if a value has been assigned to Cit data member.
const TCit & GetCit(void) const
Get the Cit member data.
bool IsMedline(void) const
Check if variant Medline is selected.
const TMedline & GetMedline(void) const
Get the variant data.
const TArticle & GetArticle(void) const
Get the variant data.
TMedline & SetMedline(void)
Select the variant.
bool IsArticle(void) const
Check if variant Article is selected.
TArticle & SetArticle(void)
Select the variant.
static void NormalizeTitle(string &s)
void SleepSec(unsigned long sec, EInterruptOnSignal onsignal=eRestartOnSignal)
Sleep.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
User-defined methods of the data storage class.
CRef< CPub > journal(ParserPtr pp, char *bptr, char *eptr, CRef< CAuth_list > &auth_list, CRef< CTitle::C_E > &title, bool has_muid, CRef< CCit_art > &cit_art, Int4 er)
static SLJIT_INLINE sljit_ins l(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
void FillFromArticle(const CCit_art &)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4