CPP API class rl3::Fact

From RL3 Wiki
Jump to: navigation, search

rl3::Fact class overview

Description
rl3::Fact class members enable to manage Fact objects (created through the rl3::BaseEngine factory).
Remarks
The get_factsheet() function should not be confused with similar functions in the FactIterator and FactPathIterator classes. For details, see below.

constructor

rl3::Fact object can be created with rl3::BaseEngine factory only (refer to create_fact functions in rl3::RL3Engine or rl3::KMLEngine derived from the rl3::BaseEngine class)

destructor

~Fact();

Destroy a Fact object.

get_label

UnicodeString get_label();

Get the unicode string name (label) of a Fact object.

Returns: UnicodeString object

get_label_str

string get_label_str();

Get the UTF-8 string name (label) of a Fact object.

Returns: std::string object

get_value

UnicodeString get_value();

Get the unicode string value of a Fact object.

Returns: UnicodeString object

get_value_str

string get_value_str();

Get the UTF-8 string value of a Fact object.

Returns: std::string object

get_weight

double get_weight();

Get Fact object weight.

Returns: double

get_annotation_start

unsigned int get_annotation_start();

Get the start position of Fact object annotation.

Returns: unsigned integer

get_annotation_end

unsigned int get_annotation_end();

Get the end position of Fact object annotation.

Returns: unsigned integer

has_factsheet

bool has_factsheet();

Check whether a Fact object has a factsheet inside.

Returns: true if a Fact object has a factsheet inside, false if otherwise

get_factsheet

std::shared_ptr<rl3::Factsheet> get_factsheet();

Get a factsheet from a Fact object.

Returns: a shared pointer to a Factsheet object.

to_json

string to_json(std::shared_ptr<rl3::SharedText> root_text = NULL, bool include_text = true);

Save Fact as JSON string.

root_text: NULL if fact should be considered as independent / self-containing structure. Default is NULL.
include_text true if text field should be included in the output; false otherwise. Default is true.
Returns: JSON string.