| 2523 | } |
| 2524 | |
| 2525 | smem_lti_id smem_process_query(agent* thisAgent, Symbol* state, Symbol* query, Symbol* negquery, Symbol* mathQuery, smem_lti_set* prohibit, soar_module::wme_set& cue_wmes, soar_module::symbol_triple_list& meta_wmes, soar_module::symbol_triple_list& retrieval_wmes, smem_query_levels query_level = qry_full, uint64_t number_to_retrieve = 1, std::list<smem_lti_id>* match_ids = NIL, uint64_t depth = 1, smem_install_type install_type = wm_install) |
| 2526 | { |
| 2527 | smem_weighted_cue_list weighted_cue; |
| 2528 | bool good_cue = true; |
| 2529 | |
| 2530 | //This is used when doing math queries that need to look at more that just the first valid element |
| 2531 | bool needFullSearch = false; |
| 2532 | |
| 2533 | soar_module::sqlite_statement* q = NULL; |
| 2534 | |
| 2535 | std::list<smem_lti_id> temp_list; |
| 2536 | if (query_level == qry_full) |
| 2537 | { |
| 2538 | match_ids = &(temp_list); |
| 2539 | } |
| 2540 | |
| 2541 | smem_lti_id king_id = NIL; |
| 2542 | |
| 2543 | //////////////////////////////////////////////////////////////////////////// |
| 2544 | thisAgent->smem_timers->query->start(); |
| 2545 | //////////////////////////////////////////////////////////////////////////// |
| 2546 | |
| 2547 | // prepare query stats |
| 2548 | { |
| 2549 | smem_prioritized_weighted_cue weighted_pq; |
| 2550 | |
| 2551 | // positive cue - always |
| 2552 | { |
| 2553 | smem_wme_list* cue = smem_get_direct_augs_of_id(query); |
| 2554 | if (cue->empty()) |
| 2555 | { |
| 2556 | good_cue = false; |
| 2557 | } |
| 2558 | |
| 2559 | for (smem_wme_list::iterator cue_p = cue->begin(); cue_p != cue->end(); cue_p++) |
| 2560 | { |
| 2561 | cue_wmes.insert((*cue_p)); |
| 2562 | |
| 2563 | if (good_cue) |
| 2564 | { |
| 2565 | good_cue = _smem_process_cue_wme(thisAgent, (*cue_p), true, weighted_pq, NIL); |
| 2566 | } |
| 2567 | } |
| 2568 | |
| 2569 | delete cue; |
| 2570 | } |
| 2571 | |
| 2572 | //Look through while were here, so that we can make sure the attributes we need are in the results |
| 2573 | if (mathQuery != NIL && good_cue) |
| 2574 | { |
| 2575 | std::pair<bool, bool>* mpr = processMathQuery(thisAgent, mathQuery, &weighted_pq); |
| 2576 | needFullSearch = mpr->first; |
| 2577 | good_cue = mpr->second; |
| 2578 | delete mpr; |
| 2579 | } |
| 2580 | |
| 2581 | // negative cue - if present |
| 2582 | if (negquery) |
no test coverage detected