ostrm <<
"FuncName: "<< f_args.
m_FuncName<< endl;
74ostrm <<
"Negate: "<< f_args.
m_Negate<< endl;
98 if(
value!= macro::CMacroRep::m_TopFuncName) {
115 autodo_tree = macro_rep.GetDoTree();
117 LOG_POST(
Error<<
"CMacroRep::GetDoFunctions() - Do tree is empty");
124vector<string> do_fncs;
152 stringarg_value = (*arg_it)->GetValue().GetStrValue();
153 autopos = arg_value.find(
".");
155 stringrt_var_name = arg_value.substr(0, pos);
157 LOG_POST(
Error<<
"Found: "<< rt_var_name <<
" instead of the expected RT var:"<<
m_RTVar);
161 stringsubtype = arg_value.substr(pos + 1,
NPOS);
205 bool x_SubtypeIsOk(
const string& rt_var_name,
const string& subtype);
224 if(subtype ==
"subtype"&&
237 autopos = field.find(
".");
240 if(args.size() == 3) {
241 if((
subname==
"subname"&& args[1] ==
"org.orgname.mod") ||
242(
subname==
"name"&& args[1] ==
"subtype") ||
243(
subname==
"val"&& (args[1] ==
"qual"|| args[1] ==
"data.rna.ext.gen.quals"))) {
244field = args[1] +
","+ args[2];
248 else if(args.size() == 2) {
249 if(
subname==
"db"&& (args[1] ==
"dbxref"|| args[1] ==
"org.db")) {
260 if(
m_Target!= macro::CMacroBioData::sm_StrComm)
264 autonode_type = node.
GetValue().GetType();
266 boolprefix_present =
false;
267 boolsuffix_present =
false;
270 autochild_type = (*child_it)->GetValue().GetType();
273 for(
autostr_it = (*child_it)->SubNodeBegin(); str_it != (*child_it)->SubNodeEnd(); ++str_it) {
274 autosubnode = (*str_it)->GetValue();
276 NStr::EqualNocase(subnode.GetStrValue(), macro::CMacroFunction_StringConstraints::sm_Equal)) {
278 autoarg_it = (*str_it)->SubNodeBegin();
279 stringfirst_arg = (*arg_it)->GetValue().GetStrValue();
282 stringsecond_arg = (*arg_it)->GetValue().GetStrValue();
284 autopos = first_arg.find(
".");
286 stringrt_var = first_arg.substr(0, pos);
289prefix_present =
true;
291suffix_present =
true;
293field_value = second_arg;
300 if(prefix_present && suffix_present) {
304 else if(!field_value.empty()) {
311 boolprefix_present =
false;
312 boolsuffix_present =
false;
314 autochild = (*child_it)->GetValue();
316 NStr::EqualNocase(child.GetStrValue(), macro::CMacroFunction_StringConstraints::sm_Equal)) {
318 autoarg_it = (*child_it)->SubNodeBegin();
319 stringfirst_arg = (*arg_it)->GetValue().GetStrValue();
322 stringsecond_arg = (*arg_it)->GetValue().GetStrValue();
324 autopos = first_arg.find(
".");
326 stringrt_var = first_arg.substr(0, pos);
329prefix_present =
true;
331suffix_present =
true;
336 if(prefix_present && suffix_present) {
345 stringfirst_arg = (*arg_it)->GetValue().GetStrValue();
348 stringsecond_arg = (*arg_it)->GetValue().GetStrValue();
350 autopos = first_arg.find(
".");
352 stringrt_var = first_arg.substr(0, pos);
365 if(
m_Target!= macro::CMacroBioData::sm_DBLink)
369 autonode_type = node.
GetValue().GetType();
374 stringfirst_arg = (*arg_it)->GetValue().GetStrValue();
377 stringsecond_arg = (*arg_it)->GetValue().GetStrValue();
379 autopos = first_arg.find(
".");
381 stringrt_var = first_arg.substr(0, pos);
401 autoarg = (*node_it)->GetValue();
412 auto value= arg.GetStrValue();
469 autoarg_node = (*from_it)->GetValue();
473assign_fn.
m_FuncArgs.emplace_back(arg_node.GetOrig());
478assign_fn.
m_FuncName= arg_node.GetStrValue();
479 for(
autofnc_arg_it = (*from_it)->SubNodeBegin(); fnc_arg_it != (*from_it)->SubNodeEnd(); ++fnc_arg_it) {
480 autoarg_value = (*fnc_arg_it)->GetValue();
481assign_fn.
m_FuncArgs.emplace_back(arg_value.GetStrValue());
493assign_fn = tmp_assignfn.front();
513 autoarg_node = (*node_it)->GetValue();
515 func_info.m_FuncArgs.emplace_back(arg_node.GetStrValue());
546 autodo_tree = macro_rep.GetDoTree();
554do_constraints.clear();
572 return(
NStr::EqualNocase(fn_name, macro::CMacroFunction_GetSeqdesc::sm_BsrcForFeat) ||
573 NStr::EqualNocase(fn_name, macro::CMacroFunction_GetSeqdesc::sm_BsrcForMolinfo) ||
575 NStr::EqualNocase(fn_name, macro::CMacroFunction_GetSeqdesc::sm_BsrcForSeqdesc) ||
576 NStr::EqualNocase(fn_name, macro::CMacroFunction_GetSeqdesc::sm_MolinfoForBsrc) ||
577 NStr::EqualNocase(fn_name, macro::CMacroFunction_GetSeqdesc::sm_MolinfoForFeat) ||
578macro::CMacroFunction_PubFields::s_IsPubFieldFnc(fn_name) ||
590 autonode_type = qnode.
GetType();
606 autoleft_arg = (*node_it)->GetValue();
608 NStr::EqualNocase(left_arg.GetStrValue(), macro::CMacroFunction_ChoiceType::GetFuncName())) {
610 autofirst_arg = (*node_it)->SubNodeBegin();
611 if(first_arg != (*node_it)->SubNodeEnd()) {
612 func_info.m_FuncArgs.emplace_back((*first_arg)->GetValue().GetStrValue());
619 func_info.m_FuncArgs.emplace_back((*node_it)->GetValue().GetStrValue());
638 func_info.m_FuncArgs.emplace_back((*node_it)->GetValue().GetStrValue());
642 autoarg = (*node_it)->GetValue();
648 func_info.m_FuncArgs.emplace_back(arg.GetStrValue());
664 stringfirst_arg = left_arg.GetStrValue();
665 if(first_arg ==
"data.rna.type") {
669 stringsecond_arg = (*node_it)->GetValue().GetStrValue();
670 func_info.m_FuncArgs.emplace_back(second_arg);
674 else if(first_arg ==
"data.rna.ext.gen.class") {
678 stringsecond_arg = (*node_it)->GetValue().GetStrValue();
679 func_info.m_FuncArgs.emplace_back(second_arg);
683 else if(
m_Target== macro::CMacroBioData::sm_ImpFeat) {
684 if(first_arg ==
"data.imp.key") {
688 stringsecond_arg = (*node_it)->GetValue().GetStrValue();
689 func_info.m_FuncArgs.emplace_back(second_arg);
694 else if(
m_Target== macro::CMacroBioData::sm_SeqFeat) {
695 if(first_arg ==
"data.prot.processed") {
699 stringsecond_arg = (*node_it)->GetValue().GetStrValue();
700 func_info.m_FuncArgs.emplace_back(second_arg);
702 func_info.m_FuncArgs.emplace_back(
"is_protein");
707 else if(
m_Target== macro::CMacroBioData::sm_UserObject) {
708 if(first_arg ==
"type.str") {
712 stringsecond_arg = (*node_it)->GetValue().GetStrValue();
713 func_info.m_FuncArgs.emplace_back(second_arg);
720 func_info.m_FuncArgs.emplace_back(first_arg);
723 stringsecond_arg = (*node_it)->GetValue().GetStrValue();
724 func_info.m_FuncArgs.emplace_back(second_arg);
740 autoarg = (*node_it)->GetValue();
746 func_info.m_FuncArgs.emplace_back(arg.GetStrValue());
787 autoarg = (*node_it)->GetValue();
798 func_info.m_FuncArgs.emplace_back(arg.GetStrValue());
837 autoarg = (*node_it)->GetValue();
848 func_info.m_FuncArgs.emplace_back(arg.GetStrValue());
861 autowhere_tree = macro_rep.GetWhereClause();
878 for(
auto& func_it : func_list) {
879 for(
auto& arg_it : func_it.m_FuncArgs) {
880 if(arg_it.find(
",") !=
NPOS) {
881vector<string> tokens;
883 for(
auto& token_it : tokens) {
884 autovar = macro_rep.GetVar(token_it);
886token_it = var->GetGUIResolvedValue();
892 autovar = macro_rep.GetVar(arg_it);
894arg_it = var->GetGUIResolvedValue();
CAssignQueryTreeGetArgs(SMacroFuncWithArgs &assign_fn, const string &target, TMacroFuncList &constraints, const string &rt_var)
bool x_GetFieldForSubname(string &field)
ETreeTraverseCode operator()(const CTreeNode< CQueryParseNode > &node, int delta)
bool x_IsStructCommField(const CTreeNode< CQueryParseNode > &node)
TMacroFuncList * m_Constraints
SMacroFuncWithArgs * m_AssignFnc
bool x_SubtypeIsOk(const string &rt_var_name, const string &subtype)
bool x_IsDBLinkField(const CTreeNode< CQueryParseNode > &node)
void x_ProcessFunction(const CTreeNode< CQueryParseNode > &node, const CTreeNode< CQueryParseNode > &parent_node, SMacroFuncWithArgs &func_info)
Functor should have the next prototype: ETreeTraverseCode Func(TreeNode& node, int delta_level) where...
CDoQueryTreeGetArgs(TMacroFuncList &func_list, TMacroFuncList &do_constraints, const macro::CMacroRep ¯o_rep)
TMacroFuncList * m_Constraints
const macro::CMacroRep * m_MacroRep
TMacroFuncList * m_Functions
ETreeTraverseCode operator()(const CTreeNode< CQueryParseNode > &node, int delta)
vector< CQueryParseTree * > m_AssignQueries
Query tree and associated utility methods.
CQueryTreeListFunctions(vector< string > &functions)
ETreeTraverseCode operator()(const CTreeNode< CQueryParseNode > &node)
vector< string > * m_Functions
definition of a Culling tree
CWhereQueryTreeGetArgs(TMacroFuncList &func_list, const string &target)
void x_ProcessFunction(const CTreeNode< CQueryParseNode > &node, const CTreeNode< CQueryParseNode > &parent_node, SMacroFuncWithArgs &func_info)
ETreeTraverseCode operator()(const CTreeNode< CQueryParseNode > &node, int delta)
bool s_RefersToField(const string &fn_name) const
TMacroFuncList * m_Functions
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const char * kStrCommFieldValue
const char * kStrCommFieldName
const char * kStrCommDbname
void Reset(void)
Reset reference object.
TObjectType & GetObject(void)
Get object.
const TNode * GetQueryTree() const
const string & GetStrValue() const
@ eIntConst
Integer const.
@ eBoolConst
Boolean (TRUE or FALSE)
@ eString
String ("free text")
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static const string BoolToString(bool value)
Convert bool to string.
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 bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
Fun TreeBreadthFirstTraverse(TTreeNode &tree_node, Fun func)
Breadth-first tree traversal algorithm.
Fun TreeDepthFirstTraverse(TTreeNode &tree_node, Fun func)
Depth-first tree traversal algorithm.
ETreeTraverseCode
Tree traverse code returned by the traverse predicate function.
unsigned int CountNodes(unsigned int depth=1, TCountNodes how=0) const
Count nodes of the tree of which this node is a root.
TNodeList_CI SubNodeBegin(void) const
Return first const iterator on subnode list.
TNodeList_CI SubNodeEnd(void) const
Return last const iterator on subnode list.
const TValue & GetValue(void) const
Return node's value.
const TTreeType * GetParent(void) const
Get node's parent.
@ eTreeTraverseStop
Stop traversal (return form algorithm)
@ eTreeTraverse
Keep traversal.
@ eTreeTraverseStepOver
Do not traverse current node (pick the next one)
CNcbiOstream & operator<<(CNcbiOstream &ostrm, const SMacroFuncWithArgs &f_args)
vector< SMacroFuncWithArgs > TMacroFuncList
const string kPlaceHolderFn
Temporary function name to return the relevant information from the Where clause.
TMacroFuncList GetWhereFunctionsWithArgs(const macro::CMacroRep ¯o_rep)
Returns the list of WHERE functions and their arguments as they appear in the macro.
const string kncRNAclassFn
void LookupFncArguments(const macro::CMacroRep ¯o_rep, TMacroFuncList &func_list)
Looks up variables names used as function arguments and substitutes their name with their values.
const string kComparisonOp
vector< string > GetDoFunctions(const macro::CMacroRep ¯o_rep)
Returns the list of do-functions present in the DO clause of the macro - includes multiples.
TMacroFuncList GetDoFunctionsWithArgs(const macro::CMacroRep ¯o_rep, TMacroFuncList &do_constraints)
Returns the list of DO functions and their arguments as they appear in the macro.
const GenericPointer< typename T::ValueType > T2 value
Int4 delta(size_t dimension_, const Int4 *score_)
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
Structure to store parsed function name and its arguments - as it appears in the macro It is used whe...
bool operator==(const SMacroFuncWithArgs &) const
CRef< SMacroFuncWithArgs > m_ChildFnc
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