43 " usage: freebase_load <file>\n"
45 " Loads a freebase .tsv file into a table called\n"
46 " freebase with the following schema:\n"
48 "create table freebase (\n"
54 " This program assumes that the first line in the\n"
55 " .tsv file contains the column names and that the\n"
56 " first two columns are 'name' followed by 'id'.\n"
57 " The 'id' column is used as the row key and the\n"
58 " name of the file (minus the .tsv extension) is\n"
59 " taken as the category.\n";
68 int main(
int argc,
char **argv) {
75 const char *inputfile;
83 cout << usage << endl;
87 parser.
load(inputfile);
95 namespace_ptr = client_ptr->open_namespace(
"/");
98 table_ptr = namespace_ptr->open_table(
"freebase");
102 mutator_ptr.reset(table_ptr->create_mutator());
110 while ((recs = parser.
next(&count)) != 0) {
111 for (
int i=0; i<count; i++) {
113 mutator_ptr->set(recs[i].key, recs[i].value, recs[i].value_len);
117 quick_exit(EXIT_FAILURE);
124 mutator_ptr->flush();
128 quick_exit(EXIT_FAILURE);
Retrieves system information (hardware, installation directory, etc)
std::string String
A String is simply a typedef to std::string.
bool load(const std::string fname)
std::shared_ptr< Namespace > NamespacePtr
Shared smart pointer to Namespace.
std::shared_ptr< Client > ClientPtr
std::shared_ptr< TableMutator > TableMutatorPtr
Smart pointer to TableMutator.
const char * get_text(int error)
Returns a descriptive error message.
int main(int argc, char **argv)
Compatibility Macros for C/C++.
static String locate_install_dir(const char *argv0)
Returns the installation directory.
This is a generic exception class for Hypertable.
InsertRec * next(int *countp)
Error codes, Exception handling, error logging.
std::shared_ptr< Table > TablePtr
int code() const
Returns the error code.