Search Token. More...

#include <gsearchtoken.h>

Public Types

enum  tType { tTerm, tStem, tRawConcept }
 Search Token Type. More...
 

Public Member Functions

 GSearchToken (GConcept *concept, tType type)
 
 GSearchToken (GSession *session, const R::RString &token, tType type)
 
int Compare (const GSearchToken &token) const
 
int Compare (const R::RString &token) const
 
GConceptGetConcept (void) const
 
void SetConcept (GConcept *concept)
 
tType GetType (void) const
 

Private Attributes

GConceptConcept
 
tType Type
 

Detailed Description

Search Token.

The GSearchToken provides a representation for a search token (such as a keyword). In practice, a search token can correspond to multiple concepts in different languages (typically the stems in the case of a keyword).

Member Enumeration Documentation

enum tType

Search Token Type.

This enumeration represents the different type of search tokens recognised.

Enumerator
tTerm 
tStem 

The token is a term (for example: "connections"). The term is lowered.

tRawConcept 

The token is the stem of a term (for example "connect"). The stem is lowered. The token is a raw concept of a given concept type separated by a double point. If the concept type contains a double point, quotes must be used (for example: "http://purl.org/dc/elements/1.1":author).

Constructor & Destructor Documentation

GSearchToken ( GConcept concept,
tType  type 
)

Create a search token.

Parameters
conceptConcept.
typeType of the token.
GSearchToken ( GSession session,
const R::RString token,
tType  type 
)

Create a search token based on a string. The corresponding may be null if the token is not defined in the session.

Parameters
sessionSession for which the token must be created.
tokenToken.
typeType of the token.

Member Function Documentation

int Compare ( const GSearchToken token) const

Compare two tokens by their strings.

Parameters
tokenToken to compare with.
Returns
-1,0 or +1 depending of the comparison of the strings.
int Compare ( const R::RString token) const

Compare a token by a string.

Parameters
tokenString to compare with.
Returns
-1,0 or +1 depending of the comparison of the strings.
GConcept* GetConcept ( void  ) const

Get the concept corresponding to the token.

Returns
a pointer to a concept.
void SetConcept ( GConcept concept)

Set the concept corresponding to the token.

Parameters
conceptConcept to set.
tType GetType ( void  ) const

Get the type of the token.

Returns
the token type.

Member Data Documentation

GConcept* Concept
private

Concept associated to the search token.

tType Type
private

Type of the token.