OpenTREP Logo  0.6.0
C++ Open Travel Request Parsing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OPENTREP::OPENTREP_Service Class Reference

Interface for the OPENTREP Services. More...

#include <opentrep/OPENTREP_Service.hpp>

Public Types

typedef std::pair< const
TravelDBFilePath_T, const
SQLiteDBFilePath_T
DBFilePathPair_T
 
typedef std::pair< const
PORFilePath_T, const
DBFilePathPair_T
FilePathSet_T
 

Public Member Functions

NbOfDBEntries_T getIndexSize ()
 
NbOfMatches_T drawRandomLocations (const NbOfMatches_T &iNbOfDraws, LocationList_T &)
 
NbOfDBEntries_T buildSQLDB ()
 
NbOfDBEntries_T buildSearchIndex ()
 
NbOfMatches_T interpretTravelRequest (const std::string &iTravelQuery, LocationList_T &, WordList_T &)
 
FilePathSet_T getFilePaths () const
 
 OPENTREP_Service (std::ostream &ioLogStream, const TravelDBFilePath_T &, const SQLiteDBFilePath_T &)
 
 OPENTREP_Service (std::ostream &ioLogStream, const PORFilePath_T &, const TravelDBFilePath_T &, const SQLiteDBFilePath_T &)
 
 ~OPENTREP_Service ()
 

Detailed Description

Interface for the OPENTREP Services.

Definition at line 24 of file OPENTREP_Service.hpp.

Member Typedef Documentation

Get the file-paths of the Xapian database/index and of the ORI-maintained POR (points of reference).

Returns
std::pair<const PORFilePath_T, File-path of the file of POR (points of reference). std::pair<const TravelDBFilePath_T, File-path of the Xapian database. const SQLiteDBFilePath_T> > File-path of the SQLite3 database.

Definition at line 90 of file OPENTREP_Service.hpp.

Definition at line 91 of file OPENTREP_Service.hpp.

Constructor & Destructor Documentation

OPENTREP::OPENTREP_Service::OPENTREP_Service ( std::ostream &  ioLogStream,
const TravelDBFilePath_T iTravelDBFilePath,
const SQLiteDBFilePath_T iSQLiteDBFilePath 
)

Constructor.

Parameters
std::ostream&Output log stream (for instance, std::cout).
constTravelDBFilePath_T& File-path of the Xapian index/database.
constSQLiteDBFilePath_T& File-path of the SQLite3 database.

Definition at line 37 of file OPENTREP_Service.cpp.

OPENTREP::OPENTREP_Service::OPENTREP_Service ( std::ostream &  ioLogStream,
const PORFilePath_T iPORFilepath,
const TravelDBFilePath_T iTravelDBFilePath,
const SQLiteDBFilePath_T iSQLiteDBFilePath 
)

Constructor.

Parameters
std::ostream&Output log stream (for instance, std::cout).
constPORFilePath_T& File-path of the file of POR (points of reference).
constTravelDBFilePath_T& File-path of the Xapian index/database.
constSQLiteDBFilePath_T& File-path of the SQLite3 database.

Definition at line 28 of file OPENTREP_Service.cpp.

OPENTREP::OPENTREP_Service::~OPENTREP_Service ( )

Destructor.

Definition at line 55 of file OPENTREP_Service.cpp.

Member Function Documentation

NbOfDBEntries_T OPENTREP::OPENTREP_Service::getIndexSize ( )

Get the number of documents within the Xapian database (index).

Returns
NbOfDBEntries_T Number of documents within the Xapian database.

Definition at line 132 of file OPENTREP_Service.cpp.

References OPENTREP::OPENTREP_ServiceContext::display(), OPENTREP::BasChronometer::elapsed(), OPENTREP::OPENTREP_ServiceContext::getTravelDBFilePath(), OPENTREP_LOG_DEBUG, and OPENTREP::BasChronometer::start().

NbOfMatches_T OPENTREP::OPENTREP_Service::drawRandomLocations ( const NbOfMatches_T iNbOfDraws,
LocationList_T ioLocationList 
)

Return a given number of locations, all randomly draw from the Xapian database (index).

Parameters
LocationList_T&List of (geographical) locations randomly picked up from the Xapian database.
Returns
NbOfMatches_T Number of documents actually retrieved from the Xapian database/index.

Definition at line 161 of file OPENTREP_Service.cpp.

References OPENTREP::OPENTREP_ServiceContext::display(), OPENTREP::BasChronometer::elapsed(), OPENTREP::OPENTREP_ServiceContext::getTravelDBFilePath(), OPENTREP_LOG_DEBUG, and OPENTREP::BasChronometer::start().

NbOfDBEntries_T OPENTREP::OPENTREP_Service::buildSQLDB ( )

Build the SQL database from the file with the ORI-maintained list of POR (points of reference).

Returns
NbOfDBEntries_T Number of documents inserted in the SQLite3 DB.

Definition at line 192 of file OPENTREP_Service.cpp.

References OPENTREP::DBManager::buildSQLDB(), OPENTREP::OPENTREP_ServiceContext::display(), OPENTREP::BasChronometer::elapsed(), OPENTREP::OPENTREP_ServiceContext::getPORFilePath(), OPENTREP::OPENTREP_ServiceContext::getSQLiteDBFilePath(), OPENTREP_LOG_DEBUG, and OPENTREP::BasChronometer::start().

Referenced by main().

NbOfDBEntries_T OPENTREP::OPENTREP_Service::buildSearchIndex ( )

Build the Xapian database (index) from the file with the ORI-maintained list of POR (points of reference).

Returns
NbOfDBEntries_T Number of documents indexed by the Xapian database/index.

Definition at line 223 of file OPENTREP_Service.cpp.

References OPENTREP::OPENTREP_ServiceContext::display(), OPENTREP::BasChronometer::elapsed(), OPENTREP::OPENTREP_ServiceContext::getPORFilePath(), OPENTREP::OPENTREP_ServiceContext::getTransliterator(), OPENTREP::OPENTREP_ServiceContext::getTravelDBFilePath(), OPENTREP_LOG_DEBUG, and OPENTREP::BasChronometer::start().

Referenced by main().

NbOfMatches_T OPENTREP::OPENTREP_Service::interpretTravelRequest ( const std::string &  iTravelQuery,
LocationList_T ioLocationList,
WordList_T ioWordList 
)

Match the given string, thanks to a full-text search on the underlying Xapian index (named "database").

Parameters
conststd::string& (Travel-related) query string (e.g., "sna francicso rio de janero lso angles reykyavki nce iev mow").
LocationList_T&List of (geographical) locations, if any, matching the given query string.
WordList_T&List of non-matched words of the query string.
Returns
NbOfMatches_T Number of matches.

Definition at line 263 of file OPENTREP_Service.cpp.

References OPENTREP::OPENTREP_ServiceContext::display(), OPENTREP::BasChronometer::elapsed(), OPENTREP::OPENTREP_ServiceContext::getTravelDBFilePath(), OPENTREP_LOG_DEBUG, OPENTREP_LOG_ERROR, and OPENTREP::BasChronometer::start().

Referenced by parseQuery().


The documentation for this class was generated from the following files: