summary refs log tree commit diff stats
path: root/lib/word.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-01-28 12:59:42 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-01-28 12:59:42 -0500
commita7645346293ed6a912c26d0c50b6f7943f1f3072 (patch)
treed4d144e03a5e2dfcebbad2692fa71e790719d8fd /lib/word.h
parent6ba8989bbbd497f949a3e8b17abed1d0bd048347 (diff)
downloadverbly-a7645346293ed6a912c26d0c50b6f7943f1f3072.tar.gz
verbly-a7645346293ed6a912c26d0c50b6f7943f1f3072.tar.bz2
verbly-a7645346293ed6a912c26d0c50b6f7943f1f3072.zip
Restructured verb frame schema to be more queryable
Groups are much less significant now, and they no longer have a database
table, nor are they considered a top level object anymore. Instead of
containing their own role data, that data is folded into the frames so
that it's easier to query; as a result, each group has its own copy of
the frames that it contains. Additionally, parts are considered top
level objects now, and you can query for frames based on attributes of
their indexed parts. Synrestrs are also contained in their own table
now, so that parts can be filtered against their synrestrs; they are
however not considered top level objects.

Created a new type of field, the "join where" or "condition join" field,
which is a normal join field that has a built in condition on a
specified field. This is used to allow creating multiple distinct join
fields from one object to another. This is required for the lemma::form
and frame::part joins, because filters for forms of separate inflections
should not be coalesced; similarly, filters on differently indexed frame
parts should not be coalesced.

Queries can now be ordered, ascending or descending, by a field, in
addition to randomly as before. This is necessary for accessing the
parts of a verb frame in the correct order, but may be useful to an end
user as well.

Fixed a bug with statement generation in that condition groups were not
being surrounded in parentheses, which made mixing OR groups and AND
groups generate inaccurate statements. This has been fixed;
additionally, parentheses are not placed around the top level condition,
and nested condition groups with the same logic type are coalesced, to
make query strings as easy to read as possible.

Also simplified the form::lemma field; it no longer conditions on the
inflection of the form like the lemma::form field does.

Also added a debug flag to statement::getQueryString that makes it
return a query string with all of the bindings filled in, for debug use
only.
Diffstat (limited to 'lib/word.h')
-rw-r--r--lib/word.h23
1 files changed, 10 insertions, 13 deletions
diff --git a/lib/word.h b/lib/word.h index ddcabe4..8a333a4 100644 --- a/lib/word.h +++ b/lib/word.h
@@ -7,7 +7,7 @@
7#include "filter.h" 7#include "filter.h"
8#include "notion.h" 8#include "notion.h"
9#include "lemma.h" 9#include "lemma.h"
10#include "group.h" 10#include "frame.h"
11 11
12struct sqlite3_stmt; 12struct sqlite3_stmt;
13 13
@@ -97,17 +97,9 @@ namespace verbly {
97 97
98 const lemma& getLemma() const; 98 const lemma& getLemma() const;
99 99
100 bool hasGroup() const 100 bool hasFrames() const;
101 {
102 if (!valid_)
103 {
104 throw std::domain_error("Bad access to uninitialized word");
105 }
106 101
107 return hasGroup_; 102 const std::vector<frame>& getFrames() const;
108 }
109
110 const group& getGroup() const;
111 103
112 // Convenience accessors 104 // Convenience accessors
113 105
@@ -136,7 +128,7 @@ namespace verbly {
136 128
137 static const field notion; 129 static const field notion;
138 static const field lemma; 130 static const field lemma;
139 static const field group; 131 static const field frame;
140 132
141 // Relationships with self 133 // Relationships with self
142 134
@@ -161,6 +153,9 @@ namespace verbly {
161 static const field regionalDomains; 153 static const field regionalDomains;
162 154
163 private: 155 private:
156
157 void initializeFrames() const;
158
164 bool valid_ = false; 159 bool valid_ = false;
165 160
166 int id_; 161 int id_;
@@ -176,7 +171,9 @@ namespace verbly {
176 171
177 mutable class notion notion_; 172 mutable class notion notion_;
178 mutable class lemma lemma_; 173 mutable class lemma lemma_;
179 mutable class group group_; 174
175 mutable bool initializedFrames_ = false;
176 mutable std::vector<class frame> frames_;
180 177
181 }; 178 };
182 179