update README;remove debugging information

author: zengli
This commit is contained in:
qzxx 2015-10-19 23:58:46 +08:00
parent da5a84b23a
commit 87731c7286
13 changed files with 158 additions and 112 deletions

View File

@ -77,7 +77,7 @@ bool Database::load()
}
(this->kvstore)->open();
cout << "finish load" << endl;
//cout << "finish load" << endl;
return true;
}
@ -103,37 +103,37 @@ bool Database::query(const string _query, ResultSet& _result_set)
_parser.sparqlParser(_query, _sparql_q);
long tv_parse = util::get_cur_time();
cout << "after Parsing, used " << (tv_parse - tv_begin) << endl;
cout << "after Parsing..." << endl << _sparql_q.triple_str() << endl;
//cout << "after Parsing, used " << (tv_parse - tv_begin) << endl;
//cout << "after Parsing..." << endl << _sparql_q.triple_str() << endl;
_sparql_q.encodeQuery(this->kvstore);
cout << "sparqlSTR:\t" << _sparql_q.to_str() << endl;
//cout << "sparqlSTR:\t" << _sparql_q.to_str() << endl;
long tv_encode = util::get_cur_time();
cout << "after Encode, used " << (tv_encode - tv_parse) << "ms." << endl;
//cout << "after Encode, used " << (tv_encode - tv_parse) << "ms." << endl;
_result_set.select_var_num = _sparql_q.getQueryVarNum();
(this->vstree)->retrieve(_sparql_q);
long tv_retrieve = util::get_cur_time();
cout << "after Retrieve, used " << (tv_retrieve - tv_encode) << "ms." << endl;
//cout << "after Retrieve, used " << (tv_retrieve - tv_encode) << "ms." << endl;
this->join(_sparql_q);
long tv_join = util::get_cur_time();
cout << "after Join, used " << (tv_join - tv_retrieve) << "ms." << endl;
//cout << "after Join, used " << (tv_join - tv_retrieve) << "ms." << endl;
this->getFinalResult(_sparql_q, _result_set);
long tv_final = util::get_cur_time();
cout << "after finalResult, used " << (tv_final - tv_join) << "ms." << endl;
//cout << "after finalResult, used " << (tv_final - tv_join) << "ms." << endl;
cout << "Total time used: " << (tv_final - tv_begin) << "ms." << endl;
//cout << "Total time used: " << (tv_final - tv_begin) << "ms." << endl;
//testing...
cout << "final result is : " << endl;
//cout << "final result is : " << endl;
cout << _result_set.to_str() << endl;
@ -148,7 +148,7 @@ bool Database::insert(const string& _insert_rdf_file)
{
return false;
}
cout << "finish loading" << endl;
//cout << "finish loading" << endl;
long tv_load = util::get_cur_time();
@ -174,7 +174,7 @@ bool Database::insert(const string& _insert_rdf_file)
stringstream _ss;
_ss << "finish rdfparser" << insert_triple_num << endl;
Database::log(_ss.str());
cout << _ss.str() << endl;
//cout << _ss.str() << endl;
}
if(parse_triple_num == 0)
@ -208,7 +208,7 @@ bool Database::insert(const string& _insert_rdf_file)
}
long tv_insert = util::get_cur_time();
cout << "after insert, used " << (tv_insert - tv_load) << "ms." << endl;
//cout << "after insert, used " << (tv_insert - tv_load) << "ms." << endl;
flag = this->vstree->saveTree();
if (!flag)
@ -223,7 +223,7 @@ bool Database::insert(const string& _insert_rdf_file)
return false;
}
cout << "insert rdf triples done." << endl;
//cout << "insert rdf triples done." << endl;
return true;
}
@ -247,20 +247,20 @@ bool Database::build(const string& _rdf_file)
std::string vstree_store_path = store_path + "/vs_store";
util::create_dir(vstree_store_path);
cout << "begin encode RDF from : " << _rdf_file << " ..." << endl;
//cout << "begin encode RDF from : " << _rdf_file << " ..." << endl;
// to be switched to new encodeRDF method.
// this->encodeRDF(_rdf_file);
this->encodeRDF_new(_rdf_file);
cout << "finish encode." << endl;
//cout << "finish encode." << endl;
std::string _entry_file = this->getSignatureBFile();
(this->kvstore)->open();
cout << "begin build VS-Tree on " << _rdf_file << "..." << endl;
//cout << "begin build VS-Tree on " << _rdf_file << "..." << endl;
(this->vstree)->buildTree(_entry_file);
long tv_build_end = util::get_cur_time();
cout << "after build, used " << (tv_build_end - tv_build_begin) << "ms." << endl;
cout << "finish build VS-Tree." << endl;
//cout << "after build, used " << (tv_build_end - tv_build_begin) << "ms." << endl;
//cout << "finish build VS-Tree." << endl;
return true;
}
@ -582,7 +582,7 @@ bool Database::sub2id_pre2id_obj2id_RDFintoSignature(const string _rdf_file, int
stringstream _ss;
_ss << "finish rdfparser" << this->triples_num << endl;
Database::log(_ss.str());
cout << _ss.str() << endl;
//cout << _ss.str() << endl;
}
if(parse_triple_num == 0){
break;
@ -753,7 +753,7 @@ bool Database::sub2id_pre2id_obj2id_RDFintoSignature(const string _rdf_file, int
_ss << "preNum is " << this->pre_num << endl;
_ss << "literalNum is " << this->literal_num << endl;
Database::log(_ss.str());
cout << _ss.str() << endl;
//cout << _ss.str() << endl;
}
return true;
@ -809,7 +809,7 @@ bool Database::sub2id_pre2id(const string _rdf_file, int**& _p_id_tuples, int &
stringstream _ss;
_ss << "finish rdfparser" << this->triples_num << endl;
Database::log(_ss.str());
cout << _ss.str() << endl;
//cout << _ss.str() << endl;
}
if(parse_triple_num == 0){
break;
@ -880,7 +880,7 @@ bool Database::sub2id_pre2id(const string _rdf_file, int**& _p_id_tuples, int &
_ss << "subNum is " << this->sub_num << endl;
_ss << "preNum is " << this->pre_num << endl;
Database::log(_ss.str());
cout << _ss.str() << endl;
//cout << _ss.str() << endl;
}
return true;
@ -937,7 +937,7 @@ bool Database::literal2id_RDFintoSignature(const string _rdf_file, int** _p_id_t
stringstream _ss;
_ss << "finish rdfparser" << _i_tuples << endl;
Database::log(_ss.str());
cout << _ss.str() << endl;
//cout << _ss.str() << endl;
}
if(parse_triple_num == 0){
break;
@ -1021,7 +1021,7 @@ bool Database::literal2id_RDFintoSignature(const string _rdf_file, int** _p_id_t
}/* end for while(true) */
cout << "end for while" << endl;
//cout << "end for while" << endl;
delete[] triple_array;
_six_tuples_fout.close();
_fin.close();
@ -1764,13 +1764,13 @@ bool Database::join
// Database::log(_ss.str());
}
// cout << _result_list[0][0] << " & " << _result_list[0][1] << endl;
std::cout << "*****Join done" << std::endl;
//std::cout << "*****Join done" << std::endl;
return true;
}
bool Database::select(vector<int*>& _result_list,int _var_id,int _pre_id,int _var_id2,const char _edge_type,int _var_num)
{
cout << "*****In select" << endl;
//cout << "*****In select" << endl;
int* id_list;
int id_list_len;
@ -1840,9 +1840,9 @@ bool Database::select(vector<int*>& _result_list,int _var_id,int _pre_id,int _va
}
}
cout << "\t\tresult size: " << _result_list.size() << " invalid:" << invalid_num << endl;
//cout << "\t\tresult size: " << _result_list.size() << " invalid:" << invalid_num << endl;
//
cout << "*****Select done" << endl;
//cout << "*****Select done" << endl;
return true;
}
@ -1857,33 +1857,33 @@ bool Database::join(SPARQLquery& _sparql_query)
//join each basic query
for (int i=0; i< basic_query_num; i++){
cout<<"Basic query "<<i<<endl;
//cout<<"Basic query "<<i<<endl;
BasicQuery* basic_query;
basic_query=&(_sparql_query.getBasicQuery(i));
long begin = util::get_cur_time();
this->filter_before_join(basic_query);
long after_filter = util::get_cur_time();
cout << "after filter_before_join: used " << (after_filter-begin) << " ms" << endl;
//cout << "after filter_before_join: used " << (after_filter-begin) << " ms" << endl;
this->add_literal_candidate(basic_query);
long after_add_literal = util::get_cur_time();
cout << "after add_literal_candidate: used " << (after_add_literal-after_filter) << " ms" << endl;
//cout << "after add_literal_candidate: used " << (after_add_literal-after_filter) << " ms" << endl;
this->join_basic(basic_query);
long after_joinbasic = util::get_cur_time();
cout << "after join_basic : used " << (after_joinbasic-after_add_literal) << " ms" << endl;
//cout << "after join_basic : used " << (after_joinbasic-after_add_literal) << " ms" << endl;
this->only_pre_filter_after_join(basic_query);
long after_pre_filter_after_join = util::get_cur_time();
cout << "after only_pre_filter_after_join : used " << (after_pre_filter_after_join-after_joinbasic) << " ms" << endl;
//cout << "after only_pre_filter_after_join : used " << (after_pre_filter_after_join-after_joinbasic) << " ms" << endl;
// remove invalid and duplicate result at the end.
basic_query->dupRemoval_invalidRemoval();
std::cout << "Final result:" << (basic_query->getResultList()).size() << std::endl;
//std::cout << "Final result:" << (basic_query->getResultList()).size() << std::endl;
}
return true;
}
bool Database::join_basic(BasicQuery* basic_query)
{
cout << "IIIIIIN join basic" << endl;
//cout << "IIIIIIN join basic" << endl;
int var_num = basic_query->getVarNum();
int triple_num = basic_query->getTripleNum();
@ -1974,34 +1974,34 @@ bool Database::join_basic(BasicQuery* basic_query)
}
}
cout << "OOOOOUT join basic" << endl;
//cout << "OOOOOUT join basic" << endl;
return true;
}
void Database::filter_before_join(BasicQuery* basic_query)
{
cout << "*****IIIIIIN filter_before_join" << endl;
//cout << "*****IIIIIIN filter_before_join" << endl;
int var_num = 0;
var_num = basic_query->getVarNum();
for (int i = 0; i < var_num; i++)
{
std::cout << "\tVar" << i << " " << basic_query->getVarName(i) << std::endl;
//std::cout << "\tVar" << i << " " << basic_query->getVarName(i) << std::endl;
IDList &can_list = basic_query->getCandidateList(i);
cout << "\t\tsize of canlist before filter: " << can_list.size() << endl;
//cout << "\t\tsize of canlist before filter: " << can_list.size() << endl;
// must sort before using binary search.
can_list.sort();
long begin = util::get_cur_time();
this->literal_edge_filter(basic_query, i);
long after_literal_edge_filter = util::get_cur_time();
cout << "\t\tliteral_edge_filter: used " << (after_literal_edge_filter-begin) << " ms" << endl;
//cout << "\t\tliteral_edge_filter: used " << (after_literal_edge_filter-begin) << " ms" << endl;
// this->preid_filter(basic_query, i);
// long after_preid_filter = util::get_cur_time();
// cout << "\t\tafter_preid_filter: used " << (after_preid_filter-after_literal_edge_filter) << " ms" << endl;
cout << "\t\t[" << i << "] after filter, candidate size = " << can_list.size() << endl << endl << endl;
//cout << "\t\t[" << i << "] after filter, candidate size = " << can_list.size() << endl << endl << endl;
//debug
// {
@ -2017,7 +2017,7 @@ void Database::filter_before_join(BasicQuery* basic_query)
// }
}
cout << "OOOOOOUT filter_before_join" << endl;
//cout << "OOOOOOUT filter_before_join" << endl;
}
void Database::literal_edge_filter(BasicQuery* basic_query, int _var_i)
@ -2029,7 +2029,7 @@ void Database::literal_edge_filter(BasicQuery* basic_query, int _var_i)
{
int neighbor_id = basic_query->getEdgeNeighborID(_var_i, j);
// continue;
cout << "\t\t\tneighbor_id=" << neighbor_id << endl;
//cout << "\t\t\tneighbor_id=" << neighbor_id << endl;
if (neighbor_id != -1)
{
continue;
@ -2164,7 +2164,7 @@ void Database::preid_filter(BasicQuery* basic_query, int _var_i)
{
int neighbor_id = basic_query->getEdgeNeighborID(_var_i, j);
// continue;
cout << "\t\t\tneighbor_id=" << neighbor_id << endl;
//cout << "\t\t\tneighbor_id=" << neighbor_id << endl;
if (neighbor_id != -1)
{
continue;
@ -2783,5 +2783,5 @@ void Database::test_join()
this->join(_q);
ResultSet _rs;
this->getFinalResult(_q, _rs);
cout << _rs.to_str() << endl;
//cout << _rs.to_str() << endl;
}

View File

@ -32,10 +32,10 @@ class Database{
public:
static const bool debug_1 = true;
static const bool debug_2 = true;
static const bool debug_1 = false;
static const bool debug_2 = false;
static const bool only_sub2idpre2id = true;
static const bool debug_vstree = true;
static const bool debug_vstree = false;
static const int internal = 100*1000;
static FILE* fp_debug;
static void log(std::string _str);

View File

@ -991,7 +991,7 @@ void KVstore::flush(){
* has not been modified will do nothing
* */
void KVstore::release(){
cout << "release of KVstore..." << endl;
//cout << "release of KVstore..." << endl;
this->release(this->entity2id);
this->release(this->id2entity);
@ -1013,7 +1013,7 @@ void KVstore::release(){
void KVstore::open()
{
cout << "open KVstore" << endl;
//cout << "open KVstore" << endl;
this->open(this->entity2id, KVstore::s_entity2id, KVstore::READ_WRITE_MODE);
this->open(this->id2entity, KVstore::s_id2entity, KVstore::READ_WRITE_MODE);
@ -1074,7 +1074,7 @@ bool KVstore::open(Tree* & _p_btree, const string _tree_name, const int _mode){
}
else
{
cout << "bug in open mode of : " << _tree_name << " with mode=" << _mode << endl;
//cout << "bug in open mode of : " << _tree_name << " with mode=" << _mode << endl;
}
return false;

View File

@ -610,7 +610,7 @@ Storage::handler(unsigned _needmem) //>0
Storage::~Storage()
{
//release heap and freelist...
printf("now to release the knstore!\n");
//printf("now to release the knstore!\n");
BlockInfo* bp = this->freelist;
BlockInfo* next;
while(bp != NULL)
@ -619,9 +619,9 @@ Storage::~Storage()
delete bp;
bp = next;
}
printf("already empty the freelist!\n");
//printf("already empty the freelist!\n");
delete this->minheap;
printf("already empty the buffer heap!\n");
//printf("already empty the buffer heap!\n");
fclose(this->treefp);
#ifdef DEBUG
fclose(Util::logsfp);

View File

@ -495,7 +495,7 @@ Tree::range_query(const TBstr* _key1, const TBstr* _key2)
bool
Tree::save() //save the whole tree to disk
{
printf("now to save tree!\n");
//printf("now to save tree!\n");
if(TSM->writeTree(this->root))
return true;
else
@ -521,7 +521,7 @@ Tree::~Tree()
{
//delete VALUES;
delete TSM;
printf("already empty the buffer, now to delete all nodes in tree!\n");
//printf("already empty the buffer, now to delete all nodes in tree!\n");
//recursively delete each Node
release(root);
}

View File

@ -187,13 +187,13 @@ int DBparser::replacePrefix(string& str){
if (str[0]!='<'){
int sep=str.find(":");
std::string prefix=str.substr(0,sep+1);
std::cout<<"prefix: "<<prefix<<std::endl;
//std::cout<<"prefix: "<<prefix<<std::endl;
if (_prefix_map.find(prefix)!=_prefix_map.end()){
str=_prefix_map[prefix].substr(0,_prefix_map[prefix].length()-1)+str.substr(sep+1,str.length()-sep-1)+">";
std::cout<<"str: "<<str<<std::endl;
//std::cout<<"str: "<<str<<std::endl;
}
else{
std::cout<<"prefix not found..."<<std::endl;
//std::cout<<"prefix not found..."<<std::endl;
}
}
}
@ -222,7 +222,7 @@ int DBparser::parseTriple(pANTLR3_BASE_TREE node,Triple& triple){
}
}
triple=Triple(subject,predicate,object);
std::cout<<"Triple: \n\ts|"<<subject<<"|\n\tp|"<<predicate<<"|\n\to|"<<object<<"|"<<std::endl;
//std::cout<<"Triple: \n\ts|"<<subject<<"|\n\tp|"<<predicate<<"|\n\to|"<<object<<"|"<<std::endl;
return 0;
}
@ -232,7 +232,7 @@ int DBparser::parseBasicQuery(pANTLR3_BASE_TREE node,BasicQuery& basicQuery){
for (unsigned int j=0;j<node->getChildCount(node);j++){
pANTLR3_BASE_TREE childNode=(pANTLR3_BASE_TREE) node->getChild(node,j);
//basicQuery 185
std::cout<<"Child type: "<<childNode->getType(childNode)<<endl;
//std::cout<<"Child type: "<<childNode->getType(childNode)<<endl;
if (childNode->getType(childNode)==185){
parseTriple(childNode,triple);
basicQuery.addTriple(triple);

View File

@ -239,13 +239,13 @@ void BasicQuery::updateObjSig(int _obj_id, int _pre_id, int _sub_id, std::string
bool sub_is_str = (_sub_id == -1) && (_sub.at(0) != '?');
if(sub_is_str)
{
cout << "str2entity" << endl;
//cout << "str2entity" << endl;
Signature::encodeStr2Entity(_sub.c_str(), this->var_sig[_obj_id]);
}
if(_pre_id != -1)
{
cout << "pre2entity" << endl;
//cout << "pre2entity" << endl;
Signature::encodePredicate2Entity(_pre_id, this->var_sig[_obj_id], BasicQuery::EDGE_IN);
}
@ -262,12 +262,12 @@ void BasicQuery::updateObjSig(int _obj_id, int _pre_id, int _sub_id, std::string
/* encode relative signature data of the query graph */
void BasicQuery::encodeBasicQuery(KVstore* _p_kvstore, const std::vector<std::string>& _query_var)
{
cout << "IN buildBasicSignature" << endl;
//cout << "IN buildBasicSignature" << endl;
/* initial */
this->initial();
cout << "after init" << endl;
//cout << "after init" << endl;
this->buildTuple2Freq();
@ -290,12 +290,12 @@ void BasicQuery::encodeBasicQuery(KVstore* _p_kvstore, const std::vector<std::st
this->var_name[i] = _var;
}
cout << "select variables: ";
//cout << "select variables: ";
for(int i = 0; i < this->var_str2id.size(); i ++)
{
cout << "[" << this->var_name[i] << ", " << i << " " << this->var_str2id[this->var_name[i]] << "]\t";
//cout << "[" << this->var_name[i] << ", " << i << " " << this->var_str2id[this->var_name[i]] << "]\t";
}
cout << endl;
//cout << endl;
if(this->encode_method == BasicQuery::SELECT_VAR)
{
@ -308,13 +308,13 @@ void BasicQuery::encodeBasicQuery(KVstore* _p_kvstore, const std::vector<std::st
/* assign the this->var_num */
this->graph_var_num = this->var_str2id.size();
cout<< "graph variables: ";
//cout<< "graph variables: ";
for(int i = 0; i < this->var_str2id.size(); i ++)
{
cout << "[" << this->var_name[i] << ", " << i << " " << this->var_str2id[this->var_name[i]] << "]\t";
//cout << "[" << this->var_name[i] << ", " << i << " " << this->var_str2id[this->var_name[i]] << "]\t";
}
cout << endl;
cout << "before new IDList!" << endl; //just for debug
//cout << endl;
//cout << "before new IDList!" << endl; //just for debug
this->candidate_list = new IDList[this->graph_var_num];
@ -382,14 +382,14 @@ void BasicQuery::encodeBasicQuery(KVstore* _p_kvstore, const std::vector<std::st
{
if(pre_id != -1)
{
cout << "pre2edge" << endl;
//cout << "pre2edge" << endl;
Signature::encodePredicate2Edge(pre_id, this->edge_sig[sub_id][obj_id]);
// this->edge_pre_id[sub_id][obj_id] = pre_id;
}
}
}
cout << "OUT encodeBasicQuery" << endl;
//cout << "OUT encodeBasicQuery" << endl;
}
@ -699,7 +699,7 @@ struct BasicQuery::ResultCmp
bool BasicQuery::dupRemoval_invalidRemoval()
{
std::cout << "IN dupRemoval_invalidRemoval" << std::endl;
//std::cout << "IN dupRemoval_invalidRemoval" << std::endl;
ResultCmp resCmp(this->graph_var_num);
ResultEqual resEqual(this->select_var_num);
@ -731,10 +731,10 @@ bool BasicQuery::dupRemoval_invalidRemoval()
}
this->result_list.resize(valid_num);
std::cout << "dup_num: " << dup_num << std::endl;
std::cout << "invalid_num: " << result_size - valid_num << std::endl;
//std::cout << "dup_num: " << dup_num << std::endl;
//std::cout << "invalid_num: " << result_size - valid_num << std::endl;
std::cout << "OUT dupRemoval_invalidRemoval" << std::endl;
//std::cout << "OUT dupRemoval_invalidRemoval" << std::endl;
return true;
}

View File

@ -86,14 +86,14 @@ vector<BasicQuery*>& SPARQLquery::getBasicQueryVec()
void SPARQLquery::print(ostream& _out_stream){
int k=getQueryVarNum();
std::cout<<"QueryVar "<<k<<":"<<std::endl;
//std::cout<<"QueryVar "<<k<<":"<<std::endl;
for (int i=0;i<k;i++){
std::cout<<getQueryVar(i)<<std::endl;
//std::cout<<getQueryVar(i)<<std::endl;
}
k=getBasicQueryNum();
std::cout<<"Block "<<k<<" in total."<<std::endl;
//std::cout<<"Block "<<k<<" in total."<<std::endl;
for (int i=0;i<k;i++){
std::cout<<"Block "<<i<<std::endl;
//std::cout<<"Block "<<i<<std::endl;
getBasicQuery(i).print(_out_stream);
}
}

View File

@ -6,7 +6,7 @@
gStore is a graph-based RDF data management system (or what is commonly called a “triple store”) that maintains the graph structure of the original [RDF](http://www.w3.org/TR/rdf11-concepts/) data. Its data model is a labeled, directed multiedge graph, where each vertex corresponds to a subject or an object. We also represent a given [SPARQL](http://www.w3.org/TR/sparql11-overview/) query by a query graph Q. Query processing involves finding subgraph matches of Q over the RDF graph G. gStore incorporates an index over the RDF graph (called VS-tree) to speed up query processing. VS-tree is a heightbalanced tree with a number of associated pruning techniques to speed up subgraph matching.
### Install Steps
System Requirement: 64-bit linux server with GCC, make installed.
System Requirement: 64-bit linux server with GCC, make, readline installed.
*We have tested on linux server with CentOS 6.2 x86_64 and CentOS 6.6 x86_64. The version of GCC should be 4.4.7 or later.*
You can install gStore2.0 in two commands.
@ -43,16 +43,18 @@ For example, we build a database from LUBM_10.n3 which can be found in example f
####2. gquery
gquery is used to query an exsisting database with SPARQL files.
`#./gquery db_name`
`./gquery db_name` (use `./gquery --help` for detail)
The program shows a command prompt: inputting a file name which can be interpreted as a single SPARQL query. When the program finish answering the query, it shows the command prompt again.
The program shows a command prompt("gsql>"): you can type in a command here, use `help` to see information of all commands.
For `sparql` command, input a file name which can be interpreted as a single SPARQL query.
When the program finish answering the query, it shows the command prompt again.
*gStore2.0 only support simple “select” queries now.*
We also take LUBM_10 as an example.
We also take lubm_10.nt as an example.
[root@master Gstore]# ./gquery db_LUBM10/
[root@master Gstore]# ./gquery lubm_10.nt/
gquery...
argc: 2 DB_store:db_LUBM10/
argc: 2 DB_store:lubm_10.nt/
loadTree...
LRUCache initial...
LRUCache initial finish
@ -61,8 +63,8 @@ We also take LUBM_10 as an example.
open KVstore
finish load
finish loading
please input query file path:
./example/LUBM_q0.txt
Type `help` for information of all commands
gsql>sparql /media/wip/common/data/LUBM/query/q0.sql
... ...
Total time used: 4ms.
final result is :
@ -82,6 +84,10 @@ We also take LUBM_10 as an example.
<http://www.Department13.University0.edu/FullProfessor0>
<http://www.Department14.University0.edu/FullProfessor0>
Notice:
"[empty result]" will be printed if no answer, and there is an empty line after all results.
Readline lib is used, so you can use 'UP' arrow key to see command history, and use 'LEFT' arrow key to move and modify your entire command.
What is more, path completion is supported for utility. (not built-in command completion)
####3. gserver
gserver is a daemon. It should be launched first when accessing gStore by gclient or API. It communicates with client through socket.
@ -135,4 +141,44 @@ Note that each command ends with ";".
####5. API
We provide JAVA and C++ API for accessing gStore now. Please refer to example codes in `api/cpp/example` and `api/java/example`.
####6. gtest
We provide a test tool to generate structural logs for datasets. Please type `./gtest --help` in the working directory for detail.
(change paths in the main/gtest.cpp if needed)
You should place the datasets and queries this way:
DIR/WatDiv/database/*.nt
DIR/WatDiv/query/*.sql
And the output will be sorted into there logs: load.log/(for database loading time and size), time.log/(for query time) and result.log/(for all query results).
All logs produced by this program are in TSV format, you can load them into Calc/Excel directly.
### System Update Log
####Oct 19, 2015.
We add a gtest tool for utility, you can use it to query several datasets with their own queries.
In addition, gquery console is improved. Readline lib is used for input instead of fgets, and the gquery console can support commands history, modifying command and commands completion now.
What is more, we found and fix a bug in Database/(a pointer for debugging log is not set to NULL after fclose operation, so if you close one databse and open another, the system will fail entirely because the system think that the debugging log is still open)
####Sep 25, 2015.
We implement the version of BTree, and replace the old one.
After testing on DBpedia, LUBM, and WatDiv benchmark, we conclude that the new BTree performs more efficient than
the old version. For the same triple file, the new version spends shorter time on executing gload command.
Besides, the new version can handle the long literal objects ocasion efficiently, while triples whose object's length exceeds 4096 bytes result in frequent inefficent split operations on the old version BTree.
####Feb 2, 2015.
We modify the RDF parser and SPARQL parser.
Under the new RDF parser, we also redesign the encode strategy, which reduces RDF file scanning times.
Now we can parse the standard SPARQL v1.1 grammar correctly, and can support basic graph pattern(BGP) SPARQL queries written by this standard grammar.
####Dec 11, 2014.
We add API for C/CPP and JAVA.
####Nov 20, 2014.
We share our gStore2.0 code as an open-source project under BSD license on github.

View File

@ -15,7 +15,7 @@ int LRUCache::DEFAULT_CAPACITY = 1*1000*1000;
LRUCache::LRUCache(int _capacity)
{
cout << "LRUCache initial..." << endl;
//cout << "LRUCache initial..." << endl;
this->capacity = _capacity > 0 ? _capacity : LRUCache::DEFAULT_CAPACITY;
// we should guarantee the cache is big enough.
this->capacity = std::max(this->capacity, VNode::MAX_CHILD_NUM * 2000);
@ -29,7 +29,7 @@ LRUCache::LRUCache(int _capacity)
this->prev[LRUCache::START_INDEX] = LRUCache::NULL_INDEX;
this->prev[LRUCache::END_INDEX] = LRUCache::START_INDEX;
this->size = 0;
cout << "LRUCache initial finish" << endl;
//cout << "LRUCache initial finish" << endl;
}
LRUCache::~LRUCache()

View File

@ -437,7 +437,7 @@ bool VSTree::saveTree()
bool VSTree::loadTree()
{
cout << "loadTree..." << endl;
//cout << "loadTree..." << endl;
(this->node_buffer) = new LRUCache(LRUCache::DEFAULT_CAPACITY);
bool flag = this->loadTreeInfo();
@ -451,13 +451,13 @@ bool VSTree::loadTree()
if (flag)
{
this->node_buffer->loadCache(VSTree::tree_node_file_path);
cout << "finish loadCache" << endl;
//cout << "finish loadCache" << endl;
}
if (flag)
{
flag = loadEntityID2FileLineMap();
cout << "finish loadEntityID2FileLineMap" << endl;
//cout << "finish loadEntityID2FileLineMap" << endl;
}
return flag;

View File

@ -14,12 +14,12 @@ using namespace std;
int main(int argc, char * argv[])
{
system("clock");
cout << "gload..." << endl;
//cout << "gload..." << endl;
{
cout << "argc: " << argc << "\t";
cout << "DB_store:" << argv[1] << "\t";
cout << "RDF_data: " << argv[2] << "\t";
cout << endl;
//cout << "argc: " << argc << "\t";
//cout << "DB_store:" << argv[1] << "\t";
//cout << "RDF_data: " << argv[2] << "\t";
//cout << endl;
}
string _db_path = string(argv[1]);
@ -28,11 +28,11 @@ int main(int argc, char * argv[])
bool flag = _db.build(_rdf);
if (flag)
{
cout << "import RDF file to database done." << endl;
//cout << "import RDF file to database done." << endl;
}
else
{
cout << "import RDF file to database failed." << endl;
//cout << "import RDF file to database failed." << endl;
}
system("clock");
return 0;

View File

@ -46,23 +46,23 @@ getQueryFromFile(const char* _file_path)
int
main(int argc, char * argv[])
{
cout << "gquery..." << endl;
//cout << "gquery..." << endl;
if(argc < 2)
{
cerr << "error: lack of DB_store to be queried" << endl;
return 0;
}
{
cout << "argc: " << argc << "\t";
cout << "DB_store:" << argv[1] << "\t";
cout << endl;
//cout << "argc: " << argc << "\t";
//cout << "DB_store:" << argv[1] << "\t";
//cout << endl;
}
string db_folder = string(argv[1]);
Database _db(db_folder);
_db.load();
cout << "finish loading" << endl;
//cout << "finish loading" << endl;
// read query from file.
if (argc >= 3)
@ -91,8 +91,8 @@ main(int argc, char * argv[])
return 0;
}
cout << "query is:" << endl;
cout << query << endl << endl;
//cout << "query is:" << endl;
//cout << query << endl << endl;
ResultSet _rs;
@ -157,8 +157,8 @@ main(int argc, char * argv[])
continue;
}
cout << "query is:" << endl;
cout << query << endl << endl;
//cout << "query is:" << endl;
//cout << query << endl << endl;
ResultSet _rs;