00001 00027 #// 00028 // file query.h 00029 // defines class Query of KIF XML queries 00030 // 00031 00032 00033 #ifndef __query__ 00034 #define __query__ 00035 00036 00037 #include <string> 00038 00039 00040 #include "Formula.hpp" 00041 00042 00043 class Query { 00044 public: 00045 class Attribute; 00046 enum QueryType { 00047 ASSERTION, 00048 GOAL, 00049 TERMINATE 00050 }; 00051 00052 // constructors 00053 Query (QueryType qtype, const Formula& formula, Attribute* attributes); 00054 Query () : _type (TERMINATE) {} 00055 00056 // query structure 00057 QueryType type () const { return _type; } 00058 const Formula& formula () const { return _formula; } 00059 int timeLimit () const { return _timeLimit; } 00060 int bindingsLimit () const { return _bindingsLimit; } 00061 00062 private: 00063 // structure 00064 QueryType _type; // a query can be a goal or an assertion 00065 Formula _formula; 00066 Attribute* _attributes; 00067 int _timeLimit; 00068 int _depthLimit; 00069 int _bindingsLimit; 00070 }; // class Query 00071 00072 00073 class Query::Attribute { 00074 public: 00075 // constructors 00076 Attribute (const string name, const string value) : 00077 _name (name), 00078 _value (value) 00079 {} 00080 00081 // query the structure 00082 const string name () const { return _name; } 00083 const string value () const { return _value; } 00084 Attribute* next () const { return _next; } 00085 void next (Attribute* att) { _next = att; } 00086 private: 00087 const string _name; 00088 const string _value; 00089 Attribute* _next; 00090 }; // class Query::Attribute 00091 00092 00093 #endif // __query_