/* Service call when we change the state of a goal/plan/action */ bool changeState(supervisor_msgs::ChangeState::Request &req, supervisor_msgs::ChangeState::Response &res){ if(req.type == "action"){ return actionState(req.action, req.state); }else if(req.type == "plan"){ if(req.state == "PROGRESS"){ return newPlan(req.plan, false); }else if(req.state == "SHARE"){ return sharePlan(); }else if(req.state == "PROGRESS_SHARE"){ return newPlan(req.plan, true); }else if(req.state == "ABORT"){ return abortPlan(req.agent); } }else if(req.type == "goal"){ if(req.state == "NEW"){ return newGoal(req.goal); }else if(req.state == "PROGRESS"){ return startGoal(req.goal); }else if(req.state == "ABORT"){ return abortGoal(req.goal, req.agent); } } }
// _____________________________________________________________________________ void QueryPlanner::applyFiltersIfPossible( vector<QueryPlanner::SubtreePlan>& row, const vector<SparqlFilter>& filters) const { // Apply every filter possible. // It is possible when, // 1) the filter has not already been applied // 2) all variables in the filter are covered by the query so far for (size_t n = 0; n < row.size(); ++n) { const auto& plan = row[n]; for (size_t i = 0; i < filters.size(); ++i) { if (plan._idsOfIncludedFilters.count(i) > 0) { continue; } if (plan._qet.varCovered(filters[i]._lhs) && plan._qet.varCovered(filters[i]._rhs)) { // Apply this filter. SubtreePlan newPlan(_qec); newPlan._idsOfIncludedFilters = plan._idsOfIncludedFilters; newPlan._idsOfIncludedFilters.insert(i); newPlan._idsOfIncludedNodes = plan._idsOfIncludedNodes; QueryExecutionTree tree(_qec); Filter filter(_qec, plan._qet, filters[i]._type, plan._qet.getVariableColumn(filters[i]._lhs), plan._qet.getVariableColumn(filters[i]._rhs)); tree.setVariableColumns(plan._qet.getVariableColumnMap()); tree.setOperation(QueryExecutionTree::FILTER, &filter); tree.setContextVars(plan._qet.getContextVars()); newPlan._qet = tree; row[n] = newPlan; } } } }