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
 
GObjectGetSubject (void) const
 
GObjectGetPredicate (void) const
 
GObjectGetValue (void) const
 
double GetWeight (void) const
 
void SetWeight (double weight)
 
virtual ~GStatement (void)
 

Private Attributes

size_t Id
 
GObjectSubject
 
GObjectPredicate
 
GObjectValue
 
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 :

GConcept* Value(dynamic_cast<GConcept*>(Statement->GetValue()));

Constructor & Destructor Documentation

GStatement ( size_t  id,
GObject subject,
GObject predicate,
GObject value,
double  weight 
)

Constructor of a statement.

Parameters
idIdentifier.
subjectSubject.
predicatePredicate.
valueValue.
weightWeight.
virtual ~GStatement ( void  )
virtual

Destructor.

Member Function Documentation

virtual R::RCString GetClassName ( void  ) const
virtual
Returns
the class name.
int Compare ( const GStatement statement) const

Compare two statements to classify them.

Parameters
statementStatement to compare with.
See also
R::RContainer.
void SetId ( size_t  id)

Set the Identifier of the statement.

Parameters
idIdentifier of the statement.
size_t GetId ( void  ) const
Returns
Identifier of the statement.
GObject* GetSubject ( void  ) const

Get the subject of the statement.

Returns
Pointer to a GObject.
GObject* GetPredicate ( void  ) const

Get the predicate of the statement.

Returns
Pointer to a GObject.
GObject* GetValue ( void  ) const

Get the value 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
weightWeight to assign.

Member Data Documentation

size_t Id
private

Identifier of the statement.

GObject* Subject
private

Subject of the statement.

GObject* Predicate
private

Predicate of the statement.

GObject* Value
private

Value of the statement.

double Weight
private

Weight associated to the statement.