Knowledge Base. More...
#include <gkb.h>
Public Member Functions | |
virtual | ~GKB (void)=0 |
General Methods | |
General methods. | |
tObjState | GetState (void) const |
GStorage * | GetStorage (void) const |
Convenient Methods | |
GConceptType * | GetTokenType (void) const |
GConceptType * | GetDCMIType (void) const |
GConceptType * | GetURIType (void) const |
GConceptType * | GetNamedEntityType (void) const |
GConceptType * | GetTaxonomyType (void) const |
GConcept * | GetContent (void) const |
GConcept * | GetUnknown (void) const |
GConcept * | GetURI (void) const |
GConcept * | GetNamedEntity (void) const |
GConcept * | GetIsA (void) const |
GConcept * | GetSynonym (void) const |
GConcept * | GetPartOf (void) const |
Concept Type Methods | |
Methods related to the management of concept types. | |
size_t | GetNbObjs (const GConceptType *obj) const |
size_t | GetMaxObjId (const GConceptType *obj) const |
GConceptType * | GetObj (const GConceptType *obj, char id, bool null) |
GConceptType * | GetObj (const GConceptType *obj, const R::RString &name, bool null) |
R::RCursor< GConceptType > | GetObjs (const GConceptType *obj) const |
GConceptType * | InsertObj (const GConceptType *obj, tConceptCat cat, size_t id, const R::RString &name, const R::RString &desc, bool &newone) |
GConceptType * | InsertObj (const GConceptType *obj, tConceptCat cat, size_t id, const R::RString &name, const R::RString &desc) |
GConceptType * | InsertObj (const GConceptType *obj, tConceptCat cat, const R::RString &name, const R::RString &desc, bool &newone) |
GConceptType * | InsertObj (const GConceptType *obj, tConceptCat cat, const R::RString &name, const R::RString &desc) |
Concept Methods | |
Methods related to the management of concepts. | |
size_t | GetNbObjs (const GConcept *obj) const |
size_t | GetMaxObjId (const GConcept *obj) const |
R::RCursor< GConcept > | GetObjs (const GConcept *obj) const |
GConcept * | GetObj (const GConcept *obj, size_t id) |
GConcept * | GetObj (const GConcept *obj, GConceptType *type, const R::RString &concept, bool null=false) |
GConcept * | InsertObj (const GConcept *obj, GConceptType *type, const R::RString &concept, bool &newone) |
GConcept * | InsertObj (const GConcept *obj, GConceptType *type, const R::RString &concept) |
GConcept * | InsertObj (const GConcept &concept, bool &newone) |
GConcept * | InsertObj (const GConcept &concept) |
GConcept * | RenameObj (GConcept *concept, const R::RString &name) |
void | DeleteObj (GConcept *concept) |
Statement Methods | |
Methods related to the management of statements. | |
GStatement * | GetObj (const GStatement *obj, size_t id, bool null=false) |
GStatement * | GetObj (const GStatement *obj, GObject *subject, GObject *predicate, GObject *value, bool null=false) |
GStatement * | InsertObj (const GStatement *obj, size_t id, GObject *subject, GObject *predicate, GObject *value, double weight, bool &newone) |
GStatement * | InsertObj (const GStatement *obj, size_t id, GObject *subject, GObject *predicate, GObject *value, double weight) |
Protected Member Functions | |
GKB (GSession *session) | |
void | ClearIndex (tObjType type) |
Protected Attributes | |
GSession * | Session |
tObjState | State |
GStorage * | Storage |
bool | SaveResults |
GConceptType * | TokenType |
GConceptType * | DCMIType |
GConceptType * | NamedEntityType |
GConceptType * | URIType |
GConceptType * | TaxonomyType |
GConcept * | Content |
GConcept * | NamedEntity |
GConcept * | URI |
GConcept * | IsA |
GConcept * | Synonym |
GConcept * | PartOf |
GConcept * | Unknown |
R::RObjectContainer < GConceptType, true > | ConceptTypes |
R::RObjectHashContainer < GConcept, true > | Concepts |
R::RContainer< GStatement, true, false > | StatementsByIds |
Detailed Description
Knowledge Base.
The GKB represents the knowledge base. It is the basic building block for a session. In fact, all the methods defined here can only be called through a session instance.
It maintains:
- A list of concept types (GConceptType).
- A list of concepts (GConcept).
- A list of statements that are stored (GStatement).
- Warning
- Some methods use a reinterpret_cast<GSession*>(this) expression.
Constructor & Destructor Documentation
|
pure virtual |
Destruct the session.
Member Function Documentation
tObjState GetState | ( | void | ) | const |
The knowlegde base may be in two states only :
- osOnDemand if some information is loaded from the disk.
- osLatest if the latest information was loaded to the disk.
When the knowledge base is in the osOnDemand state, it is not necessary to save something to the disk since an information is currently be loaded.
- Returns
- the state.
GStorage* GetStorage | ( | void | ) | const |
- Returns
- Pointer to storage manager.
GConceptType* GetTokenType | ( | void | ) | const |
Get the default concept type representing tokens.
- Returns
- a concept type.
GConceptType* GetDCMIType | ( | void | ) | const |
Get the default concept type representing the DMCI.
- Returns
- a concept type.
GConceptType* GetURIType | ( | void | ) | const |
Get the default type for URI.
- Returns
- a concept type.
GConceptType* GetNamedEntityType | ( | void | ) | const |
Get the default type for named entities.
- Returns
- a concept type.
GConceptType* GetTaxonomyType | ( | void | ) | const |
Get the default concept type that represents relations of taxonomies.
- Returns
- a concept type.
GConcept* GetContent | ( | void | ) | const |
Get the default meta-concept representing the default content.
- Returns
- a concept.
GConcept* GetUnknown | ( | void | ) | const |
Get the default "unknown" concept. This concept can be useful when, for example, a query is formulated with terms that don't exist in the dictionaries (i.e. no document contains them). This terms can then be assimilated to a "unknown" concept.
- Remarks
- The "Unknown" concept is associated to the default "text" type.
- Returns
- a concept.
GConcept* GetURI | ( | void | ) | const |
Get the meta-concept representing the default URI content.
- Returns
- a concept.
GConcept* GetNamedEntity | ( | void | ) | const |
Get the meta-concept representing the default named entities.
- Returns
- a concept.
GConcept* GetIsA | ( | void | ) | const |
Get the default concept that represents a "IsA" relation.
- Returns
- a concept.
GConcept* GetSynonym | ( | void | ) | const |
Get the default concept that represents a "synonym" relation.
- Returns
- a concept.
GConcept* GetPartOf | ( | void | ) | const |
Get the default concept that represents a "part of" relation.
- Returns
- a concept.
|
protected |
Clear the block index of all the concepts for a given object type.
- Parameters
-
type Object type.
size_t GetNbObjs | ( | const GConceptType * | obj | ) | const |
Get the number of concept types.
- Parameters
-
obj Pseudo-parameter.
size_t GetMaxObjId | ( | const GConceptType * | obj | ) | const |
Get the highest identifier of the concept types.
- Parameters
-
obj Pseudo-parameter.
GConceptType* GetObj | ( | const GConceptType * | obj, |
char | id, | ||
bool | null | ||
) |
Get the a pointer to a type of concept.
- Parameters
-
obj Pseudo-parameter. id Identifier of the type. null If set to true, if the type does not exist, return 0, else an exception is generated.
- Returns
- Pointer to a GConceptType.
GConceptType* GetObj | ( | const GConceptType * | obj, |
const R::RString & | name, | ||
bool | null | ||
) |
Get the a pointer to a type of concept.
- Parameters
-
obj Pseudo-parameter. name Name of the type. null If set to true, if the type does not exist, return 0, else an exception is generated.
- Returns
- Pointer to a GConceptType.
R::RCursor<GConceptType> GetObjs | ( | const GConceptType * | obj | ) | const |
GConceptType* InsertObj | ( | const GConceptType * | obj, |
tConceptCat | cat, | ||
size_t | id, | ||
const R::RString & | name, | ||
const R::RString & | desc, | ||
bool & | newone | ||
) |
Create a new concept type. If the concept type exists, nothing is done.
- Parameters
-
obj Pseudo-parameter. cat Concept category. id Identifier of the type (if cNoRef, an identifier is assigned). name Name of the type. desc Short description newone Is the concept type a new one (set by the method).
- Returns
- Pointer to a GConceptType.
GConceptType* InsertObj | ( | const GConceptType * | obj, |
tConceptCat | cat, | ||
size_t | id, | ||
const R::RString & | name, | ||
const R::RString & | desc | ||
) |
Create a new concept type. If the concept type exists, nothing is done.
- Parameters
-
obj Pseudo-parameter. cat Concept category. id Identifier of the type (if cNoRef, an identifier is assigned). name Name of the type. desc Short description
- Returns
- Pointer to a GConceptType.
GConceptType* InsertObj | ( | const GConceptType * | obj, |
tConceptCat | cat, | ||
const R::RString & | name, | ||
const R::RString & | desc, | ||
bool & | newone | ||
) |
Create a new concept type. If the concept type exists, nothing is done.
- Parameters
-
obj Pseudo-parameter. cat Concept category. name Name of the type. desc Short description newone Is the concept type a new one (set by the method).
- Returns
- Pointer to a GConceptType.
GConceptType* InsertObj | ( | const GConceptType * | obj, |
tConceptCat | cat, | ||
const R::RString & | name, | ||
const R::RString & | desc | ||
) |
Create a new concept type. If the concept type exists, nothing is done.
- Parameters
-
obj Pseudo-parameter. cat Concept category. id Identifier of the type (if cNoRef, an identifier is assigned). name Name of the type. desc Short description
- Returns
- Pointer to a GConceptType.
size_t GetNbObjs | ( | const GConcept * | obj | ) | const |
Get the number of concepts.
- Parameters
-
obj Pseudo-parameter.
size_t GetMaxObjId | ( | const GConcept * | obj | ) | const |
Get the highest identifier of the concepts.
- Parameters
-
obj Pseudo-parameter.
R::RCursor<GConcept> GetObjs | ( | const GConcept * | obj | ) | const |
Get the concept with a specific identifier.
- Parameters
-
id Identifier.
- Returns
- a pointer to a GConcept.
GConcept* GetObj | ( | const GConcept * | obj, |
GConceptType * | type, | ||
const R::RString & | concept, | ||
bool | null = false |
||
) |
Get a pointer to a concept.
- Parameters
-
obj Pseudo-parameter. type Type of the concept. concept Name of the concept to insert. null If set to true, if the object does not exist, return 0, else an exception is generated.
GConcept* InsertObj | ( | const GConcept * | obj, |
GConceptType * | type, | ||
const R::RString & | concept, | ||
bool & | newone | ||
) |
Insert a concept of a given type and name. If the concept already exists, nothing is done.
- Parameters
-
obj Pseudo-parameter. type Type of the concept. concept Name of the concept to insert. newone Is the concept type a new one (set by the method).
- Returns
- a pointer to the concept is the dictionary.
GConcept* InsertObj | ( | const GConcept * | obj, |
GConceptType * | type, | ||
const R::RString & | concept | ||
) |
Insert a concept of a given type and name. If the concept already exists, nothing is done.
- Parameters
-
obj Pseudo-parameter. type Type of the concept. concept Name of the concept to insert.
- Returns
- a pointer to the concept is the dictionary.
Insert a concept that is exactly the same as a model. If the concept exist, nothing is done.
- Parameters
-
concept Model Concept. newone Is the concept type a new one (set by the method).
- Returns
- a pointer to the concept is the dictionary.
Insert a concept that is exactly the same as a model. If the concept exist, nothing is done.
- Parameters
-
concept Model Concept.
- Returns
- a pointer to the concept is the dictionary.
GConcept* RenameObj | ( | GConcept * | concept, |
const R::RString & | name | ||
) |
Rename a concept.
- Parameters
-
concept Concept to rename. name New name.
- Returns
- a pointer to the correct concept (may be an existing one).
void DeleteObj | ( | GConcept * | concept | ) |
Delete a given concept from the dictionary.
- Parameters
-
concept Concept to delete.
GStatement* GetObj | ( | const GStatement * | obj, |
size_t | id, | ||
bool | null = false |
||
) |
Get a statement.
- Parameters
-
obj Pseudo-parameter. id Identifier of the statement. null Can a null pointer be returned or an exception must be generated.
- Returns
- Pointer to a statement.
GStatement* GetObj | ( | const GStatement * | obj, |
GObject * | subject, | ||
GObject * | predicate, | ||
GObject * | value, | ||
bool | null = false |
||
) |
Get a statement.
- Parameters
-
obj Pseudo-parameter. subject Subject. predicate Predicate. value Value. null Can a null pointer be returned or an exception must be generated.
- Returns
- a pointer to the newly statement created or the existing one.
GStatement* InsertObj | ( | const GStatement * | obj, |
size_t | id, | ||
GObject * | subject, | ||
GObject * | predicate, | ||
GObject * | value, | ||
double | weight, | ||
bool & | newone | ||
) |
Insert a new statement. If it exists, it is not re-created but its weight is updated.
- Parameters
-
obj Pseudo-parameter. id Identifier of the statement. If cNoRef, an identifier is assigned. subject Subject. predicate Predicate. value Value. weight Weight of the statement. newone Is the concept type a new one (set by the method).
- Returns
- a pointer to the newly statement created or the existing one.
GStatement* InsertObj | ( | const GStatement * | obj, |
size_t | id, | ||
GObject * | subject, | ||
GObject * | predicate, | ||
GObject * | value, | ||
double | weight | ||
) |
Insert a new statement. If it exists, it is not re-created but its weight is updated.
- Parameters
-
obj Pseudo-parameter. id Identifier of the statement. If cNoRef, an identifier is assigned. subject Subject. predicate Predicate. value Value. weight Weight of the statement.
- Returns
- a pointer to the newly statement created or the existing one.
Member Data Documentation
|
protected |
Session.
|
protected |
State of the knowledge base.
|
protected |
Storage manager.
|
protected |
Must the results be saved after computed ?
|
protected |
Default type for tokens.
|
protected |
Default type for the Dublin Core Metadata Initiative.
|
protected |
Default type for named entities.
|
protected |
Default type for URI.
|
protected |
Concept type that represents relations of taxonomies.
|
protected |
Meta-concept representing the content of a document.
|
protected |
Concepts related to named entities.
|
protected |
Concepts related to the default URI content.
|
protected |
Concept that represents a "IsA" relation.
|
protected |
Concept that represents a "synonym" relation.
|
protected |
Concept that represents a "part of" relation.
|
protected |
"Unknown" concept.
|
protected |
Types of Concepts.
|
protected |
Concepts.
|
protected |
Statements (accessed by identifier).