summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/noun.cpp16
-rw-r--r--lib/noun.h4
2 files changed, 18 insertions, 2 deletions
diff --git a/lib/noun.cpp b/lib/noun.cpp index 43fda2e..81e6613 100644 --- a/lib/noun.cpp +++ b/lib/noun.cpp
@@ -330,6 +330,13 @@ namespace verbly {
330 return *this; 330 return *this;
331 } 331 }
332 332
333 noun_query& noun_query::is_instance(bool _arg)
334 {
335 _is_instance = _arg;
336
337 return *this;
338 }
339
333 noun_query& noun_query::instance_of(const noun& _noun) 340 noun_query& noun_query::instance_of(const noun& _noun)
334 { 341 {
335 _instance_of.push_back(_noun); 342 _instance_of.push_back(_noun);
@@ -644,12 +651,17 @@ namespace verbly {
644 651
645 if (_is_proper) 652 if (_is_proper)
646 { 653 {
647 conditions.push_back("noun_id IN (SELECT instance_id FROM instantiation)"); 654 conditions.push_back("proper = 1");
648 } 655 }
649 656
650 if (_is_not_proper) 657 if (_is_not_proper)
651 { 658 {
652 conditions.push_back("noun_id NOT IN (SELECT instance_id FROM instantiation)"); 659 conditions.push_back("proper = 0");
660 }
661
662 if (_is_instance)
663 {
664 conditions.push_back("noun_id IN (SELECT instance_id FROM instantiation)");
653 } 665 }
654 666
655 if (!_instance_of.empty()) 667 if (!_instance_of.empty())
diff --git a/lib/noun.h b/lib/noun.h index da76866..fbc2f9e 100644 --- a/lib/noun.h +++ b/lib/noun.h
@@ -79,6 +79,8 @@ namespace verbly {
79 79
80 noun_query& is_proper(bool _arg); 80 noun_query& is_proper(bool _arg);
81 noun_query& is_not_proper(bool _arg); 81 noun_query& is_not_proper(bool _arg);
82
83 noun_query& is_instance(bool _arg);
82 noun_query& instance_of(const noun& _noun); 84 noun_query& instance_of(const noun& _noun);
83 noun_query& not_instance_of(const noun& _noun); 85 noun_query& not_instance_of(const noun& _noun);
84 86
@@ -149,6 +151,8 @@ namespace verbly {
149 151
150 bool _is_proper = false; 152 bool _is_proper = false;
151 bool _is_not_proper = false; 153 bool _is_not_proper = false;
154
155 bool _is_instance = false;
152 std::list<noun> _instance_of; 156 std::list<noun> _instance_of;
153 std::list<noun> _not_instance_of; 157 std::list<noun> _not_instance_of;
154 158