Statement. More...
#include <gstatement.h>
Public Member Functions | |
GStatement (size_t id, GObject *subject, GObject *predicate, GObject *value, double weight) | |
virtual R::RCString | GetClassName (void) const |
int | Compare (const GStatement &statement) const |
void | SetId (size_t id) |
size_t | GetId (void) const |
GObject * | GetSubject (void) const |
GObject * | GetPredicate (void) const |
GObject * | GetValue (void) const |
double | GetWeight (void) const |
void | SetWeight (double weight) |
virtual | ~GStatement (void) |
Private Attributes | |
size_t | Id |
GObject * | Subject |
GObject * | Predicate |
GObject * | Value |
double | Weight |
Detailed Description
Statement.
The GStatement class provides a representation of a statement in the form of a triple of objects (concept, concepts types, documents, profiles, etc.).The first element represents the subject, the second element is the predicate and the third element represents the value.
It can be used, for example, to represent a hierarchical relation between two concepts. Suppose that the two concepts "car" and "electric car" are defined. It is then possible to define a third concept "IsA" and a new statement ("electric car","IsA","car").
In the case that two concepts are linked by a symmetric relation (such as a synonym), it is the responsible of the developer to take this into account. In practice, two solutions exist. First, two statements can be created where each concept is first a subject and then a value. Second, a coherent convention is adopted for naming concepts that are predicates in order to help the developer to determine if a given predicate is bidirectional or not. The first solution is easier but consumes more memory.
The statements can be seen as a directed graph with a weighted edge representing an object between nodes also representing objects.
Most of the time, the objects of a statement are concepts. It is therefore necessary to cast the pointer to manipulate a concept :
Constructor & Destructor Documentation
GStatement | ( | size_t | id, |
GObject * | subject, | ||
GObject * | predicate, | ||
GObject * | value, | ||
double | weight | ||
) |
Constructor of a statement.
- Parameters
-
id Identifier. subject Subject. predicate Predicate. value Value. weight Weight.
|
virtual |
Destructor.
Member Function Documentation
|
virtual |
- Returns
- the class name.
int Compare | ( | const GStatement & | statement | ) | const |
Compare two statements to classify them.
- Parameters
-
statement Statement to compare with.
- See also
- R::RContainer.
void SetId | ( | size_t | id | ) |
Set the Identifier of the statement.
- Parameters
-
id Identifier of the statement.
size_t GetId | ( | void | ) | const |
- Returns
- Identifier of the statement.
GObject* GetPredicate | ( | void | ) | const |
Get the predicate of the statement.
- Returns
- Pointer to a GObject.
double GetWeight | ( | void | ) | const |
Get the weight of the statement.
void SetWeight | ( | double | weight | ) |
Set a new weight.
- Parameters
-
weight Weight to assign.
Member Data Documentation
|
private |
Identifier of the statement.
|
private |
Subject of the statement.
|
private |
Predicate of the statement.
|
private |
Value of the statement.
|
private |
Weight associated to the statement.