diff options
Diffstat (limited to 'lib/lemma.cpp')
-rw-r--r-- | lib/lemma.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/lemma.cpp b/lib/lemma.cpp index 1601460..0c6e99e 100644 --- a/lib/lemma.cpp +++ b/lib/lemma.cpp | |||
@@ -10,20 +10,13 @@ namespace verbly { | |||
10 | const std::list<std::string> lemma::select = {"lemma_id"}; | 10 | const std::list<std::string> lemma::select = {"lemma_id"}; |
11 | 11 | ||
12 | const field lemma::id = field::integerField(object::lemma, "lemma_id"); | 12 | const field lemma::id = field::integerField(object::lemma, "lemma_id"); |
13 | |||
14 | const field lemma::word = field::joinField(object::lemma, "lemma_id", object::word); | ||
15 | |||
16 | const field lemma::formJoin = field::joinField(object::lemma, "form_id", object::form); | ||
17 | const field lemma::inflectionCategory = field::integerField(object::lemma, "category"); | 13 | const field lemma::inflectionCategory = field::integerField(object::lemma, "category"); |
18 | 14 | ||
19 | filter operator%=(lemma::inflection_field check, filter joinCondition) | 15 | const field lemma::word = field::joinField(object::lemma, "lemma_id", object::word); |
20 | { | ||
21 | return (lemma::formJoin %= joinCondition) && (lemma::inflectionCategory == check.getCategory()); | ||
22 | } | ||
23 | 16 | ||
24 | lemma::inflection_field::operator filter() const | 17 | field lemma::form(inflection category) |
25 | { | 18 | { |
26 | return (lemma::inflectionCategory == category_); | 19 | return field::joinWhere(object::lemma, "form_id", object::form, inflectionCategory, static_cast<int>(category)); |
27 | } | 20 | } |
28 | 21 | ||
29 | lemma::lemma(const database& db, sqlite3_stmt* row) : db_(&db), valid_(true) | 22 | lemma::lemma(const database& db, sqlite3_stmt* row) : db_(&db), valid_(true) |
@@ -68,7 +61,7 @@ namespace verbly { | |||
68 | 61 | ||
69 | void lemma::initializeForm(inflection infl) const | 62 | void lemma::initializeForm(inflection infl) const |
70 | { | 63 | { |
71 | forms_[infl] = db_->forms(form::lemma(infl) %= *this, false, -1).all(); | 64 | forms_[infl] = db_->forms(form::lemma %= ((inflectionCategory == infl) && *this), verbly::form::id, -1).all(); |
72 | } | 65 | } |
73 | 66 | ||
74 | }; | 67 | }; |