knowrob
2.1.0
A Knowledge Base System for Cognition-enabled Robots
|
#include <Pipeline.h>
Public Member Functions | |
Pipeline (bson_t *arrayDocument=nullptr) | |
auto * | arrayDocument () const |
auto | isNested () const |
void | setIsNested (bool isNested) |
bson_t * | appendStageBegin () |
bson_t * | appendStageBegin (std::string_view stageOperator) |
void | appendStageEnd (bson_t *stage) |
void | append (const knowrob::GraphTerm &query, const TripleStore &tripleStore) |
void | append (const knowrob::TriplePattern &query, const TripleStore &tripleStore) |
void | appendBuiltin (const knowrob::GraphBuiltin &builtin) |
void | limit (uint32_t maxDocuments) |
void | unwind (std::string_view field, bool preserveNullAndEmptyArrays=false) |
void | unset (std::string_view field) |
void | project (std::string_view field) |
void | project (const std::vector< std::string_view > &fields) |
void | replaceRoot (std::string_view newRootField) |
void | merge (std::string_view collection) |
void | sortAscending (std::string_view field) |
void | sortDescending (std::string_view field) |
void | setUnion (std::string_view field, const std::vector< std::string_view > &sets) |
void | addToArray (std::string_view key, std::string_view arrayKey, std::string_view elementKey) |
void | matchEmptyArray (std::string_view arrayKey) |
Pipeline (bson_t *arrayDocument=nullptr) | |
auto * | arrayDocument () const |
auto | isNested () const |
void | setIsNested (bool isNested) |
bson_t * | appendStageBegin () |
bson_t * | appendStageBegin (std::string_view stageOperator) |
void | appendStageEnd (bson_t *stage) |
void | append (const knowrob::GraphTerm &query, const TripleStore &tripleStore) |
void | append (const knowrob::TriplePattern &query, const TripleStore &tripleStore) |
void | appendBuiltin (const knowrob::GraphBuiltin &builtin) |
void | limit (uint32_t maxDocuments) |
void | unwind (std::string_view field, bool preserveNullAndEmptyArrays=false) |
void | unset (std::string_view field) |
void | project (std::string_view field) |
void | project (const std::vector< std::string_view > &fields) |
void | replaceRoot (std::string_view newRootField) |
void | merge (std::string_view collection) |
void | sortAscending (std::string_view field) |
void | sortDescending (std::string_view field) |
void | setUnion (std::string_view field, const std::vector< std::string_view > &sets) |
void | addToArray (std::string_view key, std::string_view arrayKey, std::string_view elementKey) |
void | matchEmptyArray (std::string_view arrayKey) |
Static Public Member Functions | |
static bson_t * | loadFromJSON (std::string_view filename, const std::map< std::string, std::string > ¶meters) |
static bson_t * | loadFromJSON (std::string_view filename, const std::map< std::string, std::string > ¶meters) |
Protected Member Functions | |
void | appendTerm_recursive (const knowrob::GraphTerm &query, const TripleStore &tripleStore, std::set< std::string_view > &groundedVariables) |
void | matchBinary (const knowrob::GraphBuiltin &builtin, std::string_view predicate) |
void | setAccumulated (const knowrob::GraphBuiltin &builtin, std::string_view predicate) |
void | bindValue (const knowrob::GraphBuiltin &builtin) |
void | appendUnion (const knowrob::GraphUnion &unionTerm, const TripleStore &tripleStore, std::set< std::string_view > &groundedVariables) |
void | appendTerm_recursive (const knowrob::GraphTerm &query, const TripleStore &tripleStore, std::set< std::string_view > &groundedVariables) |
void | matchBinary (const knowrob::GraphBuiltin &builtin, std::string_view predicate) |
void | setAccumulated (const knowrob::GraphBuiltin &builtin, std::string_view predicate) |
void | bindValue (const knowrob::GraphBuiltin &builtin) |
void | appendUnion (const knowrob::GraphUnion &unionTerm, const TripleStore &tripleStore, std::set< std::string_view > &groundedVariables) |
Protected Attributes | |
bson_t * | arrayDocument_ |
uint32_t | numStages_ |
std::list< bson_wrapper > | stages_ |
std::list< bson_wrapper > | stageOperators_ |
bool | isNested_ = false |
bson_t * | lastStage_ |
bson_t * | lastOperator_ |
A aggregation pipeline.
Definition at line 24 of file Pipeline.h.
|
explicit |
|
explicit |
arrayDocument | an initialized array document. |
void Pipeline::addToArray | ( | std::string_view | key, |
std::string_view | arrayKey, | ||
std::string_view | elementKey | ||
) |
Add an element to an array.
key | the output filed |
arrayKey | input array field |
elementKey | field of an additional element |
Definition at line 332 of file Pipeline.cpp.
void knowrob::mongo::Pipeline::addToArray | ( | std::string_view | key, |
std::string_view | arrayKey, | ||
std::string_view | elementKey | ||
) |
Add an element to an array.
key | the output filed |
arrayKey | input array field |
elementKey | field of an additional element |
void Pipeline::append | ( | const knowrob::GraphTerm & | query, |
const TripleStore & | tripleStore | ||
) |
Definition at line 64 of file Pipeline.cpp.
void knowrob::mongo::Pipeline::append | ( | const knowrob::GraphTerm & | query, |
const TripleStore & | tripleStore | ||
) |
void Pipeline::append | ( | const knowrob::TriplePattern & | query, |
const TripleStore & | tripleStore | ||
) |
Definition at line 55 of file Pipeline.cpp.
void knowrob::mongo::Pipeline::append | ( | const knowrob::TriplePattern & | query, |
const TripleStore & | tripleStore | ||
) |
void Pipeline::appendBuiltin | ( | const knowrob::GraphBuiltin & | builtin | ) |
Definition at line 160 of file Pipeline.cpp.
void knowrob::mongo::Pipeline::appendBuiltin | ( | const knowrob::GraphBuiltin & | builtin | ) |
bson_t * Pipeline::appendStageBegin | ( | ) |
Definition at line 27 of file Pipeline.cpp.
bson_t* knowrob::mongo::Pipeline::appendStageBegin | ( | ) |
bson_t * Pipeline::appendStageBegin | ( | std::string_view | stageOperator | ) |
Definition at line 35 of file Pipeline.cpp.
bson_t* knowrob::mongo::Pipeline::appendStageBegin | ( | std::string_view | stageOperator | ) |
void Pipeline::appendStageEnd | ( | bson_t * | stage | ) |
Definition at line 46 of file Pipeline.cpp.
void knowrob::mongo::Pipeline::appendStageEnd | ( | bson_t * | stage | ) |
|
protected |
Definition at line 69 of file Pipeline.cpp.
|
protected |
|
protected |
Definition at line 102 of file Pipeline.cpp.
|
protected |
|
inline |
|
inline |
|
protected |
Definition at line 192 of file Pipeline.cpp.
|
protected |
|
inline |
Definition at line 36 of file Pipeline.h.
|
inline |
Definition at line 36 of file Pipeline.h.
void Pipeline::limit | ( | uint32_t | maxDocuments | ) |
Append a $limit stage.
maxDocuments | limit of resulting documents. |
Definition at line 249 of file Pipeline.cpp.
void knowrob::mongo::Pipeline::limit | ( | uint32_t | maxDocuments | ) |
Append a $limit stage.
maxDocuments | limit of resulting documents. |
|
static |
Load a pipeline from a JSON file.
filename | the file name |
parameters | a map of parameters |
Definition at line 368 of file Pipeline.cpp.
|
static |
Load a pipeline from a JSON file.
filename | the file name |
parameters | a map of parameters |
|
protected |
Definition at line 232 of file Pipeline.cpp.
|
protected |
void Pipeline::matchEmptyArray | ( | std::string_view | arrayKey | ) |
Match an empty array.
arrayKey | the array field |
Definition at line 352 of file Pipeline.cpp.
void knowrob::mongo::Pipeline::matchEmptyArray | ( | std::string_view | arrayKey | ) |
Match an empty array.
arrayKey | the array field |
void Pipeline::merge | ( | std::string_view | collection | ) |
Append a $merge stage.
collection | the output collection |
Definition at line 291 of file Pipeline.cpp.
void knowrob::mongo::Pipeline::merge | ( | std::string_view | collection | ) |
Append a $merge stage.
collection | the output collection |
void Pipeline::project | ( | const std::vector< std::string_view > & | fields | ) |
Append a $project stage.
fields | a list of document fields to include in output documents |
Definition at line 305 of file Pipeline.cpp.
void knowrob::mongo::Pipeline::project | ( | const std::vector< std::string_view > & | fields | ) |
Append a $project stage.
fields | a list of document fields to include in output documents |
void Pipeline::project | ( | std::string_view | field | ) |
Append a $project stage.
field | a document field to include in output documents |
Definition at line 299 of file Pipeline.cpp.
void knowrob::mongo::Pipeline::project | ( | std::string_view | field | ) |
Append a $project stage.
field | a document field to include in output documents |
void Pipeline::replaceRoot | ( | std::string_view | newRootField | ) |
Append a $replaceRoot stage.
newRootField | a document field |
Definition at line 273 of file Pipeline.cpp.
void knowrob::mongo::Pipeline::replaceRoot | ( | std::string_view | newRootField | ) |
Append a $replaceRoot stage.
newRootField | a document field |
|
protected |
Definition at line 210 of file Pipeline.cpp.
|
protected |
|
inline |
Definition at line 38 of file Pipeline.h.
|
inline |
Definition at line 38 of file Pipeline.h.
void Pipeline::setUnion | ( | std::string_view | field, |
const std::vector< std::string_view > & | sets | ||
) |
Append a ($set o $setUnion) stage.
field | a field to store the union of array |
sets | list of array values |
Definition at line 313 of file Pipeline.cpp.
void knowrob::mongo::Pipeline::setUnion | ( | std::string_view | field, |
const std::vector< std::string_view > & | sets | ||
) |
Append a ($set o $setUnion) stage.
field | a field to store the union of array |
sets | list of array values |
void Pipeline::sortAscending | ( | std::string_view | field | ) |
Append a $sort stage with ascending sort order.
field | a document field |
Definition at line 279 of file Pipeline.cpp.
void knowrob::mongo::Pipeline::sortAscending | ( | std::string_view | field | ) |
Append a $sort stage with ascending sort order.
field | a document field |
void Pipeline::sortDescending | ( | std::string_view | field | ) |
Append a $sort stage with descending sort order.
field | a document field |
Definition at line 285 of file Pipeline.cpp.
void knowrob::mongo::Pipeline::sortDescending | ( | std::string_view | field | ) |
Append a $sort stage with descending sort order.
field | a document field |
void Pipeline::unset | ( | std::string_view | field | ) |
Append a $unset stage.
field | a document field |
Definition at line 267 of file Pipeline.cpp.
void knowrob::mongo::Pipeline::unset | ( | std::string_view | field | ) |
Append a $unset stage.
field | a document field |
void Pipeline::unwind | ( | std::string_view | field, |
bool | preserveNullAndEmptyArrays = false |
||
) |
Append a $unwind stage.
field | an array value |
preserveNullAndEmptyArrays | if true, if the field is null or empty, $unwind outputs the document. |
Definition at line 255 of file Pipeline.cpp.
void knowrob::mongo::Pipeline::unwind | ( | std::string_view | field, |
bool | preserveNullAndEmptyArrays = false |
||
) |
Append a $unwind stage.
field | an array value |
preserveNullAndEmptyArrays | if true, if the field is null or empty, $unwind outputs the document. |
|
protected |
Definition at line 137 of file Pipeline.h.
|
protected |
Definition at line 141 of file Pipeline.h.
|
protected |
Definition at line 144 of file Pipeline.h.
|
protected |
Definition at line 143 of file Pipeline.h.
|
protected |
Definition at line 138 of file Pipeline.h.
|
protected |
Definition at line 140 of file Pipeline.h.
|
protected |
Definition at line 139 of file Pipeline.h.