Subject. More...
#include <gsubject.h>
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 |
GSubject * | GetParent (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) |
GCommunity * | GetIdealCommunity (void) const |
GTopic * | GetIdealTopic (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< GProfile > | GetObjs (const GProfile *obj) const |
R::RCursor< GProfile > | GetUsedObjs (const GProfile *obj) const |
R::RCursor< GDoc > | GetUsedObjs (const GDoc *obj) const |
R::RCursor< GDoc > | GetObjs (const GDoc *obj) const |
size_t | GetNbObjs (const GDoc *obj) const |
GLang * | GuessLang (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< GVector > | GetVectors (void) const |
R::RCursor< GVector > | GetVectors (void) |
const GVector * | GetVector (GConcept *metaconcept) const |
GVector * | GetVector (GConcept *metaconcept) |
GVector * | GetInsertVector (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 |
GDescription & | operator= (const GDescription &desc) |
GDescription & | operator+= (const GDescription &desc) |
GDescription & | operator-= (const GDescription &desc) |
GDescription & | operator*= (const double nb) |
GDescription & | operator/= (const double nb) |
virtual | ~GDescription (void) |
Private Member Functions | |
virtual void | Clear (void) |
void | ReInit (void) |
Private Attributes | |
GSession * | Session |
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 |
GCommunity * | Community |
GTopic * | Topic |
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
-
session Session. id Identifier of the subject. name Name of the subject.
|
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
-
sub Subject.
- Returns
- int
int Compare | ( | const size_t | id | ) | const |
Compare the identifier of a subject with another one.
- See also
- R::RContainer
- Parameters
-
id Identifier.
- Returns
- int
int Compare | ( | const R::RString & | name | ) | const |
Compare the name of a subject with a given string.
- See also
- R::RContainer
- Parameters
-
name String.
- 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
-
desc Type of description to create.
bool IsUsed | ( | GDoc * | doc | ) | const |
Verify if a document is used by the subject.
- Parameters
-
doc Pointer 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
-
doc Pointer 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
-
docs Pointer to the array. maxdepth Maximal depth. nb Number 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
-
obj Pseudo-parameter. maxdepth Maximal 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
-
prof Pointer 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
-
prof Pointer to the profile.
void ClearIdealGroup | ( | tObjType | type | ) |
Clear the ideal group of a given type.
- Parameters
-
type Type 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
-
com Community.
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
-
top Community.
GCommunity* GetIdealCommunity | ( | void | ) | const |
Get the ideal community associated with the subject.
GTopic* GetIdealTopic | ( | void | ) | const |
Get the ideal topic associated with the subject.
Get the number of objects of a given type (otProfile or otDoc) associated to the subject (and eventually its sub-subjects).
- Parameters
-
obj Pseudo-parameter. type Type.
Get the number of used objects of a given type (otProfile or otDoc) associated to the subject (and eventually its sub-subjects).
- Parameters
-
obj Pseudo-parameter. type Type.
size_t GetNbUsedObjs | ( | const GCommunity * | com | ) | const |
Compute the number of profiles of a given community that are also in the current one.
- Parameters
-
com Community.
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
-
top Topic.
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
-
docs Container 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
-
type Type.
R::RCursor<GProfile> GetObjs | ( | const GProfile * | obj | ) | const |
Get a cursor over the profiles contained in the subject.
- Parameters
-
obj Pseudo-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
-
obj Pseudo-parameter.
R::RCursor<GDoc> GetUsedObjs | ( | const GDoc * | obj | ) | const |
Get a cursor over the documents contained in the subject.
- Parameters
-
obj Pseudo-parameter.
R::RCursor<GDoc> GetObjs | ( | const GDoc * | obj | ) | const |
Get a cursor over the all the documents contained in the subject.
- Parameters
-
obj Pseudo-parameter.
size_t GetNbObjs | ( | const GDoc * | obj | ) | const |
The the number of documents assigned to this subject.
- Parameters
-
obj Pseudo-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
-
lookparent Look also in the parents.
- Returns
- a pointer to the corresponding GLang.
|
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 :
- The number of concept references if the class has no parent.
- 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.
|
privatevirtual |
Clear the subject.
|
private |
Initialize the subject (reset all profiles assigned).
An notification eUnselectDoc is generated for each document.
Member Data Documentation
|
private |
Session.
|
private |
Identifier of the subject.
|
private |
Name of the subject.
|
private |
Is the subject used.
|
private |
Documents categorized to this subject.
|
private |
Selected documents attached to this subject.
|
private |
Profiles attached to this subject.
|
private |
Ideal community.
|
private |
Ideal topic.