Subjects. More...

#include <gsubjects.h>

Inheritance diagram for GSubjects:
[legend]

Public Member Functions

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)
 

Protected Member Functions

 GSubjects (GSession *session)
 
virtual void Clear (void)
 
void ReInit (void)
 
void LoadObjs (const GSubject *obj)
 

Protected Attributes

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
 

Additional Inherited Members

- Private 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)
 
 GKB (GSession *session)
 
void ClearIndex (tObjType type)
 
- Private 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
 

Detailed Description

Subjects.

The GSubjects provides a representation for a hierarchy of subjects (GSubject).

This class is used for validation purposes. It allows to associate documents and profiles to ideal groups and to compare them to computed groups (topics for documents and communities for profiles).

It is possible to use some documents and subjects only.

Constructor & Destructor Documentation

GSubjects ( GSession session)
protected

Construct a tree of subjects.

Parameters
sessionSession.

Member Function Documentation

virtual void Clear ( void  )
protectedvirtual

Clear the tree.

Reimplemented from RTree< T, N, bAlloc >.

void ReInit ( void  )
protected

Re-initialize the subjects.

void LoadObjs ( const GSubject obj)
protected

Load the subjects.

Parameters
objPseudo-parameter.
size_t GetMaxDepth ( void  ) const

Get the depth of the tree formed by all the subjects.

size_t GetNbObjs ( const GSubject obj) const

Get the total number of subjects.

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

Get a cursor over all the nodes of the tree.

Parameters
objPseudo-parameter.
R::RNodeCursor<GSubjects,GSubject> GetObjs ( const GSubject obj,
const GSubject parent 
) const

Get a cursor over the child subjects of a given subject.

Parameters
objPseudo-parameter.
parentParent subject. If null, the top subjects are returned.
size_t GetObjs ( GSubject **  subjects)

Fill a given array with all the subjects. The array must be created and must be large enough to hold all the subjects.

See also
This method is used in GSimulator to create assessments for profiles during a simulation of a real system.
Parameters
subjectsPointer to the array.
Returns
Size of the data copied in the array.
GSubject* GetObj ( const GSubject obj,
size_t  id 
) const

Get a subject.

Parameters
objPseudo-parameter.
idIdentifier of the subject.
Returns
Pointer to GSubject.
GSubject* GetObj ( const GSubject obj,
const R::RString name 
) const

Get a pointer to a given subject.

Parameters
objPseudo-parameter.
nameName of the subject.
Returns
Return the pointer or 0 if the element is not in the tree.
void InsertObj ( GSubject to,
GSubject subject 
)

Insert a subject and attached it to a parent. If the parent is null, the subject is considered as one of the top subject of the tree.

Parameters
toParent where the subject is to attached.
subjectSubject to insert.
size_t GetNbUsedObjs ( tObjType  type) const

Compute the number of used object of a given type (otProfile or otDoc).

Parameters
objPseudo-parameter.
typeType.
size_t GetNbObjs ( const GSubject obj,
GDoc doc 
) const

Get the number of subjects associated with a given document.

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

Get a Cursor on the subjects of a given document.

Parameters
objPseudo-parameter.
docDocument.
const GSubject* GetObj ( const GSubject obj,
const GDoc doc,
bool  one = true 
) const

Get the first subject of a given document.

Parameters
objPseudo-parameter.
docDocument.
onlySuppose the document is associated with only one subject. If true, and if there are multiple subjects associated, an exception is generated.
void SetUsed ( GSubject subject,
bool  select 
)

Select or deselect a subject.

Parameters
subjectSubject.
selectedMust the document be selected.

If a subject is deselected, all the documents attached are automatically deselected. The inverse is not true.

bool IsUsed ( const GDoc doc) const

Look if a document is selected or not.

Parameters
docDocument.
Returns
true if the document is selected.
size_t GetUsedObjs ( GDoc **  docs)

Fill a given array with all the selected documents. 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.
Returns
Size of the data copied in the array.
R::RCursor<GDoc> GetUsedObjs ( const GDoc obj) const

Get a cursor over the selected documents.

Parameters
objPseudo-parameter.
bool IsFromParentSubject ( const GDoc doc,
const GSubject subject 
) const

Look if a document is in the parent subject.

Parameters
docPointer to the document.
subjectSubject.
Returns
true if it is the case.
bool IsFromSubject ( const GDoc doc,
const GSubject subject 
) const

Look if a document is from a given subject.

Parameters
docPointer to the document.
subjectSubject.
Returns
true if it is the case.
void InsertObj ( GSubject subject,
GDoc doc 
)

Add a given document to a subject. The document is consider as deselected.

Parameters
subjectSubject.
docDocument.
void SetUsed ( GDoc doc,
GSubject subject,
bool  select 
)

Select or deselect an document in relation with a given subject.

Parameters
docDocument.
subjectSubject.
selectedMust the document be selected.

A notification eSelectDoc is generated if the document is not already selected (a notification is therefore never emitted while the subjects are loaded). A notification oeDeselected is generated for the document if it isn't selected anymore.

const GSubject* GetObj ( const GSubject obj,
const GProfile profile 
) const

Get the subject of a given profile.

Parameters
objPseudo-parameter.
profileProfile.
void InsertObj ( GSubject subject,
GProfile profile 
)

Add a given profile to a subject.

Parameters
subjectSubject.
profileProfile.
const GSubject* GetObj ( const GSubject obj,
const GCommunity com 
) const

Get the subject of a given community.

Parameters
objPseudo-parameter.
comPointer to the community.
void SetDescType ( tSubjectDesc  type)

Set the descriptions of the subjects.

Parameters
typeTYpe of the subjects.
void Repair ( void  )

Repair the subjects. It practice, it performs the following modifications:

  • All leaf subjects without document associated are removed.
  • If a subject has associated documents and child subjects, a new child subject is created and the documents are transfered to it.

Member Data Documentation

R::RContainer<GSubject,false,true> Subjects
protected

Container of subjects ordered by identifier.

R::RContainer<GSubject,false,true> UsedSubjects
protected

Container of selected subjects ordered by identifier.

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

Container of used documents.

R::RBoolVector DocsStatus
protected

Document status (selected or not).

R::RContainer<R::RContainer<GSubject,false,false>,true,false> DocsSubjects
protected

Subjects for the documents (the identifier of the document provides the index in the container).

R::RContainer<GSubject,false,false> ProfilesSubject
protected

Subjects for the profiles (the identifier of the profile provides the index in the container).

bool MustLoad
protected

Specify if the subjects must be loaded.

tSubjectDesc DescType
protected

Type of the description.