Document. More...

#include <gdoc.h>

Inheritance diagram for GDoc:
[legend]

Public Member Functions

 GDoc (GSession *session, const R::RString &uri, const R::RString &title, const R::RString &desc, GLang *lang, const R::RString &mime, const R::RDate &u=R::RDate::GetToday())
 
 GDoc (GSession *session, const R::RString &uri, const R::RString &title, const R::RString &desc, size_t id, size_t blockid, size_t structid, GLang *lang, const R::RString &mime, size_t grpid, const R::RDate &c, const R::RDate &u, const R::RDate &a)
 
virtual R::RCString GetClassName (void) const
 
int Compare (const GDoc &doc) const
 
void ReleaseTree (void)
 
void LoadTree (GConceptTree *&tree) const
 
GConceptTreeGetTree (void) const
 
void LoadTree (R::RContainer< GConceptRecord, false, true > &records, size_t &nbrecords, size_t &nbtoprecords, size_t &nbrefs)
 
R::RString GetTitle (void) const
 
GLangGetLang (void) const
 
R::RDate GetUpdated (void) const
 
R::RDate GetComputed (void) const
 
R::RString GetMIMEType (void) const
 
void SetMIMEType (const R::RString &mime)
 
R::RString GetDescription (void) const
 
bool MustCompute (void) const
 
R::RDate GetAttached (void) const
 
size_t GetGroupId (void) const
 
void SetGroup (size_t groupid)
 
size_t GetStructId (void) const
 
R::RNumCursor< size_t > GetFdbks (void) const
 
double GetAgreementRatio (const GDoc *doc, size_t nbmin) const
 
double GetDisagreementRatio (const GDoc *doc, size_t nbmin) const
 
size_t GetNbFdbks (void) const
 
void SetUpdated (R::RDate &date)
 
void Update (GLang *lang, GDescription &desc, R::RContainer< GConceptRecord, false, true > &records, size_t nbrecords, size_t nbtoprecords, size_t nbrefs)
 
virtual ~GDoc (void)
 
- Public Member Functions inherited from GDescriptionObject< GDoc >
 GDescriptionObject (GSession *session, size_t id, size_t blockid, tObjType objtype, const R::RString &name)
 
void ReleaseVectors (void)
 
const GDescriptionoperator() (void) const
 
R::RConstCursor< GVectorGetVectors (void) const
 
const GVectorGetVector (GConcept *metaconcept) const
 
bool IsIn (const GConcept *concept) const
 
bool IsDefined (void) const
 
tObjState GetState (void) const
 
size_t GetId (void) const
 
size_t GetBlockId (void) const
 
virtual ~GDescriptionObject (void)
 
- Public Member Functions inherited from GObject
 GObject (GSession *session, size_t id, const R::RString &name, tObjType type)
 
 GObject (const GObject &obj)
 
void VerifyStatements (tStatementElement what, size_t size)
 
int Compare (const GObject &obj) const
 
int Compare (size_t id) const
 
int Search (const GObject &obj) const
 
int Search (const R::RString &name) const
 
GSessionGetSession (void) const
 
size_t GetId (void) const
 
void SetId (size_t id)
 
tObjType GetObjType (void) const
 
R::RCursor< GStatementGetObjs (const GStatement *obj, tStatementElement what)
 
virtual void HandlerNotFound (const R::RNotification &notification)
 
virtual ~GObject (void)
 
- Public Member Functions inherited from RObject
 RObject (const RString &name=RString::Null)
 
int Compare (const RObject &obj) const
 
RString GetName (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)
 

Static Public Member Functions

static bool HasTree (void)
 
static tObjType GetType (void)
 
- Static Public Member Functions inherited from GDescriptionObject< GDoc >
static bool HasDesc (void)
 
- Static Public Member Functions inherited from GObject
static bool HasDesc (void)
 
static bool HasTree (void)
 

Private Member Functions

void Clear (bool disk)
 
void SetTree (GConceptTree &tree)
 
bool InsertFdbk (size_t profileid)
 
void DeleteFdbk (size_t profileid)
 
void ClearFdbks (void)
 

Private Attributes

R::RString Title
 
GLangLang
 
R::RString MIMEType
 
R::RDate Updated
 
R::RDate Computed
 
R::RNumContainer< size_t, true > * Fdbks
 
size_t GroupId
 
R::RDate Attached
 
size_t StructId
 
GConceptTreeTree
 
R::RString Description
 

Additional Inherited Members

- Protected Member Functions inherited from GDescriptionObject< GDoc >
virtual bool LoadVectors (void)
 
- Protected Attributes inherited from GDescriptionObject< GDoc >
tObjState State
 
- Protected Attributes inherited from GObject
GSessionSession
 
size_t Id
 
tObjType ObjType
 
R::RContainer< GStatement,
false, true > * 
Subjects
 
R::RContainer< GStatement,
false, false > * 
Predicates
 
R::RContainer< GStatement,
false, false > * 
Values
 
- Protected Attributes inherited from RObject
RString Name
 

Detailed Description

Document.

The GDoc class provides a representation of a analyzed document. In fact, a document is represented as a set of vectors and, eventually, its concept tree (the positions and the depths of each concept occurrence). In the tensor space model, the (hyper)links between documents are represented as a vector corresponding to concept category "link"

Warning
Since the concept tree is memory consuming, it is not associated with the document and must be managed by the developer.

Constructor & Destructor Documentation

GDoc ( GSession session,
const R::RString uri,
const R::RString title,
const R::RString desc,
GLang lang,
const R::RString mime,
const R::RDate u = R::RDate::GetToday() 
)

Construct a new document.

Parameters
sessionSession.
uriURI of the document.
titleTitle of the document.
descDescription of the document.
langLanguage of the document.
mimeMIME type of the document.
uDate of the last updated.
GDoc ( GSession session,
const R::RString uri,
const R::RString title,
const R::RString desc,
size_t  id,
size_t  blockid,
size_t  structid,
GLang lang,
const R::RString mime,
size_t  grpid,
const R::RDate c,
const R::RDate u,
const R::RDate a 
)

Construct a document.

Parameters
sessionSession.
uriURI of the document.
titleTitle of the document.
descDescription of the document.
idIdentifier of the document.
blockidIdentifier of the block for the description.
structidIdentifier of the block for the structure.
langLanguage of the document.
mimeMIME type of the document.
grpidTopic identifier.
cDate of the last computation.
uDate of the last updated.
aDate of the last attached.
virtual ~GDoc ( void  )
virtual

Destruct the document.

Member Function Documentation

virtual R::RCString GetClassName ( void  ) const
virtual
Returns
the class name.

Reimplemented from GObject.

static bool HasTree ( void  )
static

Defines that the documents have concept trees.

Returns
true.
static tObjType GetType ( void  )
static

Give the type of the object.

Returns
otDoc
int Compare ( const GDoc doc) const

Compare two documents by comparing their identifier.

See also
R::RContainer
Parameters
docDocument.
Returns
int
void ReleaseTree ( void  )

Release the tree.

void LoadTree ( GConceptTree *&  tree) const

Load the concept tree of the document.

Parameters
treeReference to a pointer to the tree. If null, the tree is created.
GConceptTree* GetTree ( void  ) const
Returns
the concept tree (and load it if necessary).
void LoadTree ( R::RContainer< GConceptRecord, false, true > &  records,
size_t &  nbrecords,
size_t &  nbtoprecords,
size_t &  nbrefs 
)

Load the tree as a container of records.

Parameters
recordsContainer of records (modified by the method).
nbrecordsNumber of records used for the document tree (modified by the method).
nbtoprecordsNumber of top records (modified by the method).
nbrefsNumber of concepts referenced (modified by the method).
R::RString GetTitle ( void  ) const

Get the Title.

Returns
the title.
GLang* GetLang ( void  ) const
Returns
Pointer to the Language.
R::RDate GetUpdated ( void  ) const

Get the date of the last update of the document content.

Returns
the date.
R::RDate GetComputed ( void  ) const

Get the date of the last analysis of the document.

Returns
the date.
R::RString GetMIMEType ( void  ) const

Get the MIME type of the document.

Returns
String.
void SetMIMEType ( const R::RString mime)

Set the MIME type of the document.

Parameters
mimeC String representing the MIME type.
R::RString GetDescription ( void  ) const

Get the description of the document.

Returns
String.
bool MustCompute ( void  ) const

Verify if the document must be (re-)computed.

R::RDate GetAttached ( void  ) const

Get the date of the last attachment.

Returns
the date.
size_t GetGroupId ( void  ) const

Get the topic holding the document.

void SetGroup ( size_t  groupid)

Set the topic holding the document.

Parameters
groupidIdentifier of the topic.
size_t GetStructId ( void  ) const

Get the identifier of the block containing the structure. If null, it means that the object is not defined.

Returns
Identifier of the block.
R::RNumCursor<size_t> GetFdbks ( void  ) const
Returns
a cursor on the identifier of the profiles which have assesses the document.
double GetAgreementRatio ( const GDoc doc,
size_t  nbmin 
) const

Compute the agreement ratio between two documents, i.e. the ratio between the number of profiles assessing them as relevant, and the total number of profiles assessing them.

Parameters
docSecond document.
nbminMinimum number of common profiles for a non null ratio.
double GetDisagreementRatio ( const GDoc doc,
size_t  nbmin 
) const

Compute the disagreement ratio between two documents, i.e. the ratio between the number of profiles assessing them one as relevant and the other one differently by the other one, and the total number of profiles assessing them.

Parameters
docSecond document.
nbminMinimum number of common profiles for a non null ratio.
size_t GetNbFdbks ( void  ) const

Get the number of times the documents was assessed.

void SetUpdated ( R::RDate date)

Set the date of the last update of the document content.

Parameters
docDocument updated.
dateDate of the update.
void Clear ( bool  disk)
private

Clear the concept tree and the vectors associated with the document.

Parameters
diskClear the reference to the corresponding block on disk.
void SetTree ( GConceptTree tree)
private

Associate a concept tree with a document.

The method is only called by GDocAnalyze to associate a tree to a document loaded into memory but not in the storage.

Parameters
treeTree to associate.
bool InsertFdbk ( size_t  profileid)
private

Add a profile to the list of those which have assess the document.

Parameters
profileidIdentifier of the profile.
Returns
true if it is a new feedback.
void DeleteFdbk ( size_t  profileid)
private

Delete a profile from the list of those which have assess the document.

Parameters
profileidIdentifier of the profile.
void ClearFdbks ( void  )
private

Clear all the assessments on the document.

void Update ( GLang lang,
GDescription desc,
R::RContainer< GConceptRecord, false, true > &  records,
size_t  nbrecords,
size_t  nbtoprecords,
size_t  nbrefs 
)

Update the representation of the document once a computation was done. The computed date and the status are updated.

If the document is an internal one, the following steps are done:

  1. An 'hDocs[oeAboutToUpdated]' notification is send.
  2. The references are updated.
  3. Existing in memory description and tree are replaced.
  4. If necessary, the document, its description and its tree are saved.
  5. An 'hDocs[oeUpdated]' notification is send.

If the document is an external one, its description and tree are replaced.

Parameters
langLanguage to assign.
descDescription to assign.
recordsContainer of records.
nbrecordsNumber of records used for the document tree.
nbtoprecordsNumber of top records.
nbrefsNumber of concepts referenced.
Warning
The description is cleared by this method. This method must be used with caution because it can corrupt the whole database.

Member Data Documentation

R::RString Title
private

Title of the document.

GLang* Lang
private

Language of the description.

R::RString MIMEType
private

MIME Type of the document.

R::RDate Updated
private

Date of last update of document content.

R::RDate Computed
private

Date of last document computation.

R::RNumContainer<size_t,true>* Fdbks
private

Identifiers of the profiles which have assessed the document.

size_t GroupId
private

Identifiers of the corresponding topic.

R::RDate Attached
private

Date of the attachment of the document into the topic.

size_t StructId
private

Block identifier of the struct.

GConceptTree* Tree
private

Tree representing the document.

R::RString Description
private

Description of the document.