Generic Session. More...

#include <gsession.h>

Inheritance diagram for GSession:
[legend]

Public Member Functions

 GSession (size_t id, const R::RString &name)
 
 GSession (size_t id, const R::RString &name, const R::RString &configdir)
 
virtual void HandlerNotFound (const R::RNotification &notification)
 
virtual ~GSession (void)
 
Session General Methods

General methods related to the session.

size_t GetId (void) const
 
R::RString GetName (void) const
 
int Compare (const GSession &session) const
 
int Compare (size_t id) const
 
int Compare (const R::RString &name) const
 
R::RTextFileGetLog (void)
 
bool MustBreak (void)
 
void ResetBreak (void)
 
void SetBreak (void)
 
int GetCurrentRandom (void) const
 
size_t GetCurrentRandomValue (size_t max)
 
R::RRandomGetRandom (void)
 
void ApplyConfig (void)
 
bool MustSaveResults (void) const
 
void SetCurrentRandom (int rand)
 
void SetSaveResults (bool save=true)
 
R::RString AnalyzeString (const R::RString &str)
 
Computing Methods

Methods used to launch different computations on the session.

GDocAnalyzeReserveAnalyzer (void)
 
void ReleaseAnalyzer (GDocAnalyze *analyzer)
 
void AnalyzeDoc (GDoc *doc, GSlot *rec=0, bool force=false, bool download=true)
 
void AnalyzeDocs (GSlot *rec=0)
 
void GroupDocs (GSlot *rec=0)
 
void CalcProfile (GProfile *profile, GProfileCalc *method=0, GLinkCalc *linkcalc=0, GSlot *rec=0)
 
void CalcProfiles (GSlot *rec=0)
 
void GroupProfiles (GSlot *rec=0)
 
void ComputeSugs (GSlot *rec=0)
 
void ComputeTrust (GSlot *rec=0)
 
void RunTool (const R::RString &name, const R::RString &list, GSlot *slot=0, bool need=true)
 
void RequestMetaEngine (const R::RString &query, size_t caller)
 
void ClearMetaEngine (size_t caller)
 
Informational Methods

Methods that provides some information on the session.

size_t GetNbObjs (tObjType type) const
 
size_t GetMaxObjId (tObjType type) const
 
size_t GetMaxObjPos (tObjType type) const
 
GObjectGetObj (tObjType type, size_t id, bool null=false)
 
size_t GetObjs (tObjType type, GObject **&tab, bool alloc)
 
void VerifyTab (tObjType type, size_t max)
 
GSimulatorGetSimulator (void) const
 
Update Methods

Methods used to update the session.

void ReInit (const GSubject *obj, bool cleardocs)
 
void ReInit (const GDoc *obj, bool del)
 
void ReInit (const GUser *obj)
 
void ReInit (const GProfile *obj, bool del)
 
void ReInit (const GFdbk *obj)
 
void ReInit (const GTopic *obj)
 
void ReInit (const GClass *obj)
 
void ReInit (const GCommunity *obj)
 
bool InsertFdbk (GProfile *prof, GDoc *doc, tFdbkType fdbk, R::RDate done, bool load=false)
 
bool InsertFdbk (size_t profid, size_t docid, tFdbkType fdbk, R::RDate done, bool load=false)
 
void UpdateCommunity (GProfile *prof)
 
void UpdateCommunity (size_t profid)
 
void SetName (GUser *user, const R::RString &name, const R::RString &fullname=R::RString::Null)
 
void SetName (GProfile *profile, const R::RString &name)
 
void SetSocial (GProfile *profile, bool social)
 
void SetConfidence (GProfile *profile, double score, char level)
 
void UpdateProfiles (size_t docid)
 
void UpdateTopic (GDoc *doc)
 
void UpdateTopic (size_t docid)
 
- Public Member Functions inherited from RObject
 RObject (const RString &name=RString::Null)
 
int Compare (const RObject &obj) const
 
RString GetName (void) const
 
virtual RCString GetClassName (void) const
 
void PostNotification (const hNotification handle)
 
void PostNotification (const RCString &name)
 
void PostNotification (const hNotification handle, T data)
 
void PostNotification (const RCString &name, T data)
 
void InsertObserver (tNotificationHandler handler, const hNotification handle, RObject *object)
 
void InsertObserver (tNotificationHandler handler, const RCString &name, RObject *object)
 
void InsertObserver (tNotificationHandler handler, const hNotification handle)
 
void InsertObserver (tNotificationHandler handler, const RCString &name)
 
void InsertObserver (tNotificationHandler handler, RObject *object)
 
void InsertObserver (tNotificationHandler handler)
 
void DeleteObserver (void)
 
void DeleteObserver (const hNotification handle, RObject *object)
 
void DeleteObserver (const RCString &name, RObject *object)
 
hNotification GetNotificationHandle (const RCString &name) const
 
RCString GetNotificationName (const hNotification handle) const
 
virtual ~RObject (void)
 
- Public Member Functions inherited from GKB
virtual ~GKB (void)=0
 
tObjState GetState (void) const
 
GStorageGetStorage (void) const
 
GConceptTypeGetTokenType (void) const
 
GConceptTypeGetDCMIType (void) const
 
GConceptTypeGetURIType (void) const
 
GConceptTypeGetNamedEntityType (void) const
 
GConceptTypeGetTaxonomyType (void) const
 
GConceptGetContent (void) const
 
GConceptGetUnknown (void) const
 
GConceptGetURI (void) const
 
GConceptGetNamedEntity (void) const
 
GConceptGetIsA (void) const
 
GConceptGetSynonym (void) const
 
GConceptGetPartOf (void) const
 
size_t GetNbObjs (const GConceptType *obj) const
 
size_t GetMaxObjId (const GConceptType *obj) const
 
GConceptTypeGetObj (const GConceptType *obj, char id, bool null)
 
GConceptTypeGetObj (const GConceptType *obj, const R::RString &name, bool null)
 
R::RCursor< GConceptTypeGetObjs (const GConceptType *obj) const
 
GConceptTypeInsertObj (const GConceptType *obj, tConceptCat cat, size_t id, const R::RString &name, const R::RString &desc, bool &newone)
 
GConceptTypeInsertObj (const GConceptType *obj, tConceptCat cat, size_t id, const R::RString &name, const R::RString &desc)
 
GConceptTypeInsertObj (const GConceptType *obj, tConceptCat cat, const R::RString &name, const R::RString &desc, bool &newone)
 
GConceptTypeInsertObj (const GConceptType *obj, tConceptCat cat, const R::RString &name, const R::RString &desc)
 
size_t GetNbObjs (const GConcept *obj) const
 
size_t GetMaxObjId (const GConcept *obj) const
 
R::RCursor< GConceptGetObjs (const GConcept *obj) const
 
GConceptGetObj (const GConcept *obj, size_t id)
 
GConceptGetObj (const GConcept *obj, GConceptType *type, const R::RString &concept, bool null=false)
 
GConceptInsertObj (const GConcept *obj, GConceptType *type, const R::RString &concept, bool &newone)
 
GConceptInsertObj (const GConcept *obj, GConceptType *type, const R::RString &concept)
 
GConceptInsertObj (const GConcept &concept, bool &newone)
 
GConceptInsertObj (const GConcept &concept)
 
GConceptRenameObj (GConcept *concept, const R::RString &name)
 
void DeleteObj (GConcept *concept)
 
GStatementGetObj (const GStatement *obj, size_t id, bool null=false)
 
GStatementGetObj (const GStatement *obj, GObject *subject, GObject *predicate, GObject *value, bool null=false)
 
GStatementInsertObj (const GStatement *obj, size_t id, GObject *subject, GObject *predicate, GObject *value, double weight, bool &newone)
 
GStatementInsertObj (const GStatement *obj, size_t id, GObject *subject, GObject *predicate, GObject *value, double weight)
 
- Public Member Functions inherited from RConfig
 RConfig (void)
 
 RConfig (bool dirs, const RString &param1, const RString &param2=RString::Null)
 
void SetParams (bool dirs, const RString &param1, const RString &param2=RString::Null)
 
void Load (lParams *cat, RXMLTag *tag)
 
void Save (lParams *cat, RXMLStruct &config, RXMLTag *parent)
 
void Load (bool global=true, bool exist=false)
 
void Save (void)
 
RCursor< RParamGetParams (const RString &cat=RString::Null, const RString &subcat=RString::Null, const RString &subsubcat=RString::Null)
 
void GetCategories (RContainer< RString, true, false > &cats, const RString &cat=RString::Null, const RString &subcat=RString::Null)
 
T * FindParam (const RString &name, const RString &cat=RString::Null, const RString &subcat=RString::Null, const RString &subsubcat=RString::Null)
 
void InsertParam (RParam *param, const RString &cat=RString::Null, const RString &subcat=RString::Null, const RString &subsubcat=RString::Null)
 
void Reset (const RString &name, const RString &cat=RString::Null, const RString &subcat=RString::Null, const RString &subsubcat=RString::Null)
 
RString Get (const RString &name, const RString &cat=RString::Null, const RString &subcat=RString::Null, const RString &subsubcat=RString::Null)
 
int GetInt (const RString &name, const RString &cat=RString::Null, const RString &subcat=RString::Null, const RString &subsubcat=RString::Null)
 
unsigned int GetUInt (const RString &name, const RString &cat=RString::Null, const RString &subcat=RString::Null, const RString &subsubcat=RString::Null)
 
long GetLong (const RString &name, const RString &cat=RString::Null, const RString &subcat=RString::Null, const RString &subsubcat=RString::Null)
 
unsigned long GetULong (const RString &name, const RString &cat=RString::Null, const RString &subcat=RString::Null, const RString &subsubcat=RString::Null)
 
double GetDouble (const RString &name, const RString &cat=RString::Null, const RString &subcat=RString::Null, const RString &subsubcat=RString::Null)
 
bool GetBool (const RString &name, const RString &cat=RString::Null, const RString &subcat=RString::Null, const RString &subsubcat=RString::Null)
 
RCursor< RStringGetList (const RString &name, const RString &cat=RString::Null, const RString &subcat=RString::Null, const RString &subsubcat=RString::Null)
 
RCursor< RParamGetStruct (const RString &name, const RString &cat=RString::Null, const RString &subcat=RString::Null, const RString &subsubcat=RString::Null)
 
void Set (const RString &name, const RString &v, const RString &cat=RString::Null, const RString &subcat=RString::Null, const RString &subsubcat=RString::Null)
 
void SetInt (const RString &name, int v, const RString &cat=RString::Null, const RString &subcat=RString::Null, const RString &subsubcat=RString::Null)
 
void SetUInt (const RString &name, size_t v, const RString &cat=RString::Null, const RString &subcat=RString::Null, const RString &subsubcat=RString::Null)
 
void SetDouble (const RString &name, double v, const RString &cat=RString::Null, const RString &subcat=RString::Null, const RString &subsubcat=RString::Null)
 
void SetBool (const RString &name, bool v, const RString &cat=RString::Null, const RString &subcat=RString::Null, const RString &subsubcat=RString::Null)
 
void AddToList (const RString &name, const RString &v, const RString &cat=RString::Null, const RString &subcat=RString::Null, const RString &subsubcat=RString::Null)
 
void AddToStruct (const RString &name, RParam *param, const RString &cat=RString::Null, const RString &subcat=RString::Null, const RString &subsubcat=RString::Null)
 
virtual ~RConfig (void)
 
- Public Member Functions inherited from GClasses
 GClasses (GSession *session, size_t max)
 
GClassesGetClassTree (void)
 
GClassGetFirst (void) const
 
GClassGetLast (void) const
 
size_t GetMaxDepth (void) const
 
size_t GetNbNodes (void) const
 
size_t GetNbTopNodes (void) const
 
size_t GetTab (GClass **tab, GClass *node, bool children=false)
 
size_t GetNbObjs (const GClass *obj) const
 
size_t GetMaxObjId (const GClass *obj) const
 
size_t GetMaxObjPos (const GClass *obj) const
 
R::RCursor< GClassGetObjs (const GClass *obj) const
 
size_t GetObjs (GClass **&tab, bool alloc)
 
GClassGetObj (const GClass *obj, size_t id, bool load=true, bool null=false)
 
GClassGetObj (const GClass *obj, const R::RString &name, bool load=true, bool null=false)
 
void LoadIndex (const GClass *obj, GConcept *concept, R::RNumContainer< size_t, true > &refs)
 
void BuildIndex (const GClass *obj)
 
virtual void InsertObj (GClass *parent, GClass *obj)
 
virtual void DeleteObj (GClass *obj)
 
double GetUpOperationsCost (const GClass *u, const GClass *v) const
 
- Public Member Functions inherited from GSubjects
size_t GetMaxDepth (void) const
 
size_t GetNbObjs (const GSubject *obj) const
 
R::RCursor< GSubjectGetObjs (const GSubject *obj) const
 
R::RNodeCursor< GSubjects,
GSubject
GetObjs (const GSubject *obj, const GSubject *parent) const
 
size_t GetObjs (GSubject **subjects)
 
GSubjectGetObj (const GSubject *obj, size_t id) const
 
GSubjectGetObj (const GSubject *obj, const R::RString &name) const
 
void InsertObj (GSubject *to, GSubject *subject)
 
size_t GetNbUsedObjs (tObjType type) const
 
size_t GetNbObjs (const GSubject *obj, GDoc *doc) const
 
R::RCursor< GSubjectGetObjs (const GSubject *obj, const GDoc *doc) const
 
const GSubjectGetObj (const GSubject *obj, const GDoc *doc, bool one=true) const
 
void SetUsed (GSubject *subject, bool select)
 
bool IsUsed (const GDoc *doc) const
 
size_t GetUsedObjs (GDoc **docs)
 
R::RCursor< GDocGetUsedObjs (const GDoc *obj) const
 
bool IsFromParentSubject (const GDoc *doc, const GSubject *subject) const
 
bool IsFromSubject (const GDoc *doc, const GSubject *subject) const
 
void InsertObj (GSubject *subject, GDoc *doc)
 
void SetUsed (GDoc *doc, GSubject *subject, bool select)
 
const GSubjectGetObj (const GSubject *obj, const GProfile *profile) const
 
void InsertObj (GSubject *subject, GProfile *profile)
 
const GSubjectGetObj (const GSubject *obj, const GCommunity *com) const
 
void SetDescType (tSubjectDesc type)
 
void Repair (void)
 
- Public Member Functions inherited from RTree< T, N, bAlloc >
 RTree (void)
 
void ClearNode (N *node)
 
N * GetFirst (void) const
 
N * GetLast (void) const
 
size_t GetMaxDepth (void) const
 
N * GetTop (void)
 
const N * GetTop (void) const
 
size_t GetNbNodes (void) const
 
size_t GetNbTopNodes (void) const
 
size_t GetTab (N **tab, N *node, bool children=false)
 
void InsertNode (N *to, N *node)
 
void DeleteNodes (N *node, bool del=bAlloc)
 
void DeleteNode (N *node, bool del=bAlloc)
 
void UpdateDepth (N *node)
 
void MoveNode (N *to, N *node)
 
void Copy (const RTree< T, N, a > &src)
 
void DeepCopy (N *src, N *newparent)
 
N * GetNode (const TUse &tag) const
 
double GetUpOperationsCost (const N *u, const N *v) const
 
virtual ~RTree (void)
 

Private Member Functions

void Init (void)
 
void EmitReInit (tObjType type, bool del)
 
bool IsDefined (const R::RContainer< GVector, true, true > &vectors)
 
- Private Member Functions inherited from GObjects< C, hEvents >
 GObjects (GSession *session, size_t size, const R::RString &name, tObjType type)
 
size_t GetNbObjs (const C *obj) const
 
size_t GetMaxObjId (const C *obj) const
 
size_t GetMaxObjPos (const C *obj) const
 
R::RCursor< C > GetObjs (const C *obj) const
 
size_t GetObjs (C **&tab, bool alloc)
 
C * GetObj (const C *obj, size_t id, bool load=true, bool null=false)
 
C * GetObj (const C *obj, const R::RString &name, bool load=true, bool null=false)
 
void LoadIndex (const C *obj, GConcept *concept, R::RNumContainer< size_t, true > &refs)
 
void BuildIndex (const C *obj)
 
void LoadTree (const C *obj, GConceptTree *&tree, size_t blockid, size_t id)
 
void LoadTree (const C *obj, R::RContainer< GConceptRecord, false, true > &records, size_t &nbrecords, size_t &nbtoprecords, size_t &nbrefs)
 
bool FindDepthFirstRecord (const C *obj, GConceptRecord &rec, size_t idx)
 
bool FindRecord (const C *obj, GConceptRecord &rec, size_t synpos)
 
bool FindParentRecord (const C *obj, const GConceptRecord &search, GConceptRecord &rec)
 
bool FindFirstChildRecord (const C *obj, const GConceptRecord &search, GConceptRecord &rec, size_t idx)
 
bool FindNearestRecord (const C *obj, GConceptRecord &rec, size_t synpos)
 
bool FindNearestRecord (const C *obj, GConceptRecord &rec, size_t synpos, bool after)
 
bool FindRootRecord (const C *obj, const GConceptRecord &rec1, const GConceptRecord &rec2, GConceptRecord &rec)
 
size_t GetMinPosRecord (const C *obj, const GConceptRecord &rec, size_t nbbefore)
 
size_t GetMaxPosRecord (const C *obj, const GConceptRecord &rec, size_t nbafter)
 
size_t GetMaxPosRecord (const C *obj)
 
size_t GetMaxSyntacticPosRecord (const C *obj)
 
size_t GetNbTotalChildRecords (const C *obj, const GConceptRecord &rec)
 
virtual ~GObjects (void)
 
- Private Member Functions inherited from GObjects< GCommunity, hCommunities >
 GObjects (GSession *session, size_t size, const R::RString &name, tObjType type)
 
virtual void InsertObj (GCommunity *obj, GCommunity *parent=0)
 
virtual void DeleteObj (GCommunity *obj)
 
size_t GetNbObjs (const GCommunity *obj) const
 
size_t GetMaxObjId (const GCommunity *obj) const
 
size_t GetMaxObjPos (const GCommunity *obj) const
 
R::RCursor< GCommunityGetObjs (const GCommunity *obj) const
 
size_t GetObjs (GCommunity **&tab, bool alloc)
 
GCommunityGetObj (const GCommunity *obj, size_t id, bool load=true, bool null=false)
 
GCommunityGetObj (const GCommunity *obj, const R::RString &name, bool load=true, bool null=false)
 
void LoadIndex (const GCommunity *obj, GConcept *concept, R::RNumContainer< size_t, true > &refs)
 
void BuildIndex (const GCommunity *obj)
 
void LoadTree (const GCommunity *obj, GConceptTree *&tree, size_t blockid, size_t id)
 
void LoadTree (const GCommunity *obj, R::RContainer< GConceptRecord, false, true > &records, size_t &nbrecords, size_t &nbtoprecords, size_t &nbrefs)
 
bool FindDepthFirstRecord (const GCommunity *obj, GConceptRecord &rec, size_t idx)
 
bool FindRecord (const GCommunity *obj, GConceptRecord &rec, size_t synpos)
 
bool FindParentRecord (const GCommunity *obj, const GConceptRecord &search, GConceptRecord &rec)
 
bool FindFirstChildRecord (const GCommunity *obj, const GConceptRecord &search, GConceptRecord &rec, size_t idx)
 
bool FindNearestRecord (const GCommunity *obj, GConceptRecord &rec, size_t synpos)
 
bool FindNearestRecord (const GCommunity *obj, GConceptRecord &rec, size_t synpos, bool after)
 
bool FindRootRecord (const GCommunity *obj, const GConceptRecord &rec1, const GConceptRecord &rec2, GConceptRecord &rec)
 
size_t GetMinPosRecord (const GCommunity *obj, const GConceptRecord &rec, size_t nbbefore)
 
size_t GetMaxPosRecord (const GCommunity *obj, const GConceptRecord &rec, size_t nbafter)
 
size_t GetMaxPosRecord (const GCommunity *obj)
 
size_t GetMaxSyntacticPosRecord (const GCommunity *obj)
 
size_t GetNbTotalChildRecords (const GCommunity *obj, const GConceptRecord &rec)
 
virtual ~GObjects (void)
 

Private Attributes

size_t Id
 
R::RString Name
 
bool ValidConfigFile
 
R::RTextFile Log
 
int CurrentRandom
 
R::RRandom Random
 
bool ExternBreak
 
GSimulatorSimulator
 
bool ClusterSelectedDocs
 
GDocAnalyze DocAnalyze
 
bool AnalyzerReserved
 

Additional Inherited Members

- Protected Member Functions inherited from GKB
 GKB (GSession *session)
 
void ClearIndex (tObjType type)
 
- Protected Member Functions inherited from GSubjects
 GSubjects (GSession *session)
 
virtual void Clear (void)
 
void ReInit (void)
 
void LoadObjs (const GSubject *obj)
 
- Protected Attributes inherited from RObject
RString Name
 
- Protected Attributes inherited from GKB
GSessionSession
 
tObjState State
 
GStorageStorage
 
bool SaveResults
 
GConceptTypeTokenType
 
GConceptTypeDCMIType
 
GConceptTypeNamedEntityType
 
GConceptTypeURIType
 
GConceptTypeTaxonomyType
 
GConceptContent
 
GConceptNamedEntity
 
GConceptURI
 
GConceptIsA
 
GConceptSynonym
 
GConceptPartOf
 
GConceptUnknown
 
R::RObjectContainer
< GConceptType, true > 
ConceptTypes
 
R::RObjectHashContainer
< GConcept, true > 
Concepts
 
R::RContainer< GStatement,
true, false > 
StatementsByIds
 
- Protected Attributes inherited from GSubjects
R::RContainer< GSubject, false,
true > 
Subjects
 
R::RContainer< GSubject, false,
true > 
UsedSubjects
 
R::RContainer< GDoc, false, true > UsedDocs
 
R::RBoolVector DocsStatus
 
R::RContainer< R::RContainer
< GSubject, false, false >
, true, false > 
DocsSubjects
 
R::RContainer< GSubject, false,
false > 
ProfilesSubject
 
bool MustLoad
 
tSubjectDesc DescType
 
- Protected Attributes inherited from RTree< T, N, bAlloc >
N * First
 
N * Last
 
size_t NbTopNodes
 
size_t NbNodes
 
size_t MaxDepth
 

Detailed Description

Generic Session.

The GSession provides a representation for a GALILEI session.

The session generates several notifications, including 'Reset' and 'ResetFile' and 'ForceReCompute'.

Constructor & Destructor Documentation

GSession ( size_t  id,
const R::RString name 
)

Constructor.

Parameters
idIdentifier.
nameName of the session.
GSession ( size_t  id,
const R::RString name,
const R::RString configdir 
)

Constructor.

Parameters
idIdentifier.
nameName of the session.
configdirDirectory where to search for the configuration file of the session.
virtual ~GSession ( void  )
virtual

Destruct the session.

Member Function Documentation

virtual void HandlerNotFound ( const R::RNotification notification)
virtual

This method is call when no handler is founded for a notification send by the session. Actually, it does nothing.

Parameters
notificationNotification.

Reimplemented from RObject.

size_t GetId ( void  ) const
Returns
the identifier of the session.
R::RString GetName ( void  ) const
Returns
the name of the session.
int Compare ( const GSession session) const

Compare two session regarding their identifiers.

Parameters
sessionSession to compare with.
Returns
a value compatible with R::RContainer.
int Compare ( size_t  id) const

Compare the identifier of the session with a given one.

Parameters
idIdentifier to compare with.
Returns
a value compatible with R::RContainer.
int Compare ( const R::RString name) const

Compare the name of the session with a given one.

Parameters
nameName to compare with.
Returns
a value compatible with R::RContainer.
R::RTextFile& GetLog ( void  )
Returns
the log file current used.
bool MustBreak ( void  )

See if the session must break.

void ResetBreak ( void  )

Reset the break on a session. This method must be called after a SetBreak to allow the session to do something again.

void SetBreak ( void  )

Ask to session to break as soon as possible. The method ResetBreak should be called to allow the session to do something again.

int GetCurrentRandom ( void  ) const

Get The Current RandomSeed.

Returns
The current RandomSeed.
size_t GetCurrentRandomValue ( size_t  max)

Get a current Random Value.

Parameters
maxMax Random Value.
Returns
The current Random value * max.
R::RRandom& GetRandom ( void  )

Get the random number generator.

Returns
Pointer to RMath::RRandom;
void ApplyConfig ( void  )

Apply the internal configuration. This method must be called to take changes in the configuration into account.

bool MustSaveResults ( void  ) const

Verify if the results of the computations must be saved.

void SetCurrentRandom ( int  rand)

Set The Current RandomSeed.

Parameters
randCurrent RandomSeed.
void SetSaveResults ( bool  save = true)

Set if the results of the computation must be saved or not.

Parameters
saveSave the objects after computation?
R::RString AnalyzeString ( const R::RString str)

Analyze a given string to search for variables of the type '%var%'. These variables are then replaced with the corresponding value. Actually, the known variables are:

  • %world% : Name of the session.
Parameters
strString to analyze.
GDocAnalyze* ReserveAnalyzer ( void  )

Reserve a document analyzer. While it is not released, it cannot be used by the session.

Returns
a pointer to a GDocAnalyze.
void ReleaseAnalyzer ( GDocAnalyze analyzer)

Release an analyzer.

Parameters
analyzerAnalyzer to release.
void AnalyzeDoc ( GDoc doc,
GSlot rec = 0,
bool  force = false,
bool  download = true 
)

Analyze a document.

If multiple analyzers are managed by the session, one is randomly chosen.

Parameters
docPointer to the document to analyze.
recReceiver for the signals.
forceForce the analysis of the document?
downloadTry to download locally the document?
Exceptions
Whenno analyzer is available.
void AnalyzeDocs ( GSlot rec = 0)

Analyze the documents. At the end, all the enabled post-documents methods are run.

All enabled analyzers managed by the session are used.

Parameters
recReceiver for the signals.
Exceptions
Whenno analyzer is available.
void GroupDocs ( GSlot rec = 0)

Groups the documents into topics. At the end, all the enabled post-topic computing methods are called.

Parameters
recReceiver of the signals.
void CalcProfile ( GProfile profile,
GProfileCalc method = 0,
GLinkCalc linkcalc = 0,
GSlot rec = 0 
)

Compute a profile.

Parameters
profileProfile to compute.
methodProfile Computation method.
linkcalcLink Computation method.
recReceiver for the signals.
void CalcProfiles ( GSlot rec = 0)

Compute the profiles.

Parameters
recReceiver for the signals.
void GroupProfiles ( GSlot rec = 0)

Groups the profiles into communities. At the end, all the enabled post-community computing methods are called.

Parameters
recReceiver of the signals.
void ComputeSugs ( GSlot rec = 0)

Run all the enabled suggestions computing methods.

Parameters
recReceiver of the signals.
void ComputeTrust ( GSlot rec = 0)

Run all the enabled trust computing methods.

Parameters
recReceiver of the signals.
void RunTool ( const R::RString name,
const R::RString list,
GSlot slot = 0,
bool  need = true 
)

Run a specific tool.

Parameters
nameName of the tool.
listList of the tool.
slotSlot.
needIf set to true and the tool doesn't exist, it generates an exception.
void RequestMetaEngine ( const R::RString query,
size_t  caller 
)

Send a query to the meta-engine selected. The documents are researched and ranked.

Each time the meta-engine is called, it is associated with a given data structure which is reserved by GSession. It is used to store the results. To safe resources, it is a good practice that the developer calls the GSession::ClearMetaEngine method to free the used data structure.

Parameters
queryString representing the query.
callerIdentifier of the caller (for example a thread).
void ClearMetaEngine ( size_t  caller)

Clear the default meta engine by freeing the data structure reserved for it.

Parameters
callerIdentifier of the caller (for example a thread).
size_t GetNbObjs ( tObjType  type) const

Get the number of elements of a given type.

Parameters
typeType of the elements.
Returns
Number of elements.
size_t GetMaxObjId ( tObjType  type) const

Get the highest identifier for the elements of a given type.

Parameters
typeType of the elements.
Returns
Highest identifier.
size_t GetMaxObjPos ( tObjType  type) const

Get the maximum position of the objects of a given type handled.

Parameters
typeType of the elements.
Returns
Maximum position occupied by the elements.
GObject* GetObj ( tObjType  type,
size_t  id,
bool  null = false 
)

Find an object of a given type and with a particular identifier.

Parameters
typeType. Only the objects managed.
idIdentifier.
nullIf set to true, if the object does not exist, return 0, else an exception is generated.
Returns
Pointer to the object.
size_t GetObjs ( tObjType  type,
GObject **&  tab,
bool  alloc 
)

Fill an array of pointers with the elements of a given type.

Parameters
typeType of the elements.
tabArray that will be filled.
allocMust the array be allocated.
Returns
number of elements in the array (including null pointers).
void VerifyTab ( tObjType  type,
size_t  max 
)

Verify that a given set of containers can hold a given size of objects. This method can be useful before a given set of elements is loaded in order to avoid a constant increase of the corresponding containers.

Parameters
typeType of the container.
maxMaximum number of objects.
GSimulator* GetSimulator ( void  ) const
Returns
Simulator associated with the session.
void ReInit ( const GSubject obj,
bool  cleardocs 
)

Re-initialize the subjects for a new validation process. In practice, the methods deselects all the documents, and delete the users, the feedbacks, the profiles, the communities, the topics and the classes. Eventually, the document descriptions are cleared too.

The method sends several hReInit notifications.

Parameters
objPseudo-parameter.
cleardocsShould the documents descriptions be cleared.
void ReInit ( const GDoc obj,
bool  del 
)

Re-initialize the documents. In practice, the method deletes the topics and the classes since they depend directly from the documents descriptions. If the documents must be deleted, the method also deletes the feedbacks.

The method sends several hReInit notifications.

Parameters
objPseudo-parameter.
delShould the documents be deleted or just their descriptions cleared.
void ReInit ( const GUser obj)

Re-initialize the users. In practice, the method deletes the users, the profiles, the communities and the feedbacks.

The method sends several hReInit notifications.

Parameters
objPseudo-parameter.
void ReInit ( const GProfile obj,
bool  del 
)

Re-initialize the profiles. In practice, the method deletes the communities since they depend directly from the profiles descriptions. If the profiles must be deleted, the method also deletes the feedbacks.

The method sends several hReInit notifications.

Parameters
objPseudo-parameter.
delShould the profiles be deleted or just their descriptions cleared.
void ReInit ( const GFdbk obj)

Delete the feedbacks.

The method sends a hReInit notification.

Parameters
objPseudo-parameter.
void ReInit ( const GTopic obj)

Delete the topics.

The method sends a hReInit notification.

Parameters
objPseudo-parameter.
void ReInit ( const GClass obj)

Delete the classes.

The method sends a hReInit notification.

Parameters
objPseudo-parameter.
void ReInit ( const GCommunity obj)

Delete the communities.

The method sends a hReInit notification.

Parameters
objPseudo-parameter.
bool InsertFdbk ( GProfile prof,
GDoc doc,
tFdbkType  fdbk,
R::RDate  done,
bool  load = false 
)

Add a new feedback of a given profile on a given document.

Parameters
profProfile.
docDocument.
fdbkFeedback type.
doneDate on the last feedback.
loadIs the feedback loaded from the storage or not. It should be always true if the method is call from a GStorage child class.
Returns
true if it is a new feedback.
bool InsertFdbk ( size_t  profid,
size_t  docid,
tFdbkType  fdbk,
R::RDate  done,
bool  load = false 
)

Add a new feedback of a given profile on a given document.

Parameters
profidIdentifier of the profile.
docidIdentifier of the document.
fdbkFeedback type.
doneDate on the last feedback.
loadIs the feedback loaded from the storage or not. It should be always true if the method is call from a GStorage child class.
Returns
true if it is a new feedback.
void UpdateCommunity ( GProfile prof)

A profile was updated and the corresponding community must be updated.

Parameters
profProfile.
void UpdateCommunity ( size_t  profid)

A profile was updated and the corresponding community must be updated.

Parameters
profidIdentifier of the profile.
void SetName ( GUser user,
const R::RString name,
const R::RString fullname = R::RString::Null 
)

Set the name of a user.

Parameters
userUser.
nameName of the user.
fullnameFull name of the user. If null string, the name is used.
void SetName ( GProfile profile,
const R::RString name 
)

Set the name of a profile.

Parameters
profProfile.
nameName.
void SetSocial ( GProfile profile,
bool  social 
)

Set if a profile is social.

Parameters
profProfile.
socialSocial value.
void SetConfidence ( GProfile profile,
double  score,
char  level 
)

Set the confidence score and level of a profile.

Parameters
profProfile.
scoreConfidence level.
levelConfidence score.
void UpdateProfiles ( size_t  docid)

A document was updated and the profiles that have made a feedback on it must be updated.

Parameters
docidIdentifier of the document.
void UpdateTopic ( GDoc doc)

A document was updated and the corresponding topic must be updated.

Parameters
docDocument.
void UpdateTopic ( size_t  docid)

A document was updated and the corresponding topic must be updated.

Parameters
docidIdentifier of the document.
void Init ( void  )
private

Initialize the session.

void EmitReInit ( tObjType  type,
bool  del 
)
private

Emit a hReInit notification for a given object type.

Parameters
typeType of the objects.
delWere the objects deleted ?
bool IsDefined ( const R::RContainer< GVector, true, true > &  vectors)
private

Verify if at least one vector is defined in the container.

Parameters
vectorsVectors.
Returns
true if the container is defined.

Member Data Documentation

size_t Id
private

Identifier of the session.

R::RString Name
private

Name of the session.

bool ValidConfigFile
private

Specify if the configuration file is a valid one.

R::RTextFile Log
private

Log file for the session.

int CurrentRandom
private

Current seek for the session.

R::RRandom Random
private

Random number generator.

bool ExternBreak
private

External break.

GSimulator* Simulator
private

The simulator (if any).

bool ClusterSelectedDocs
private

Limit the clustering of the documents to the selected ones.

GDocAnalyze DocAnalyze
private

Analyze of the document.

bool AnalyzerReserved
private

Is the analyzer reserved ?