From a7645346293ed6a912c26d0c50b6f7943f1f3072 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 28 Jan 2017 12:59:42 -0500 Subject: 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. --- lib/word.h | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'lib/word.h') 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 @@ #include "filter.h" #include "notion.h" #include "lemma.h" -#include "group.h" +#include "frame.h" struct sqlite3_stmt; @@ -97,17 +97,9 @@ namespace verbly { const lemma& getLemma() const; - bool hasGroup() const - { - if (!valid_) - { - throw std::domain_error("Bad access to uninitialized word"); - } + bool hasFrames() const; - return hasGroup_; - } - - const group& getGroup() const; + const std::vector& getFrames() const; // Convenience accessors @@ -136,7 +128,7 @@ namespace verbly { static const field notion; static const field lemma; - static const field group; + static const field frame; // Relationships with self @@ -161,6 +153,9 @@ namespace verbly { static const field regionalDomains; private: + + void initializeFrames() const; + bool valid_ = false; int id_; @@ -176,7 +171,9 @@ namespace verbly { mutable class notion notion_; mutable class lemma lemma_; - mutable class group group_; + + mutable bool initializedFrames_ = false; + mutable std::vector frames_; }; -- cgit 1.4.1