MCPcopy Create free account
hub / github.com/SoarGroup/Soar / smem_process_query

Function smem_process_query

Core/SoarKernel/src/semantic_memory.cpp:2525–2897  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2523}
2524
2525smem_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)

Callers 2

smem_parse_cuesFunction · 0.85
smem_respond_to_cmdFunction · 0.85

Calls 15

_smem_process_cue_wmeFunction · 0.85
processMathQueryFunction · 0.85
smem_setup_web_crawlFunction · 0.85
smem_lti_activateFunction · 0.85
smem_reverse_hash_floatFunction · 0.85
smem_reverse_hash_intFunction · 0.85
smem_buffer_add_wmeFunction · 0.85
smem_install_memoryFunction · 0.85
endMethod · 0.80
popMethod · 0.80
column_intMethod · 0.80

Tested by

no test coverage detected