00001 /*!@file Learn/test-SWIProlog.C test the SWI Prolog class 00002 */ 00003 00004 // //////////////////////////////////////////////////////////////////// // 00005 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the // 00006 // University of Southern California (USC) and the iLab at USC. // 00007 // See http://iLab.usc.edu for information about this project. // 00008 // //////////////////////////////////////////////////////////////////// // 00009 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00010 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00011 // in Visual Environments, and Applications'' by Christof Koch and // 00012 // Laurent Itti, California Institute of Technology, 2001 (patent // 00013 // pending; application number 09/912,225 filed July 23, 2001; see // 00014 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00015 // //////////////////////////////////////////////////////////////////// // 00016 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00017 // // 00018 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00019 // redistribute it and/or modify it under the terms of the GNU General // 00020 // Public License as published by the Free Software Foundation; either // 00021 // version 2 of the License, or (at your option) any later version. // 00022 // // 00023 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00024 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00025 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00026 // PURPOSE. See the GNU General Public License for more details. // 00027 // // 00028 // You should have received a copy of the GNU General Public License // 00029 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00030 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00031 // Boston, MA 02111-1307 USA. // 00032 // //////////////////////////////////////////////////////////////////// // 00033 // 00034 // Primary maintainer for this file: Lior Elazary <elazary@usc.edu> 00035 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Learn/test-SWIProlog.C $ 00036 // $Id: test-SWIProlog.C 9308 2008-02-22 19:04:41Z rjpeters $ 00037 // 00038 00039 #include "Component/ModelManager.H" 00040 #include "Image/Image.H" 00041 #include "Learn/SWIProlog.H" 00042 00043 int main(int argc, char **argv) 00044 { 00045 00046 SWIProlog pl(argc, argv); 00047 00048 const char *kbFilename = "src/Learn/testKB"; 00049 00050 if (!pl.consult(kbFilename)) 00051 { 00052 LINFO("Can not consult the %s file", kbFilename); 00053 } 00054 00055 //is mia a woman? 00056 { 00057 const char *predicate = "woman"; 00058 std::vector<std::string> args; 00059 args.push_back(std::string("mia")); 00060 bool val = pl.query(predicate, args); 00061 LINFO("Is mia a woman? %i", val); 00062 } 00063 00064 //is jody a woman? 00065 { 00066 const char *predicate = "woman"; 00067 std::vector<std::string> args; 00068 args.push_back(std::string("jody")); 00069 bool val = pl.query(predicate, args); 00070 LINFO("Is jody a woman? %i", val); 00071 } 00072 00073 //Who is a woman? 00074 { 00075 const char *predicate = "woman"; 00076 std::vector<std::string> args; 00077 args.push_back(std::string()); 00078 bool val = pl.query(predicate, args); 00079 LINFO("%s is a woman (%i)", args[0].c_str(), val); 00080 } 00081 00082 //Who loves mia? loves(X,pumpkin). 00083 { 00084 const char *predicate = "loves"; 00085 std::vector<std::string> args; 00086 args.push_back(std::string()); 00087 args.push_back(std::string("pumpkin")); 00088 bool val = pl.query(predicate, args); 00089 LINFO("%s loves %s (%i)", args[0].c_str(), args[1].c_str(), val); 00090 } 00091 00092 //Who loves who? loves(X,Y). 00093 { 00094 const char *predicate = "loves"; 00095 std::vector<std::string> args; 00096 args.push_back(std::string()); 00097 args.push_back(std::string()); 00098 bool val = pl.query(predicate, args); 00099 LINFO("%s loves %s (%i)", args[0].c_str(), args[1].c_str(), val); 00100 } 00101 00102 //is Marcellus jealous of sombody? jealous(marcellus,W). 00103 { 00104 const char *predicate = "jealous"; 00105 std::vector<std::string> args; 00106 args.push_back(std::string("marcellus")); 00107 args.push_back(std::string()); 00108 bool val = pl.query(predicate, args); 00109 LINFO("%s is jealous of %s (%i)", args[0].c_str(), args[1].c_str(), val); 00110 } 00111 00112 00113 } 00114 00115 00116 // ###################################################################### 00117 /* So things look consistent in everyone's emacs... */ 00118 /* Local Variables: */ 00119 /* indent-tabs-mode: nil */ 00120 /* End: */