6 #include "knowrob/Logger.h"
7 #include "knowrob/storage/mongo/BindingsCursor.h"
8 #include "knowrob/terms/Numeric.h"
9 #include "knowrob/terms/IRIAtom.h"
10 #include "knowrob/terms/Blank.h"
11 #include "knowrob/storage/mongo/bson-helper.h"
12 #include "knowrob/terms/String.h"
19 resultDocument_(nullptr),
27 auto var = std::make_shared<Variable>(bson_iter_key(&
varIter_));
30 if (!bson_iter_find(&
valIter_,
"val"))
continue;
34 case BSON_TYPE_UTF8: {
35 auto utf8 = bson_iter_utf8(&
valIter_,
nullptr);
49 bindings->set(
var, std::make_shared<String>(utf8));
55 bindings->set(
var, std::make_shared<Integer>(bson_iter_int32(&
valIter_)));
58 bindings->set(
var, std::make_shared<Long>(bson_iter_int64(&
valIter_)));
61 bindings->set(
var, std::make_shared<Boolean>(bson_iter_bool(&
valIter_)));
63 case BSON_TYPE_DOUBLE:
64 bindings->set(
var, std::make_shared<Double>(bson_iter_double(&
valIter_)));
67 KB_WARN(
"unsupported type {} for predicate arguments.", bson_iter_type(&
valIter_));
78 std::string_view resultKey(bson_iter_key(&
resultIter_));
static std::shared_ptr< Blank > Tabled(std::string_view stringForm)
static std::shared_ptr< IRIAtom > Tabled(std::string_view stringForm)
BindingsCursor(const std::shared_ptr< Collection > &collection)
bool nextBindings(const std::shared_ptr< Bindings > &bindings)
void setSubstitution(const std::shared_ptr< Bindings > &bindings)
const bson_t * resultDocument_
bool next(const bson_t **doc, bool ignore_empty=false)
RDFNodeType rdfNodeTypeGuess(std::string_view str)