GraphBuilder.h

00001 #ifndef REBECCA_GRAPHBUILDER_H
00002 #define REBECCA_GRAPHBUILDER_H
00003 
00004 /*
00005  * RebeccaAIML, Artificial Intelligence Markup Language 
00006  * C++ api and engine.
00007  *
00008  * Copyright (C) 2005,2006,2007 Frank Hassanabad
00009  *
00010  * This file is part of RebeccaAIML.
00011  *
00012  * RebeccaAIML is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 3 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * RebeccaAIML is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00024  */
00025 
00026 
00027 /* Disable Windows VC 7.x warning about 
00028  * it ignoring the throw specification
00029  */
00030 #ifdef _WIN32
00031 #    pragma warning ( push )
00032 #    pragma warning( disable : 4290 )
00033 #endif
00034 
00035 //Rebecca includes
00036 #include <rebecca/exports.h>
00037 #include <rebecca/StringPimpl.h>
00038 #include <rebecca/CallBacks.h>
00039 #include <rebecca/Exceptions.h>
00040 
00041 namespace rebecca 
00042 {
00043 namespace impl 
00044 {
00045 
00174 class REBECCA_EXPORT GraphBuilder
00175 {
00176     public:
00177 
00231         virtual void addFile(const StringPimpl &file) 
00232             throw(FileNotFoundException &, Exception &) = 0;        
00233 
00294         virtual void addFile(const StringPimpl &file,
00295                              const StringPimpl &userId,
00296                              const StringPimpl &botId,
00297                              const StringPimpl &endUserId) 
00298             throw(FileNotFoundException &, Exception &) = 0;        
00299 
00358         virtual void addFileUnlessAlreadyAdded(const StringPimpl &file) 
00359             throw(FileNotFoundException &, Exception &) = 0;        
00360 
00427         virtual void addFileUnlessAlreadyAdded(const StringPimpl &file,
00428                                                const StringPimpl &userId,
00429                                                const StringPimpl &botId,
00430                                                const StringPimpl &endUserId) 
00431             throw(FileNotFoundException &, Exception &) = 0;        
00432 
00481         virtual void removeFile(const StringPimpl &file) 
00482             throw(FileNotFoundException &, Exception &) = 0;        
00483 
00540         virtual void removeFile(const StringPimpl &file,
00541                                 const StringPimpl &userId,
00542                                 const StringPimpl &botId,
00543                                 const StringPimpl &endUserId) 
00544             throw(FileNotFoundException &, Exception &) = 0;        
00545 
00605         virtual void addDirectory(const StringPimpl &directory, 
00606                                   const StringPimpl &regularExpression = ".*\\.aiml") 
00607             throw(IllegalArgumentException &, DirectoryNotFoundException &, Exception &) = 0;
00608 
00677         virtual void addDirectory(const StringPimpl &directory, 
00678                                   const StringPimpl &userId, 
00679                                   const StringPimpl &botId,
00680                                   const StringPimpl &endUserId,
00681                                   const StringPimpl &regularExpression = ".*\\.aiml") 
00682             throw(IllegalArgumentException &, DirectoryNotFoundException &, Exception &) = 0;
00683 
00747         virtual void addDirectoryUnlessAlreadyAdded(const StringPimpl &directory, 
00748                                                     const StringPimpl &regularExpression = ".*\\.aiml") 
00749             throw(IllegalArgumentException &, DirectoryNotFoundException &, Exception &) = 0;
00750 
00823         virtual void addDirectoryUnlessAlreadyAdded(const StringPimpl &directory, 
00824                                                     const StringPimpl &userId, 
00825                                                     const StringPimpl &botId,
00826                                                     const StringPimpl &endUserId,
00827                                                     const StringPimpl &regularExpression = ".*\\.aiml") 
00828             throw(IllegalArgumentException &, DirectoryNotFoundException &, Exception &) = 0;
00829 
00884         virtual void removeDirectory(const StringPimpl &directory, 
00885                                      const StringPimpl &regularExpression = ".*\\.aiml") 
00886             throw(IllegalArgumentException &, DirectoryNotFoundException &, Exception &) = 0;
00887 
00950         virtual void removeDirectory(const StringPimpl &directory, 
00951                                      const StringPimpl &userId, 
00952                                      const StringPimpl &botId,
00953                                      const StringPimpl &endUserId,
00954                                      const StringPimpl &regularExpression = ".*\\.aiml") 
00955             throw(IllegalArgumentException &, DirectoryNotFoundException &, Exception &) = 0;
00956 
00957 
01013         virtual void addString(const StringPimpl &stringContainingAIML)
01014             throw(Exception &) = 0;
01015 
01079         virtual void addString(const StringPimpl &stringContainingAIML,
01080                                const StringPimpl &userId,
01081                                const StringPimpl &botId,
01082                                const StringPimpl &endUserId)
01083             throw(Exception &) = 0;
01084 
01142         virtual void removeString(const StringPimpl &stringContainingAIML)
01143             throw(Exception &) = 0;
01144 
01213         virtual void removeString(const StringPimpl &stringContainingAIML,
01214                                   const StringPimpl &userId,
01215                                   const StringPimpl &botId,
01216                                   const StringPimpl &endUserId)
01217             throw(Exception &) = 0;
01218 
01239         virtual void setAddStringAIMLHeader(const StringPimpl &aimlHeader)
01240             throw(Exception &) = 0;
01241 
01260         virtual void setAddStringAIMLFooter(const StringPimpl &aimlFooter)
01261             throw(Exception &) = 0;
01262 
01273         virtual void setAIMLSchema(const StringPimpl &schema) 
01274             throw(Exception &, FileNotFoundException &) = 0;
01275 
01289         virtual void setCommonTypesSchema(const StringPimpl &schema) 
01290             throw(Exception &, FileNotFoundException &) = 0;
01291 
01308         virtual void setAIMLValidation(bool trueOrFalse = true) 
01309             throw(Exception &) = 0;
01310         
01330         virtual StringPimpl getResponse(const StringPimpl &input) 
01331             throw(Exception &) = 0;
01332 
01360         virtual StringPimpl getResponse(const StringPimpl &input, 
01361                                         const StringPimpl &userId, 
01362                                         const StringPimpl &botId,
01363                                         const StringPimpl &endUserId) 
01364             throw(Exception &) = 0;
01365 
01382         virtual void setThat(const StringPimpl &that) 
01383             throw(Exception &) = 0;
01384 
01410         virtual void setThat(const StringPimpl &that,
01411                              const StringPimpl &userId,
01412                              const StringPimpl &botId,
01413                              const StringPimpl &endUserId) 
01414             throw(Exception &) = 0;
01415 
01432         virtual void setTopic(const StringPimpl &topic) 
01433             throw(Exception &) = 0;
01434 
01460         virtual void setTopic(const StringPimpl &topic,
01461                               const StringPimpl &userId,
01462                               const StringPimpl &botId,
01463                               const StringPimpl &endUserId) 
01464             throw(Exception &) = 0;
01465 
01480         virtual StringPimpl getThat() const
01481             throw(Exception &) = 0;
01482 
01506         virtual StringPimpl getThat(const StringPimpl &userId,
01507                                     const StringPimpl &botId,
01508                                     const StringPimpl &endUserId) const
01509             throw(Exception &) = 0;
01510 
01524         virtual StringPimpl getTopic() const
01525             throw(Exception &) = 0;
01526 
01550         virtual StringPimpl getTopic(const StringPimpl &userId,
01551                                      const StringPimpl &botId,
01552                                      const StringPimpl &endUserId) const
01553             throw(Exception &) = 0;
01554 
01577         virtual void createGraph() 
01578             throw(XMLErrorException &, Exception &) = 0;
01579 
01611         virtual void createGraph(const StringPimpl &userId,
01612                                  const StringPimpl &botId,
01613                                  const StringPimpl &endUserId) 
01614             throw(XMLErrorException &, Exception &) = 0;
01615 
01636         virtual void removeGraph() 
01637             throw(XMLErrorException &, Exception &) = 0;
01638 
01668         virtual void removeGraph(const StringPimpl &userId,
01669                                  const StringPimpl &botId,
01670                                  const StringPimpl &endUserId) 
01671             throw(XMLErrorException &, Exception &) = 0;
01672 
01693         virtual bool predicateMatch(const StringPimpl &predicateName, 
01694                                     const StringPimpl &aimlPattern) const
01695             throw(Exception &) = 0;
01696 
01723         virtual bool predicateMatch(const StringPimpl &predicateName, 
01724                                     const StringPimpl &aimlPattern,
01725                                     const StringPimpl &userId,
01726                                     const StringPimpl &botId,
01727                                     const StringPimpl &endUserId) const
01728             throw(Exception &) = 0;
01729 
01749         virtual void setPredicate(const StringPimpl &name, 
01750                                   const StringPimpl &value) 
01751             throw(Exception &) = 0;
01752 
01778         virtual void setPredicate(const StringPimpl &name, 
01779                                   const StringPimpl &value,
01780                                   const StringPimpl &userId,
01781                                   const StringPimpl &botId,
01782                                   const StringPimpl &endUserId) 
01783             throw(Exception &) = 0;
01784 
01803         virtual StringPimpl getPredicate(const StringPimpl &name) const
01804             throw(Exception &) = 0;
01805 
01830         virtual StringPimpl getPredicate(const StringPimpl &name,
01831                                          const StringPimpl &userId,
01832                                          const StringPimpl &botId,
01833                                          const StringPimpl &endUserId) const
01834             throw(Exception &) = 0;
01835 
01854         virtual StringPimpl getBotPredicate(const StringPimpl &name) const
01855             throw(Exception &)  = 0;
01856 
01881         virtual StringPimpl getBotPredicate(const StringPimpl &name,
01882                                             const StringPimpl &userId,
01883                                             const StringPimpl &botId,
01884                                             const StringPimpl &endUserId) const
01885             throw(Exception &)  = 0;
01886 
01904         virtual void setBotPredicate(const StringPimpl &name,
01905                                      const StringPimpl &value) 
01906             throw(Exception &) = 0;
01907 
01931         virtual void setBotPredicate(const StringPimpl &name, 
01932                                      const StringPimpl &value,
01933                                      const StringPimpl &userId,
01934                                      const StringPimpl &botId,
01935                                      const StringPimpl &endUserId)
01936             throw(Exception &) = 0;
01937 
01957         virtual StringPimpl getPreviousBotResponse(const unsigned int &previousBotResponse, 
01958                                                    const unsigned int &sentence) const
01959             throw(IllegalArgumentException &, Exception &) = 0;
01960 
01986         virtual StringPimpl getPreviousBotResponse(const unsigned int &previousBotResponse, 
01987                                                    const unsigned int &sentence,
01988                                                    const StringPimpl &userId,
01989                                                    const StringPimpl &botId,
01990                                                    const StringPimpl &endUserId) const
01991             throw(IllegalArgumentException &, Exception &) = 0;
01992 
02012         virtual StringPimpl getPreviousUserInput(const unsigned int &previousUserInput, 
02013                                                  const unsigned int &sentence) const
02014             throw(IllegalArgumentException &, Exception &) = 0;
02015 
02041         virtual StringPimpl getPreviousUserInput(const unsigned int &previousUserInput, 
02042                                                  const unsigned int &sentence,
02043                                                  const StringPimpl &userId,
02044                                                  const StringPimpl &botId,
02045                                                  const StringPimpl &endUserId) const
02046             throw(IllegalArgumentException &, Exception &) = 0;
02047 
02071         virtual void setBotConfigurationSchema(const StringPimpl &schema) 
02072             throw(Exception &, FileNotFoundException &) = 0;
02073 
02092         virtual void setBotConfigurationValidation(const bool trueOrFalse = true) 
02093             throw(Exception &) = 0;
02094 
02125         virtual void parseSubstitutionFile(const StringPimpl &fileName) 
02126             throw(XMLErrorException &, FileNotFoundException &, Exception &) = 0;
02127 
02156         virtual void parseSentenceSplitterFile(const StringPimpl &fileName) 
02157             throw(XMLErrorException &, FileNotFoundException &, Exception &) = 0;
02158 
02183         virtual void parsePropertiesFile(const StringPimpl &fileName)
02184             throw(XMLErrorException &, FileNotFoundException &, Exception &) = 0;
02185 
02217         virtual void parsePropertiesFile(const StringPimpl &fileName,
02218                                          const StringPimpl &userId,
02219                                          const StringPimpl &botId,
02220                                          const StringPimpl &endUserId)
02221             throw(XMLErrorException &, FileNotFoundException &, Exception &) = 0;
02222 
02241         virtual void setSentenceSplitter(const StringPimpl &splitter) 
02242             throw(Exception &) = 0;
02243 
02286         virtual void setInputSubstitution(const StringPimpl &find, 
02287                                           const StringPimpl &replace) 
02288             throw(IllegalArgumentException &, Exception &) = 0;
02289 
02329         virtual void setGenderSubstitution(const StringPimpl &find, 
02330                                            const StringPimpl &replace) 
02331             throw(IllegalArgumentException &, Exception &) = 0;
02332 
02377         virtual void setPersonSubstitution(const StringPimpl &find, 
02378                                            const StringPimpl &replace) 
02379             throw(IllegalArgumentException &, Exception &) = 0;
02380 
02425         virtual void setPerson2Substitution(const StringPimpl &find, 
02426                                             const StringPimpl &replace) 
02427             throw(IllegalArgumentException &, Exception &)  = 0;
02428         
02438         virtual StringPimpl getVersion() const 
02439             throw(Exception &) = 0;
02440         
02448         virtual int getSize() const 
02449             throw(Exception &) = 0;
02450 
02466         virtual int getSize(const StringPimpl &userId, 
02467                             const StringPimpl &botId, 
02468                             const StringPimpl &endUserId) const 
02469             throw(Exception &) = 0;
02470 
02489         virtual void setCallBacks(CallBacks *callBacks) 
02490             throw(Exception &) = 0;
02491 
02505         virtual void storeGossip(const StringPimpl &gossip) 
02506             throw(Exception &) = 0;
02507         
02518         virtual StringPimpl getId() const
02519             throw(Exception &) = 0;
02520 
02541         virtual void setUserIdBotIdEndUserId(const StringPimpl &userId, 
02542                                              const StringPimpl &botId,
02543                                              const StringPimpl &endUserId)
02544             throw(Exception &) = 0;
02545 
02570         virtual void addCustomTagLibrary(const StringPimpl &library)
02571             throw(FileNotFoundException &, Exception &) = 0;
02572 
02597         virtual void removeCustomTagLibrary(const StringPimpl &library)
02598             throw(FileNotFoundException &, Exception &) = 0;
02599         
02623         virtual StringPimpl callSystemCommand(const StringPimpl &command) const
02624             throw(Exception &) = 0;
02625 
02627         //found it will create it.  If this is not used and the directory is not 
02628         //set it will default to %HOMEPATH%/.RebeccaAIMLDB under windows and under 
02629         //Unix it will deafult to $HOME/.RebeccaAIMLDB.  Typically you set this 
02630         //method on constructor of GraphBuilderAIML.  Set this before you call 
02631         //your first createGraph().  Otherwise this method will throw an exception and 
02632         //the setting will be ignored.
02634         //virtual void setDBEnvironmentDirectory(const StringPimpl &directory)
02635         //  throw(Exception &) = 0;
02636 
02650         virtual void synchronizeDatabase() const
02651             throw(Exception &) = 0;
02652 
02674         virtual StringPimpl *getAIMLFileList(unsigned int &size) const
02675             throw(Exception &) = 0;
02676             
02705         virtual StringPimpl *getAIMLFileList(const StringPimpl &userId, 
02706                                              const StringPimpl &botId, 
02707                                              const StringPimpl &endUserId,
02708                                              unsigned int &size) const
02709             throw(Exception &) = 0;
02710 
02725         virtual void deleteStringPimplArray(StringPimpl *arrayToDelete) const
02726             throw(Exception &) = 0;
02727 
02742         virtual unsigned int getAIMLFileListSize() const
02743             throw(Exception &) = 0;
02744 
02766         virtual unsigned int getAIMLFileListSize(const StringPimpl &userId, 
02767                                                  const StringPimpl &botId, 
02768                                                  const StringPimpl &endUserId) const
02769             throw(Exception &) = 0;
02770 
02792         virtual StringPimpl *getAIMLStringList(unsigned int &size) const
02793             throw(Exception &) = 0;
02794 
02823         virtual StringPimpl *getAIMLStringList(const StringPimpl &userId, 
02824                                                const StringPimpl &botId, 
02825                                                const StringPimpl &endUserId,
02826                                                unsigned int &size) const
02827             throw(Exception &) = 0;
02828 
02843         virtual unsigned int getAIMLStringListSize() const
02844             throw(Exception &) = 0;
02845 
02867         virtual unsigned int getAIMLStringListSize(const StringPimpl &userId, 
02868                                                    const StringPimpl &botId, 
02869                                                    const StringPimpl &endUserId) const
02870             throw(Exception &) = 0;
02871 
02892         virtual StringPimpl *getUserIds(unsigned int &size) const
02893             throw(Exception &) = 0;
02894 
02908         virtual unsigned int getUserIdsSize() const
02909             throw(Exception &) = 0;
02910 
02933         virtual StringPimpl *getBotIds(const StringPimpl &userId, 
02934                                        unsigned int &size) const
02935             throw(Exception &) = 0;
02936 
02951         virtual unsigned int getBotIdsSize(const StringPimpl &userId) const
02952             throw(Exception &) = 0;
02953 
02979         virtual StringPimpl *getEndUserIds(const StringPimpl &userId, 
02980                                            const StringPimpl &botId,
02981                                            unsigned int &size) const
02982             throw(Exception &) = 0;
02983 
03002         virtual unsigned int getEndUserIdsSize(const StringPimpl &userId,
03003                                                const StringPimpl &botId) const
03004             throw(Exception &) = 0;
03005 
03013         virtual void printEntireDatabase() const
03014             throw(Exception &) = 0;
03015 
03016 
03038         virtual StringPimpl *getBotPredicates(unsigned int &size) const
03039             throw(Exception &) = 0;
03040 
03069         virtual StringPimpl *getBotPredicates(const StringPimpl &userId, 
03070                                               const StringPimpl &botId, 
03071                                               const StringPimpl &endUserId, 
03072                                               unsigned int &size) const
03073             throw(Exception &) = 0;
03074             
03096         virtual StringPimpl *getPredicates(unsigned int &size) const
03097             throw(Exception &) = 0;
03098 
03126         virtual StringPimpl *getPredicates(const StringPimpl &userId, 
03127                                            const StringPimpl &botId, 
03128                                            const StringPimpl &endUserId, 
03129                                            unsigned int &size) const
03130             throw(Exception &) = 0;
03131 
03132 
03143         virtual unsigned int getPredicatesSize() const
03144             throw(Exception &) = 0;
03145 
03162         virtual unsigned int getPredicatesSize(const StringPimpl &userId, 
03163                                                const StringPimpl &botId, 
03164                                                const StringPimpl &endUserId) const
03165             throw(Exception &) = 0;
03166 
03177         virtual unsigned int getBotPredicatesSize() const
03178             throw(Exception &) = 0;
03179             
03197         virtual unsigned int getBotPredicatesSize(const StringPimpl &userId, 
03198                                                   const StringPimpl &botId, 
03199                                                   const StringPimpl &endUserId) const
03200             throw(Exception &) = 0;
03201 
03212         virtual void removePredicate(const StringPimpl &name)
03213             throw(Exception &) = 0;
03214 
03232         virtual void removePredicate(const StringPimpl &name, 
03233                                      const StringPimpl &userId,
03234                                      const StringPimpl &botId,
03235                                      const StringPimpl &endUserId)
03236             throw(Exception &) = 0;
03237 
03248         virtual void removeBotPredicate(const StringPimpl &name)
03249             throw(Exception &) = 0;
03250 
03268         virtual void removeBotPredicate(const StringPimpl &name, 
03269                                         const StringPimpl &userId,
03270                                         const StringPimpl &botId,
03271                                         const StringPimpl &endUserId)
03272             throw(Exception &) = 0;
03273 
03290         virtual void removeEndUser(const StringPimpl &userId,
03291                                    const StringPimpl &botId,
03292                                    const StringPimpl &endUserId)
03293             throw(Exception &) = 0;
03294 
03312         virtual void removeBot(const StringPimpl &userId,
03313                                const StringPimpl &botId)
03314             throw(Exception &) = 0;
03315 
03332         virtual void removeUser(const StringPimpl &userId)
03333             throw(Exception &) = 0;
03334         
03365         virtual void setThreadSpecificIds(bool trueOrFalse)
03366             throw(Exception &) = 0;
03367 
03371         virtual ~GraphBuilder() { };
03372 };
03373 
03374 } //end of namespace impl
03375 
03376 //Expose GraphBuilder to rebecca namespace
03377 using rebecca::impl::GraphBuilder;
03378 
03379 } //end of namespace rebecca
03380 
03381 
03382 #ifdef _WIN32
03383 #    pragma warning ( pop )
03384 #endif
03385 
03386 
03387 
03388 
03389 #endif

Generated on Mon Aug 27 12:26:52 2007 for RebeccaAIML by  doxygen 1.5.3