1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
#include "notion.h"
#include <sstream>
#include <hkutil/database.h>
namespace verbly {
const object notion::objectType = object::notion;
const std::list<std::string> notion::select = {"notion_id", "part_of_speech", "wnid", "images"};
const field notion::id = field::integerField(object::notion, "notion_id");
const field notion::partOfSpeech = field::integerField(object::notion, "part_of_speech");
const field notion::wnid = field::integerField(object::notion, "wnid", true);
const field notion::numOfImages = field::integerField(object::notion, "images", true);
const field notion::words = field::joinField(object::notion, "notion_id", object::word);
const field notion::hypernyms = field::selfJoin(object::notion, "notion_id", "hypernymy", "hyponym_id", "hypernym_id");
const field notion::hyponyms = field::selfJoin(object::notion, "notion_id", "hypernymy", "hypernym_id", "hyponym_id");
const field notion::fullHypernyms = field::hierarchalSelfJoin(object::notion, "notion_id", "hypernymy", "hyponym_id", "hypernym_id");
const field notion::fullHyponyms = field::hierarchalSelfJoin(object::notion, "notion_id", "hypernymy", "hypernym_id", "hyponym_id");
const field notion::instances = field::selfJoin(object::notion, "notion_id", "instantiation", "class_id", "instance_id");
const field notion::classes = field::selfJoin(object::notion, "notion_id", "instantiation", "instance_id", "class_id");
const field notion::memberMeronyms = field::selfJoin(object::notion, "notion_id", "member_meronymy", "holonym_id", "meronym_id");
const field notion::memberHolonyms = field::selfJoin(object::notion, "notion_id", "member_meronymy", "meronym_id", "holonym_id");
const field notion::fullMemberMeronyms = field::hierarchalSelfJoin(object::notion, "notion_id", "member_meronymy", "holonym_id", "meronym_id");
const field notion::fullMemberHolonyms = field::hierarchalSelfJoin(object::notion, "notion_id", "member_meronymy", "meronym_id", "holonym_id");
const field notion::partMeronyms = field::selfJoin(object::notion, "notion_id", "part_meronymy", "holonym_id", "meronym_id");
const field notion::partHolonyms = field::selfJoin(object::notion, "notion_id", "part_meronymy", "meronym_id", "holonym_id");
const field notion::fullPartMeronyms = field::hierarchalSelfJoin(object::notion, "notion_id", "part_meronymy", "holonym_id", "meronym_id");
const field notion::fullPartHolonyms = field::hierarchalSelfJoin(object::notion, "notion_id", "part_meronymy", "meronym_id", "holonym_id");
const field notion::substanceMeronyms = field::selfJoin(object::notion, "notion_id", "substance_meronymy", "holonym_id", "meronym_id");
const field notion::substanceHolonyms = field::selfJoin(object::notion, "notion_id", "substance_meronymy", "meronym_id", "holonym_id");
const field notion::fullSubstanceMeronyms = field::hierarchalSelfJoin(object::notion, "notion_id", "substance_meronymy", "holonym_id", "meronym_id");
const field notion::fullSubstanceHolonyms = field::hierarchalSelfJoin(object::notion, "notion_id", "substance_meronymy", "meronym_id", "holonym_id");
const field notion::variants = field::selfJoin(object::notion, "notion_id", "variation", "noun_id", "adjective_id");
const field notion::attributes = field::selfJoin(object::notion, "notion_id", "variation", "adjective_id", "noun_id");
const field notion::similarAdjectives = field::selfJoin(object::notion, "notion_id", "similarity", "adjective_2_id", "adjective_1_id");
const field notion::entails = field::selfJoin(object::notion, "notion_id", "entailment", "given_id", "entailment_id");
const field notion::entailedBy = field::selfJoin(object::notion, "notion_id", "entailment", "entailment_id", "given_id");
const field notion::causes = field::selfJoin(object::notion, "notion_id", "causality", "effect_id", "cause_id");
const field notion::effects = field::selfJoin(object::notion, "notion_id", "causality", "cause_id", "effect_id");
const notion::preposition_group_field notion::prepositionGroups = {};
const field notion::preposition_group_field::isA = field::joinField(object::notion, "notion_id", "is_a");
const field notion::preposition_group_field::groupNameField = field::stringField("is_a", "groupname");
notion::notion(const database& db, hatkirby::row row) : valid_(true)
{
id_ = mpark::get<int>(row[0]);
partOfSpeech_ = static_cast<part_of_speech>(mpark::get<int>(row[1]));
if (!mpark::holds_alternative<std::nullptr_t>(row[2]))
{
hasWnid_ = true;
wnid_ = mpark::get<int>(row[2]);
}
if (!mpark::holds_alternative<std::nullptr_t>(row[3]))
{
hasNumOfImages_ = true;
numOfImages_ = mpark::get<int>(row[3]);
}
}
std::string notion::getImageNetUrl() const
{
std::stringstream url;
url << "http://www.image-net.org/api/text/imagenet.synset.geturls?wnid=n";
url.width(8);
url.fill('0');
url << (getWnid() % 100000000);
return url.str();
}
filter notion::preposition_group_field::operator==(std::string groupName) const
{
return (isA %= (groupNameField == groupName));
}
};
|