knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
knowrob::mongo Namespace Reference

Classes

class  BindingsCursor
 
struct  bson_wrapper
 
struct  bson_wrapper_ptr
 
class  BulkOperation
 
class  ChangeStream
 
class  Collection
 
struct  Connection
 
class  Cursor
 
class  Database
 
class  Document
 
struct  IndexKey
 
class  MongoException
 
class  MongoInterface
 
class  MongoTaxonomy
 
class  MongoTerm
 
class  MongoTriple
 
class  MongoTriplePattern
 
struct  TripleLookupData
 
class  Pipeline
 
class  QueryWatch
 
class  TripleCursor
 
struct  TripleStore
 

Typedefs

using BindingsCursorPtr = std::shared_ptr< BindingsCursor >
 
using ChangeStreamCallback = std::function< void(const bson_wrapper_ptr &)>
 

Enumerations

enum class  IndexType { ASCENDING = 1 , DESCENDING = -1 , ASCENDING = 1 , DESCENDING = -1 }
 
enum class  IndexType { ASCENDING = 1 , DESCENDING = -1 , ASCENDING = 1 , DESCENDING = -1 }
 

Functions

std::optional< double > bson_iterOptionalDouble (const bson_iter_t *iter)
 
void lookupTriple (Pipeline &pipeline, const TripleStore &tripleStore, const TripleLookupData &lookupData)
 

Typedef Documentation

◆ BindingsCursorPtr

Definition at line 37 of file BindingsCursor.h.

◆ ChangeStreamCallback

typedef std::function< void(const bson_wrapper_ptr &)> knowrob::mongo::ChangeStreamCallback

Called for each result of a change stream.

Definition at line 21 of file ChangeStream.h.

Enumeration Type Documentation

◆ IndexType [1/2]

The type of an index.

Enumerator
ASCENDING 
DESCENDING 
ASCENDING 
DESCENDING 

Definition at line 13 of file Index.h.

13  {
14  ASCENDING = 1,
15  DESCENDING = -1,
16  };

◆ IndexType [2/2]

The type of an index.

Enumerator
ASCENDING 
DESCENDING 
ASCENDING 
DESCENDING 

Definition at line 13 of file Index.h.

13  {
14  ASCENDING = 1,
15  DESCENDING = -1,
16  };

Function Documentation

◆ bson_iterOptionalDouble()

std::optional< double > knowrob::mongo::bson_iterOptionalDouble ( const bson_iter_t *  iter)
Parameters
itera bson iterator
Returns
the double value of iter or null opt if none.

Definition at line 10 of file bson-helper.cpp.

10  {
11  auto iterType = bson_iter_type(iter);
12  if (iterType == BSON_TYPE_DECIMAL128) {
13  bson_decimal128_t decimal;
14  bson_iter_decimal128(iter, &decimal);
15  if (decimal.high == 0x7800000000000000 || decimal.high == 0xf800000000000000) {
16  // infinity
17  return std::nullopt;
18  } else {
19  char buffer[BSON_DECIMAL128_STRING];
20  bson_decimal128_to_string(&decimal, buffer);
21  setlocale(LC_NUMERIC, "C");
22  auto val = atof(buffer);
23  setlocale(LC_NUMERIC, "");
24  return val;
25  }
26  } else if (iterType == BSON_TYPE_DOUBLE) {
27  return bson_iter_double(iter);
28  } else {
29  return std::nullopt;
30  }
31  }

◆ lookupTriple()

void knowrob::mongo::lookupTriple ( Pipeline pipeline,
const TripleStore tripleStore,
const TripleLookupData lookupData 
)

Definition at line 543 of file MongoTriplePattern.cpp.

543  {
544  semweb::PropertyPtr definedProperty;
545  if (lookupData.expr->propertyTerm() && lookupData.expr->propertyTerm()->termType() == TermType::ATOMIC) {
546  auto propertyTerm = std::static_pointer_cast<Atomic>(lookupData.expr->propertyTerm());
547  definedProperty = tripleStore.vocabulary->getDefinedProperty(propertyTerm->stringForm());
548  }
549 
550  bool b_isTransitiveProperty = (definedProperty && definedProperty->hasFlag(
552  if (b_isTransitiveProperty)
553  transitiveLookup(pipeline, tripleStore, lookupData, definedProperty);
554  else
555  nonTransitiveLookup(pipeline, tripleStore, lookupData, definedProperty);
556 }
auto & propertyTerm() const
Definition: TriplePattern.h:92
@ TRANSITIVE_PROPERTY
Definition: Property.h:24
std::shared_ptr< Property > PropertyPtr
Definition: Property.h:175
std::shared_ptr< knowrob::Vocabulary > vocabulary
Definition: TripleStore.h:29