diff --git a/Main/gconsole.cpp b/Main/gconsole.cpp index f5252bb..61962c1 100644 --- a/Main/gconsole.cpp +++ b/Main/gconsole.cpp @@ -815,6 +815,7 @@ int show_handler(const vector& args) //native mode if (flag) { + //showing all avaliable databases string database = Util::getItemsFromDir(db_home); if (database.empty()) { database = "No databases."; @@ -823,6 +824,7 @@ int show_handler(const vector& args) return 0; } + //below is to show current using database if (current_database == NULL) { cout << "No database used now." << endl; } @@ -847,7 +849,9 @@ int build_handler(const vector& args) { cerr << "Your db name to be built should not end with \".db\"." << endl; return -1; } - database += ".db"; + + //NOTICE: not add .db here, better to use db_suffix + //database += ".db"; //NOTICE: when in remote mode, the dataset should be placed in the server! And the exact path can only be got in the server //we can deal with it in Database @@ -949,7 +953,9 @@ int load_handler(const vector& args) { cerr << "You should use exactly the same db name as building, which should not end with \".db\"" << endl; return -1; } - database += ".db"; + + //NOTICE: not add .db here, better to use db_suffix + //database += ".db"; //remote mode if (gc != NULL) { diff --git a/NOTES.md b/NOTES.md index 8d1c549..2e54587 100644 --- a/NOTES.md +++ b/NOTES.md @@ -7,8 +7,6 @@ 在使用gserver时,不能在数据库没有unload时再用gbuild或其他命令修改数据库,仅限于C/S模式 将IRC聊天放到gstore文档上,freenode #gStore -# 推广 - 必须建立一个官方网站,可以展示下团队、demo,需要建立社区/论坛并维护 另外要有桌面应用或者网页应用,以可视化的方式操作数据库,类似virtuoso和neo4j那种 server 118.89.115.42 gstore-pku.com @@ -18,11 +16,6 @@ server 118.89.115.42 gstore-pku.com gstore网站中的demo应用的主体可以放在实验室主机上,至少是gstore数据库应抽离出来,但若实验室主机不开外网,应如何而配置代理? demo应用全部外链,具体服务放在实验室公开的主机上,通过ip:port连接 -方正 -微生物所 -社交网络(正在让北师那个学生在做) -DBpeida数据集上SPARQL查询接口 - --- # 并行策略- 线程控制模块 @@ -142,6 +135,10 @@ join_two里面可以分块并行,但不能用太多线程,在末尾添加新 gstore后续需要开发的地方: 事务操作:最小粒度是一个sparql/BGP一个事务,要支持workload(多个查询)为一个事务 最终一致性加锁就行了,顺序一致性则要考虑各种先后关系回滚等等,多版本两阶段锁协议 多领域多库解决方案。 +owl文件,如何定义一个范式转换规则,变成高效可用的RDF格式 +select from和select graph有何不同?考虑支持N-quad格式,第四列是一个graph label,说明这条边属于哪个graph +是否可以直接分成多个数据库来处理,各个数据库之间无边相连,同一查询可能包含多个数据库,比如比较字面值等等,类似关系数据库的表拼接。 +(这样的话查询就不仅属于一个数据库,那么应该新建Application层,并把GeneralEvaluation上升到Application层中) 任务分配: --- diff --git a/README.md b/README.md index c31d89d..f254865 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,9 @@ Gstore System(also called gStore) is a graph database engine for managing large **The formal help document is in [Handbook](docs/latex/gStore_help.pdf).** -**You can write your information in [survey](http://59.108.48.38/survey) if you like.** +**We have built an IRC channel named #gStore on freenode, and you can also come to our website: [gStore](gstore-pku.com).** + + ## Getting Started diff --git a/Util/Util.cpp b/Util/Util.cpp index 9a0a883..f6f0b28 100644 --- a/Util/Util.cpp +++ b/Util/Util.cpp @@ -808,12 +808,15 @@ Util::getItemsFromDir(string _path) { continue; } + + //BETTER: change to use db_suffix instead if(name.substr(len-3, 3) == ".db") { + string tmp = name.substr(0, len-3); if(ret == "") - ret = name; + ret = tmp; else - ret = ret + " " + name; + ret = ret + " " + tmp; } } closedir(dp); diff --git a/api/cpp/example/CppAPIExample.cpp b/api/cpp/example/CppAPIExample.cpp index 1701056..598926f 100644 --- a/api/cpp/example/CppAPIExample.cpp +++ b/api/cpp/example/CppAPIExample.cpp @@ -18,8 +18,8 @@ int main(int argc, char * argv[]) // build a new database by a RDF file. // note that the relative path is related to gserver. - gc.build("LUBM10.db", "data/LUBM_10.n3"); - gc.load("LUBM10.db"); + gc.build("LUBM10", "data/LUBM_10.n3"); + gc.load("LUBM10"); // then you can execute SPARQL query on this database. std::string sparql = "select ?x where \ @@ -36,12 +36,13 @@ int main(int argc, char * argv[]) std::cout << answer << std::endl; // unload this database. - gc.unload("LUBM10.db"); + gc.unload("LUBM10"); // also, you can load some exist database directly and then query. - gc.load("LUBM10.db"); + gc.load("LUBM10"); answer = gc.query(sparql); std::cout << answer << std::endl; + gc.unload("LUBM10"); return 0; } diff --git a/api/java/example/JavaAPIExample.java b/api/java/example/JavaAPIExample.java index 4f0cede..cf1c2a8 100644 --- a/api/java/example/JavaAPIExample.java +++ b/api/java/example/JavaAPIExample.java @@ -17,8 +17,8 @@ public class JavaAPIExample // build a new database by a RDF file. // note that the relative path is related to gserver. - gc.build("LUBM10.db", "data/LUBM_10.n3"); - gc.load("LUBM10.db"); + gc.build("LUBM10", "data/LUBM_10.n3"); + gc.load("LUBM10"); // then you can execute SPARQL query on this database. String sparql = "select ?x where " @@ -35,12 +35,13 @@ public class JavaAPIExample System.out.println(answer); // unload this database. - gc.unload("LUBM10.db"); + gc.unload("LUBM10"); // also, you can load some exist database directly and then query. - gc.load("LUBM10.db"); + gc.load("LUBM10"); answer = gc.query(sparql); System.out.println(answer); + gc.unload("LUBM10"); } } diff --git a/api/php/PHPAPIExample.php b/api/php/PHPAPIExample.php index a8dd313..e683c8d 100644 --- a/api/php/PHPAPIExample.php +++ b/api/php/PHPAPIExample.php @@ -2,7 +2,7 @@ require 'GstoreConnector.php'; $host = '127.0.0.1'; $port = 3305; -$dbname = "LUBM10.db"; +$dbname = "LUBM10"; $dbpath = "./data/LUBM_10.n3"; $query1 = "select ?x where { @@ -15,5 +15,6 @@ $load->load($dbname); $query = new Connector($host,$port); $result = $query->query($query1); echo $result; +$load->unload($dbname); ?> diff --git a/api/python/example/PythonAPIExample.py b/api/python/example/PythonAPIExample.py index 6cb0da2..eef6633 100644 --- a/api/python/example/PythonAPIExample.py +++ b/api/python/example/PythonAPIExample.py @@ -8,8 +8,8 @@ from GstoreConnector import GstoreConnector if __name__ == '__main__': gc = GstoreConnector('127.0.0.1', 3305) - gc.build('LUBM10.db', 'data/LUBM_10.n3') - gc.load('LUBM10.db') + gc.build('LUBM10', 'data/LUBM_10.n3') + gc.load('LUBM10') sparql = '''select ?x where { ?x . @@ -23,7 +23,8 @@ if __name__ == '__main__': answer = gc.query(sparql) print answer - gc.unload('LUBM10.db') - gc.load('LUBM10.db') + gc.unload('LUBM10') + gc.load('LUBM10') answer = gc.query(sparql) print answer + gc.unload('LUBM10') diff --git a/docs/USAGE.md b/docs/USAGE.md index 6f57b63..4980d01 100644 --- a/docs/USAGE.md +++ b/docs/USAGE.md @@ -22,10 +22,10 @@ gbuild is used to build a new database from a RDF triple format file. For example, we build a database from LUBM_10.n3 which can be found in example folder. - [bookug@localhost gStore]$ bin/gbuild LUBM10.db ./data/LUBM_10.n3 + [bookug@localhost gStore]$ bin/gbuild LUBM10 ./data/LUBM_10.n3 2015年05月21日 星期四 20时58分21秒 -0.484698 seconds gbuild... - argc: 3 DB_store:db_LUBM10 RDF_data: ./data/LUBM_10.n3 + argc: 3 DB_store:LUBM10 RDF_data: ./data/LUBM_10.n3 begin encode RDF from : ./data/LUBM_10.n3 ... - - - @@ -50,9 +50,9 @@ When the program finish answering the query, it shows the command prompt again. We also take LUBM_10.n3 as an example. - [bookug@localhost gStore]$ bin/gquery LUBM10.db + [bookug@localhost gStore]$ bin/gquery LUBM10 gquery... - argc: 2 DB_store:db_LUBM10/ + argc: 2 DB_store:LUBM10/ loadTree... LRUCache initial... LRUCache initial finish diff --git a/docs/latex/gStore_help.pdf b/docs/latex/gStore_help.pdf index 4e0ce05..9ee671e 100644 Binary files a/docs/latex/gStore_help.pdf and b/docs/latex/gStore_help.pdf differ diff --git a/docs/latex/gStore_help.tex b/docs/latex/gStore_help.tex index 9ba0735..c9d3fa9 100644 --- a/docs/latex/gStore_help.tex +++ b/docs/latex/gStore_help.tex @@ -313,6 +313,8 @@ The gStore source code is available as open-source code under the BSD license. Y \hyperdef{}{chapter03}{\subsection{Chapter 03: Install Guide}\label{chapter03}} +You are advised to read init.conf file, and modify it as you wish. (this file will configure the basic options of gStore system) + gStore is a green software, and you just need to compile it with one command. Please run \texttt{make} in the gStore root directory to compile the gStore code, link the ANTLR lib, and build executable ``gbuild'', ``gquery'', ``gserver'', ``gclient'', ``gconsole''. What is more, the api of gStore is also built now. If you want to use API examples of gStore, please run \texttt{make\ APIexample} to compile example codes for both C++ API and Java API. For details of API, please visit \hyperref[chapter05]{API} chapter. @@ -370,7 +372,7 @@ gstore>load lubm_10 database loaded successfully! gstore>show -lubm_10.db +lubm_10 gstore>query ./data/LUBM_q0.sql ... @@ -420,9 +422,9 @@ For example, we build a database from LUBM\_10.n3 which can be found in example folder. \begin{verbatim} -[bookug@localhost gStore]$ bin/gbuild LUBM10.db ./data/LUBM_10.n3 +[bookug@localhost gStore]$ bin/gbuild LUBM10 ./data/LUBM_10.n3 gbuild... -argc: 3 DB_store:db_LUBM10 RDF_data: ./data/LUBM_10.n3 +argc: 3 DB_store:LUBM10 RDF_data: ./data/LUBM_10.n3 begin encode RDF from : ./data/LUBM_10.n3 ... \end{verbatim} @@ -457,9 +459,9 @@ predicates) now.} We also take LUBM\_10.n3 as an example. \begin{verbatim} -[bookug@localhost gStore]$ bin/gquery LUBM10.db +[bookug@localhost gStore]$ bin/gquery LUBM10 gquery... -argc: 2 DB_store:db_LUBM10/ +argc: 2 DB_store:LUBM10/ loadTree... LRUCache initial... LRUCache initial finish @@ -547,9 +549,9 @@ load - load an existen database unload - unload an existen database sparql - load query from the second argument show - show the current database's name -gsql>import lubm.db data/LUBM_10.n3 +gsql>import lubm data/LUBM_10.n3 import RDF file to database done. -gsql>load lubm.db +gsql>load lubm load database done. gsql>sparql "select ?s ?o where { ?s ?o . }" [empty result] @@ -820,7 +822,7 @@ GstoreConnector.h should be called like below: GstoreConnector gc("127.0.0.1", 3305); // build a new database by a RDF file. // note that the relative path is related to gserver. -gc.build("LUBM10.db", "example/LUBM_10.n3"); +gc.build("LUBM10", "example/LUBM_10.n3"); // then you can execute SPARQL query on this database. std::string sparql = "select ?x where \ {\ @@ -834,9 +836,9 @@ std::string sparql = "select ?x where \ }"; std::string answer = gc.query(sparql); // unload this database. -gc.unload("LUBM10.db"); +gc.unload("LUBM10"); // also, you can load some exist database directly and then query. -gc.load("LUBM10.db"); +gc.load("LUBM10"); // query a SPARQL in current database answer = gc.query(sparql); \end{verbatim} @@ -894,7 +896,7 @@ GstoreConnector.java should be called like below: GstoreConnector gc = new GstoreConnector("127.0.0.1", 3305); // build a new database by a RDF file. // note that the relative path is related to gserver. -gc.build("LUBM10.db", "example/LUBM_10.n3"); +gc.build("LUBM10", "example/LUBM_10.n3"); // then you can execute SPARQL query on this database. String sparql = "select ?x where " + "{" + "?x . " + @@ -907,9 +909,9 @@ String sparql = "select ?x where " + "{" + "}"; String answer = gc.query(sparql); //unload this database. -gc.unload("LUBM10.db"); +gc.unload("LUBM10"); //also, you can load some exist database directly and then query. -gc.load("LUBM10.db");// query a SPARQL in current database +gc.load("LUBM10");// query a SPARQL in current database answer = gc.query(sparql); \end{verbatim} @@ -964,7 +966,7 @@ GstoreConnector.php should be called like below: $gc = new Connector("127.0.0.1", 3305); // build a new database by a RDF file. // note that the relative path is related to gserver. - $gc->build("LUBM10.db", "example/LUBM_10.n3"); + $gc->build("LUBM10", "example/LUBM_10.n3"); // then you can execute SPARQL query on this database. $sparql = "select ?x where " + "{" + "?x . " + @@ -977,9 +979,9 @@ GstoreConnector.php should be called like below: "}"; $answer = gc->query($sparql); //unload this database. - $gc->unload("LUBM10.db"); + $gc->unload("LUBM10"); //also, you can load some exist database directly and then query. - $gc->load("LUBM10.db");// query a SPARQL in current database + $gc->load("LUBM10");// query a SPARQL in current database $answer = gc->query(sparql); \end{verbatim} @@ -1028,7 +1030,7 @@ GstoreConnector.php should be called like below: gc = GstoreConnector('127.0.0.1', 3305) // build a new database by a RDF file. // note that the relative path is related to gserver. - gc.build('LUBM10.db', 'data/LUBM_10.n3') + gc.build('LUBM10', 'data/LUBM_10.n3') // then you can execute SPARQL query on this database. $sparql = "select ?x where " + "{" + "?x . " + @@ -1042,9 +1044,9 @@ GstoreConnector.php should be called like below: "}"; answer = gc.query(sparql) //unload this database. - gc.unload('LUBM10.db') + gc.unload('LUBM10') //also, you can load some exist database directly and then query. - gc.load('LUBM10.db')// query a SPARQL in current database + gc.load('LUBM10')// query a SPARQL in current database answer = gc.query(sparql) \end{verbatim} @@ -1179,7 +1181,7 @@ GstoreConnector.php should be called like below:
+ type="text" maxlength="255" value="dbpedia_2014_reduce">
diff --git a/docs/latex/gStore_help_CN.pdf b/docs/latex/gStore_help_CN.pdf index 073b60d..312b026 100644 Binary files a/docs/latex/gStore_help_CN.pdf and b/docs/latex/gStore_help_CN.pdf differ diff --git a/docs/latex/gStore_help_CN.tex b/docs/latex/gStore_help_CN.tex index ee6ee46..22db197 100644 --- a/docs/latex/gStore_help_CN.tex +++ b/docs/latex/gStore_help_CN.tex @@ -1,6 +1,4 @@ -%this is for the graduation paper -%RDF查询引擎优化研究 -%RDF Query Engine Optimization +%NOTICE: this tex file must be compiled with xelatex %Latex Help %http://www.tuicool.com/articles/FzY3Yz @@ -73,7 +71,7 @@ %set the font type %http://blog.csdn.net/plain_jane/article/details/6189524 %http://www.tuicool.com/articles/aqYZRz -\setCJKmainfont{AR PL UMing CN} +%\setCJKmainfont{AR PL UMing CN} \usepackage{cite} \usepackage{etoolbox} \usepackage{float} @@ -451,6 +449,8 @@ gStore的源代码遵循BSD开源协议。你可以使用gStore、报告建议 \hyperdef{}{chapter03}{\subsection{第03章:安装指南}\label{chapter03}} +用户应该详细阅读init.conf文件,并根据自己的实际情况修改它。(这个文件包含gStore系统的基本配置) + gStore是一个绿色软件,你只需要用一个指令对它进行编译。请在gStore根目录下运行\texttt{make}来编译gStore代码,连接ANTLR 库,并生成可执行的``gbuild''、``gquery''、``gserver''、``gclient''、``gconsole''。 另外,gStore的api也在此时生成。 如果你想使用gStore的API样例,请运行\texttt{make\ APIexample}编译C++ API和Java API的样例代码。关于API的更多细节,请参阅\hyperref[chapter05]{【API】}一章。 @@ -507,7 +507,7 @@ gstore>load lubm_10 database loaded successfully! gstore>show -lubm_10.db +lubm_10 gstore>query ./data/LUBM_q0.sql ... @@ -556,9 +556,9 @@ gbuild用于由RDF三元格式文件生成一个新的数据库。 例如,我们从example文件夹下的LUBM\_10.n3生成数据库。 \begin{verbatim} -[bookug@localhost gStore]$ bin/gbuild LUBM10.db ./data/LUBM_10.n3 +[bookug@localhost gStore]$ bin/gbuild LUBM10 ./data/LUBM_10.n3 gbuild... -argc: 3 DB_store:db_LUBM10 RDF_data: ./data/LUBM_10.n3 +argc: 3 DB_store:LUBM10 RDF_data: ./data/LUBM_10.n3 begin encode RDF from : ./data/LUBM_10.n3 ... \end{verbatim} @@ -583,9 +583,9 @@ gquery用包含SPARQL的文件查询一个已有的数据库(每个文件包 我们还是以LUBM\_10.n3为例。 \begin{verbatim} -[bookug@localhost gStore]$ bin/gquery LUBM10.db +[bookug@localhost gStore]$ bin/gquery LUBM10 gquery... -argc: 2 DB_store:db_LUBM10/ +argc: 2 DB_store:LUBM10/ loadTree... LRUCache initial... LRUCache initial finish @@ -667,9 +667,9 @@ load - load an existen database unload - unload an existen database sparql - load query from the second argument show - show the current database's name -gsql>import lubm.db data/LUBM_10.n3 +gsql>import lubm data/LUBM_10.n3 import RDF file to database done. -gsql>load lubm.db +gsql>load lubm load database done. gsql>sparql "select ?s ?o where { ?s ?o . }" [empty result] @@ -880,7 +880,7 @@ gStore的API在gStore根目录的api/目录下,内容如下: GstoreConnector gc("127.0.0.1", 3305); // 由一个RDF文件新建一个数据库 // 注意,文件地址是相对gserver的地址 -gc.build("LUBM10.db", "example/LUBM_10.n3"); +gc.build("LUBM10", "example/LUBM_10.n3"); // 然后你可以在这一数据库上执行SPARQL查询 std::string sparql = "select ?x where \ {\ @@ -894,9 +894,9 @@ std::string sparql = "select ?x where \ }"; std::string answer = gc.query(sparql); // 卸载这一数据库 -gc.unload("LUBM10.db"); +gc.unload("LUBM10"); // 你也可以直接加载已存在的数据库然后进行查询 -gc.load("LUBM10.db"); +gc.load("LUBM10"); // 在当前数据库查询SPARQL answer = gc.query(sparql); \end{verbatim} @@ -949,7 +949,7 @@ string query(string _sparql); GstoreConnector gc = new GstoreConnector("127.0.0.1", 3305); // 由一个RDF文件新建一个数据库 // 注意,文件地址是相对gserver的地址 -gc.build("LUBM10.db", "example/LUBM_10.n3"); +gc.build("LUBM10", "example/LUBM_10.n3"); // 然后你可以在这一数据库上执行SPARQL查询. String sparql = "select ?x where " + "{" + "?x . " + @@ -962,9 +962,9 @@ String sparql = "select ?x where " + "{" + "}"; String answer = gc.query(sparql); // 卸载这一数据库 -gc.unload("LUBM10.db"); +gc.unload("LUBM10"); // 你也可以直接加载已存在的数据库然后进行查询 -gc.load("LUBM10.db");// 在当前数据库查询SPARQL +gc.load("LUBM10");// 在当前数据库查询SPARQL answer = gc.query(sparql); \end{verbatim} @@ -1014,7 +1014,7 @@ string query(string _sparql); $gc = new Connector("127.0.0.1", 3305); // 由一个RDF文件新建一个数据库 // 注意,文件地址是相对gserver的地址 -$gc->build("LUBM10.db", "example/LUBM_10.n3"); +$gc->build("LUBM10", "example/LUBM_10.n3"); // 然后你可以在这一数据库上执行SPARQL查询 $sparql = "select ?x where " + "{" + "?x . " + @@ -1027,9 +1027,9 @@ $sparql = "select ?x where " + "{" + "}"; $answer = gc->query($sparql); // 卸载这一数据库 -$gc->unload("LUBM10.db"); +$gc->unload("LUBM10"); // 你也可以直接加载已存在的数据库然后进行查询 -$gc->load("LUBM10.db");// 在当前数据库查询SPARQL +$gc->load("LUBM10");// 在当前数据库查询SPARQL $answer = gc->query(sparql); \end{verbatim} @@ -1076,7 +1076,7 @@ gStore/api/php/PHPAPIExample展示了如何使用PHP API。PHP脚本不需要编 gc = GstoreConnector('127.0.0.1', 3305) // 由一个RDF文件新建一个数据库 // 注意,文件地址是相对gserver的地址 -gc.build('LUBM10.db', 'data/LUBM_10.n3') +gc.build('LUBM10', 'data/LUBM_10.n3') // 然后你可以在这一数据库上执行SPARQL查询 $sparql = "select ?x where " + "{" + "?x . " + @@ -1089,9 +1089,9 @@ $sparql = "select ?x where " + "{" + "}"; answer = gc.query(sparql) // 卸载这一数据库 -gc.unload('LUBM10.db') +gc.unload('LUBM10') // 你也可以直接加载已存在的数据库然后进行查询 -gc.load('LUBM10.db')// 在当前数据库查询sparql +gc.load('LUBM10')// 在当前数据库查询sparql answer = gc.query(sparql) \end{verbatim} @@ -1219,7 +1219,7 @@ switch ($format) {
+ type="text" maxlength="255" value="dbpedia_2014_reduce">
diff --git a/logs/.gitignore b/logs/.gitignore new file mode 100644 index 0000000..397b4a7 --- /dev/null +++ b/logs/.gitignore @@ -0,0 +1 @@ +*.log