summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/notion.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/notion.cpp b/lib/notion.cpp index 16794d3..c8a8b47 100644 --- a/lib/notion.cpp +++ b/lib/notion.cpp
@@ -3,16 +3,16 @@
3#include <sstream> 3#include <sstream>
4 4
5namespace verbly { 5namespace verbly {
6 6
7 const object notion::objectType = object::notion; 7 const object notion::objectType = object::notion;
8 8
9 const std::list<std::string> notion::select = {"notion_id", "part_of_speech", "wnid", "images"}; 9 const std::list<std::string> notion::select = {"notion_id", "part_of_speech", "wnid", "images"};
10 10
11 const field notion::id = field::integerField(object::notion, "notion_id"); 11 const field notion::id = field::integerField(object::notion, "notion_id");
12 const field notion::partOfSpeech = field::integerField(object::notion, "part_of_speech"); 12 const field notion::partOfSpeech = field::integerField(object::notion, "part_of_speech");
13 const field notion::wnid = field::integerField(object::notion, "wnid", true); 13 const field notion::wnid = field::integerField(object::notion, "wnid", true);
14 const field notion::numOfImages = field::integerField(object::notion, "images", true); 14 const field notion::numOfImages = field::integerField(object::notion, "images", true);
15 15
16 const field notion::word = field::joinField(object::notion, "word_id", object::word); 16 const field notion::word = field::joinField(object::notion, "word_id", object::word);
17 17
18 const field notion::hypernyms = field::selfJoin(object::notion, "notion_id", "hypernymy", "hyponym_id", "hypernym_id"); 18 const field notion::hypernyms = field::selfJoin(object::notion, "notion_id", "hypernymy", "hyponym_id", "hypernym_id");
@@ -52,30 +52,30 @@ namespace verbly {
52 52
53 const field notion::causes = field::selfJoin(object::notion, "notion_id", "causality", "effect_id", "cause_id"); 53 const field notion::causes = field::selfJoin(object::notion, "notion_id", "causality", "effect_id", "cause_id");
54 const field notion::effects = field::selfJoin(object::notion, "notion_id", "causality", "cause_id", "effect_id"); 54 const field notion::effects = field::selfJoin(object::notion, "notion_id", "causality", "cause_id", "effect_id");
55 55
56 const notion::preposition_group_field prepositionGroup = {}; 56 const notion::preposition_group_field notion::prepositionGroup = {};
57 57
58 const field notion::preposition_group_field::isA = field::joinField(object::notion, "notion_id", "is_a"); 58 const field notion::preposition_group_field::isA = field::joinField(object::notion, "notion_id", "is_a");
59 const field notion::preposition_group_field::groupNameField = field::stringField("is_a", "groupname"); 59 const field notion::preposition_group_field::groupNameField = field::stringField("is_a", "groupname");
60 60
61 notion::notion(const database& db, sqlite3_stmt* row) : db_(&db), valid_(true) 61 notion::notion(const database& db, sqlite3_stmt* row) : db_(&db), valid_(true)
62 { 62 {
63 id_ = sqlite3_column_int(row, 0); 63 id_ = sqlite3_column_int(row, 0);
64 partOfSpeech_ = static_cast<part_of_speech>(sqlite3_column_int(row, 1)); 64 partOfSpeech_ = static_cast<part_of_speech>(sqlite3_column_int(row, 1));
65 65
66 if (sqlite3_column_type(row, 2) != SQLITE_NULL) 66 if (sqlite3_column_type(row, 2) != SQLITE_NULL)
67 { 67 {
68 hasWnid_ = true; 68 hasWnid_ = true;
69 wnid_ = sqlite3_column_int(row, 2); 69 wnid_ = sqlite3_column_int(row, 2);
70 } 70 }
71 71
72 if (sqlite3_column_type(row, 3) != SQLITE_NULL) 72 if (sqlite3_column_type(row, 3) != SQLITE_NULL)
73 { 73 {
74 hasNumOfImages_ = true; 74 hasNumOfImages_ = true;
75 numOfImages_ = sqlite3_column_int(row, 3); 75 numOfImages_ = sqlite3_column_int(row, 3);
76 } 76 }
77 } 77 }
78 78
79 std::string notion::getImageNetUrl() const 79 std::string notion::getImageNetUrl() const
80 { 80 {
81 std::stringstream url; 81 std::stringstream url;
@@ -85,10 +85,10 @@ namespace verbly {
85 url << (getWnid() % 100000000); 85 url << (getWnid() % 100000000);
86 return url.str(); 86 return url.str();
87 } 87 }
88 88
89 filter notion::preposition_group_field::operator==(std::string groupName) const 89 filter notion::preposition_group_field::operator==(std::string groupName) const
90 { 90 {
91 return (isA %= (groupNameField == groupName)); 91 return (isA %= (groupNameField == groupName));
92 } 92 }
93 93
94}; 94};