fix the export bug
This commit is contained in:
parent
2c69758845
commit
0eff60c908
|
@ -948,35 +948,35 @@ Strategy::handler6(BasicQuery* _bq, vector<unsigned*>& _result_list)
|
|||
//filter and join is too costly, should enum all predicates and use p2so
|
||||
unsigned* rsize = new unsigned[1];
|
||||
rsize[0] = 0;
|
||||
cout << "debug handler 6:" << limitID_predicate << endl;
|
||||
|
||||
for (TYPE_PREDICATE_ID i = 0; i < this->limitID_predicate; ++i)
|
||||
{
|
||||
TYPE_PREDICATE_ID pid = i;
|
||||
string p = this->kvstore->getPredicateByID(pid);
|
||||
cout << "debug handler 6 predicate:" << p << endl;
|
||||
|
||||
string pre = Util::node2string(p.c_str());
|
||||
cout << "debug handler 6 predicate pre:" << pre << endl;
|
||||
|
||||
this->kvstore->getsubIDobjIDlistBypreID(pid, id_list, id_list_len);
|
||||
cout << "debug handler 6 length:" << id_list_len << "." << endl;
|
||||
|
||||
for (unsigned j = 0; j < id_list_len; j += 2)
|
||||
{
|
||||
string s = this->kvstore->getEntityByID(id_list[j]);
|
||||
cout << "debug handler 6 s:" << s << "." << endl;
|
||||
|
||||
string sub = Util::node2string(s.c_str());
|
||||
cout << "debug handler 6 sub:" << sub << "." << endl;
|
||||
|
||||
string o;
|
||||
if(id_list[j + 1] >= Util::LITERAL_FIRST_ID)
|
||||
o = this->kvstore->getLiteralByID(id_list[j + 1]);
|
||||
else
|
||||
o = this->kvstore->getEntityByID(id_list[j + 1]);
|
||||
cout << "debug handler 6 o:" << o << "." << endl;
|
||||
|
||||
string obj = Util::node2string(o.c_str());
|
||||
cout << "debug handler 6 obj:" << obj << "." << endl;
|
||||
|
||||
string record = sub + "\t" + pre + "\t" + obj + ".\n";
|
||||
|
||||
fprintf(this->fp, "%s", record.c_str());
|
||||
rsize[0] += 1;
|
||||
cout << "debug handler 6 record:" << record << endl;
|
||||
|
||||
}
|
||||
delete[] id_list;
|
||||
}
|
||||
|
|
|
@ -2595,7 +2595,10 @@ void export_thread(const shared_ptr<HttpServer::Response>& response, const share
|
|||
|
||||
string sparql = "select * where{?x ?y ?z.}";
|
||||
ResultSet rs;
|
||||
FILE* ofp = fopen(db_path.c_str(), "w");
|
||||
string db_path2 = db_path + "/" + db_name + ".nt";
|
||||
cout << "open the result file:" << db_path2 << endl;
|
||||
|
||||
FILE* ofp = fopen(db_path2.c_str(), "w");
|
||||
int ret = current_database->query(sparql, rs, ofp, true, true);
|
||||
fflush(ofp);
|
||||
fclose(ofp);
|
||||
|
|
Loading…
Reference in New Issue