6 #include <knowrob/reasoner/RDFGoalReasoner.h>
7 #include "knowrob/integration/python/utils.h"
12 std::vector<TriplePatternPtr> rdfLiterals;
13 for (
auto &lit : query->formula()->literals()) {
14 auto rdfLit = std::dynamic_pointer_cast<TriplePattern>(lit);
16 rdfLiterals.push_back(rdfLit);
18 rdfLiterals.push_back(std::make_shared<TriplePattern>(lit->predicate(), lit->isNegated()));
21 auto rdfGoal = std::make_shared<RDFGoal>(rdfLiterals, *query);
28 struct RDFGoalReasonerWrap :
public RDFGoalReasoner, boost::python::wrapper<RDFGoalReasoner> {
29 explicit RDFGoalReasonerWrap(PyObject *p) :
RDFGoalReasoner(), self(p) {}
31 bool initializeReasoner(
const PropertyTree &config)
override {
32 return call_method<bool>(
self,
"initializeReasoner", config);
36 return call_method<bool>(
self,
"evaluate", query);
48 class_<RDFGoalReasoner, std::shared_ptr<RDFGoalReasonerWrap>, bases<GoalDrivenReasoner>, boost::noncopyable>
49 (
"RDFGoalReasoner", init<>())
51 .def(
"evaluate", &RDFGoalReasonerWrap::evaluate);
virtual bool evaluate(RDFGoalPtr query)=0
bool evaluate(GoalPtr query) override
void createType< RDFGoalReasoner >()
std::shared_ptr< Goal > GoalPtr
std::shared_ptr< RDFGoal > RDFGoalPtr