Subject. More...

#include <gsubject.h>

Inheritance diagram for GSubject:
[legend]

Public Member Functions

 GSubject (GSession *session, size_t id, const R::RString &name)
 
int Compare (const GSubject &sub) const
 
int Compare (const size_t id) const
 
int Compare (const R::RString &name) const
 
R::RString GetName (void) const
 
R::RString GetFullName (void) const
 
size_t GetId (void) const
 
bool IsUsed (void) const
 
size_t GetNbSubjects (void) const
 
size_t GetDepth (void) const
 
GSubjectGetParent (void) const
 
void CreateDescription (tSubjectDesc desc)
 
bool IsUsed (GDoc *doc) const
 
bool IsIn (GDoc *doc) const
 
void GetObjs (GDoc **docs, size_t &nb, size_t maxdepth)
 
size_t GetNbObjs (const GDoc *obj, size_t maxdepth)
 
bool IsIn (GProfile *prof) const
 
bool IsUsed (GProfile *prof) const
 
void ClearIdealGroup (tObjType type)
 
void AssignIdeal (GCommunity *com)
 
void AssignIdeal (GTopic *top)
 
GCommunityGetIdealCommunity (void) const
 
GTopicGetIdealTopic (void) const
 
size_t GetNbObjs (const GSubject *obj, tObjType type) const
 
size_t GetNbUsedObjs (const GSubject *obj, tObjType type) const
 
size_t GetNbUsedObjs (const GCommunity *com) const
 
size_t GetNbUsedObjs (const GTopic *top) const
 
size_t GetNbUsedObjs (const R::RContainer< GDoc, false, false > *docs) const
 
size_t GetNbUsedObjs (tObjType type) const
 
R::RCursor< GProfileGetObjs (const GProfile *obj) const
 
R::RCursor< GProfileGetUsedObjs (const GProfile *obj) const
 
R::RCursor< GDocGetUsedObjs (const GDoc *obj) const
 
R::RCursor< GDocGetObjs (const GDoc *obj) const
 
size_t GetNbObjs (const GDoc *obj) const
 
GLangGuessLang (bool lookparent=true) const
 
virtual double GetUpOperationCost (void) const
 
virtual ~GSubject (void)
 
- Public Member Functions inherited from GDescription
 GDescription (void)
 
 GDescription (const GDescription &src)
 
int Compare (const GDescription &) const
 
void ReleaseVectors (void)
 
R::RConstCursor< GVectorGetVectors (void) const
 
R::RCursor< GVectorGetVectors (void)
 
const GVectorGetVector (GConcept *metaconcept) const
 
GVectorGetVector (GConcept *metaconcept)
 
GVectorGetInsertVector (GConcept *metaconcept)
 
void DeleteVector (GConcept *metaconcept)
 
bool IsDefined (void) const
 
bool IsIn (const GConcept *concept) const
 
void Clear (void)
 
void Normalize (void)
 
template<class S >
void Print (S &stream, const R::RString &name, const char *format="%E", size_t colsize=12) const
 
GDescriptionoperator= (const GDescription &desc)
 
GDescriptionoperator+= (const GDescription &desc)
 
GDescriptionoperator-= (const GDescription &desc)
 
GDescriptionoperator*= (const double nb)
 
GDescriptionoperator/= (const double nb)
 
virtual ~GDescription (void)
 

Private Member Functions

virtual void Clear (void)
 
void ReInit (void)
 

Private Attributes

GSessionSession
 
size_t Id
 
R::RString Name
 
bool Used
 
R::RContainer< GDoc, false, true > Docs
 
R::RContainer< GDoc, false, true > UsedDocs
 
R::RContainer< GProfile, false,
true > 
Profiles
 
GCommunityCommunity
 
GTopicTopic
 

Additional Inherited Members

- Protected Member Functions inherited from GDescription
virtual bool LoadVectors (void)
 
void Copy (GConcept *metaconcept, const R::RContainer< GConceptRef, false, true > &list)
 
- Protected Attributes inherited from GDescription
R::RContainer< GVector, true,
true > * 
Vectors
 

Detailed Description

Subject.

The GSubject class provides a representation for a subject, i.e. an ideal group of documents and profiles.

This class is used for validation purposes.

Constructor & Destructor Documentation

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

Constructor of a subject.

Parameters
sessionSession.
idIdentifier of the subject.
nameName of the subject.
virtual ~GSubject ( void  )
virtual

Destruct the subject.

Member Function Documentation

int Compare ( const GSubject sub) const

Compare two subjects by comparing their identifier.

See also
R::RContainer
Parameters
subSubject.
Returns
int
int Compare ( const size_t  id) const

Compare the identifier of a subject with another one.

See also
R::RContainer
Parameters
idIdentifier.
Returns
int
int Compare ( const R::RString name) const

Compare the name of a subject with a given string.

See also
R::RContainer
Parameters
nameString.
Returns
int
R::RString GetName ( void  ) const

Return the name of the Subject.

Returns
RString.
R::RString GetFullName ( void  ) const

Return the full name of the subject including the name of its parents.

Returns
RString.
size_t GetId ( void  ) const

Get the identifier of the Subject.

Returns
The id of the subject.
bool IsUsed ( void  ) const

Verify if the subject is used.

Returns
bool.
size_t GetNbSubjects ( void  ) const
Returns
number of child subjects.
size_t GetDepth ( void  ) const

Get the depth of the subject.

GSubject* GetParent ( void  ) const

Get the parent of the subject.

Returns
pointer to the parent or null if it is a top subject.
void CreateDescription ( tSubjectDesc  desc)

Create a description. In practice, it is computed as name of the subject and its parents, or as the gravitation center of the documents (for a leaf node) or of the children (for a non-leaf node).

Parameters
descType of description to create.
bool IsUsed ( GDoc doc) const

Verify if a document is used by the subject.

Parameters
docPointer to the document.
bool IsIn ( GDoc doc) const

Verify if a document is assign to the subject. This doesn't means that the document is used by that subject (use GSubject::IsUsed for that purpose).

Parameters
docPointer to the document.
void GetObjs ( GDoc **  docs,
size_t &  nb,
size_t  maxdepth 
)

Fill a given array with all the documents. If the subject has the maximal depth, all the documents of its sub-subjects are also inserted.

The array must be created and must be large enough to hold all the documents.

See also
This method is used in GSimulator to create assessments for profiles during a simulation of a real system.
Parameters
docsPointer to the array.
maxdepthMaximal depth.
nbNumber of elements in the array.
size_t GetNbObjs ( const GDoc obj,
size_t  maxdepth 
)

Compute the maximal number of documents available for the subject (and its sub-subject).

Parameters
objPseudo-parameter.
maxdepthMaximal depth.
Returns
the number of documents related to this subject that can be inserted.
bool IsIn ( GProfile prof) const

Verify if a profile is assign to the subject.

Parameters
profPointer to the profile.
bool IsUsed ( GProfile prof) const

Verify if a profile is used by the subject. In practice, all profiles assigned to a subject are used.

Parameters
profPointer to the profile.
void ClearIdealGroup ( tObjType  type)

Clear the ideal group of a given type.

Parameters
typeType of the group.
void AssignIdeal ( GCommunity com)

Assign an ideal community to the subject. This method should only be used when the current clustering becomes the ideal one.

Parameters
comCommunity.
void AssignIdeal ( GTopic top)

Assign an ideal topic to the subject. This method should only be used when the current clustering becomes the ideal one.

Parameters
topCommunity.
GCommunity* GetIdealCommunity ( void  ) const

Get the ideal community associated with the subject.

GTopic* GetIdealTopic ( void  ) const

Get the ideal topic associated with the subject.

size_t GetNbObjs ( const GSubject obj,
tObjType  type 
) const

Get the number of objects of a given type (otProfile or otDoc) associated to the subject (and eventually its sub-subjects).

Parameters
objPseudo-parameter.
typeType.
size_t GetNbUsedObjs ( const GSubject obj,
tObjType  type 
) const

Get the number of used objects of a given type (otProfile or otDoc) associated to the subject (and eventually its sub-subjects).

Parameters
objPseudo-parameter.
typeType.
size_t GetNbUsedObjs ( const GCommunity com) const

Compute the number of profiles of a given community that are also in the current one.

Parameters
comCommunity.
size_t GetNbUsedObjs ( const GTopic top) const

Compute the number of used documents of a given topic that are also in the current one.

Parameters
topTopic.
size_t GetNbUsedObjs ( const R::RContainer< GDoc, false, false > *  docs) const

Compute the number of used documents of a given container that are also in the current one.

Parameters
docsContainer of documents.
size_t GetNbUsedObjs ( tObjType  type) const

Get the number of objects of a given type (otProfile or otDoc) associated to a the subject.

Parameters
typeType.
R::RCursor<GProfile> GetObjs ( const GProfile obj) const

Get a cursor over the profiles contained in the subject.

Parameters
objPseudo-parameter.
R::RCursor<GProfile> GetUsedObjs ( const GProfile obj) const

Get a cursor over the used profiles contained in the subject. In practice, all the profiles assigned to a subject are used.

Parameters
objPseudo-parameter.
R::RCursor<GDoc> GetUsedObjs ( const GDoc obj) const

Get a cursor over the documents contained in the subject.

Parameters
objPseudo-parameter.
R::RCursor<GDoc> GetObjs ( const GDoc obj) const

Get a cursor over the all the documents contained in the subject.

Parameters
objPseudo-parameter.
size_t GetNbObjs ( const GDoc obj) const

The the number of documents assigned to this subject.

Parameters
objPseudo-parameter.
GLang* GuessLang ( bool  lookparent = true) const

Guess the language of a subject. It is the language of the most documents attached to this subject. If not found, it is supposed that the language is the one of the parent.

Parameters
lookparentLook also in the parents.
Returns
a pointer to the corresponding GLang.
virtual double GetUpOperationCost ( void  ) const
virtual

Get the cost of an Up operation of the current node. The method adds a cost computed for each vector. The cost of one vector is :

  1. The number of concept references if the class has no parent.
  2. The difference of the number of concept references between the parent and the current class.

In their paper TreeRank: A Similarity Measure for Nearest Neighbor Searching in Phylogenetic Databases, Wang, Shan, Shasha and Piel define the up operation as the operation that moves a token from one node to its parent.

Returns
Cost of the up operation.
virtual void Clear ( void  )
privatevirtual

Clear the subject.

void ReInit ( void  )
private

Initialize the subject (reset all profiles assigned).

An notification eUnselectDoc is generated for each document.

Member Data Documentation

GSession* Session
private

Session.

size_t Id
private

Identifier of the subject.

R::RString Name
private

Name of the subject.

bool Used
private

Is the subject used.

R::RContainer<GDoc,false,true> Docs
private

Documents categorized to this subject.

R::RContainer<GDoc,false,true> UsedDocs
private

Selected documents attached to this subject.

R::RContainer<GProfile,false,true> Profiles
private

Profiles attached to this subject.

GCommunity* Community
private

Ideal community.

GTopic* Topic
private

Ideal topic.