update the docs; fix bugs in gconsole and api

This commit is contained in:
bookug 2017-03-26 23:21:56 +08:00
parent deabdf293f
commit 84dbb166c3
14 changed files with 88 additions and 73 deletions

View File

@ -815,6 +815,7 @@ int show_handler(const vector<string>& args)
//native mode //native mode
if (flag) { if (flag) {
//showing all avaliable databases
string database = Util::getItemsFromDir(db_home); string database = Util::getItemsFromDir(db_home);
if (database.empty()) { if (database.empty()) {
database = "No databases."; database = "No databases.";
@ -823,6 +824,7 @@ int show_handler(const vector<string>& args)
return 0; return 0;
} }
//below is to show current using database
if (current_database == NULL) { if (current_database == NULL) {
cout << "No database used now." << endl; cout << "No database used now." << endl;
} }
@ -847,7 +849,9 @@ int build_handler(const vector<string>& args) {
cerr << "Your db name to be built should not end with \".db\"." << endl; cerr << "Your db name to be built should not end with \".db\"." << endl;
return -1; 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 //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 //we can deal with it in Database
@ -949,7 +953,9 @@ int load_handler(const vector<string>& args) {
cerr << "You should use exactly the same db name as building, which should not end with \".db\"" << endl; cerr << "You should use exactly the same db name as building, which should not end with \".db\"" << endl;
return -1; return -1;
} }
database += ".db";
//NOTICE: not add .db here, better to use db_suffix
//database += ".db";
//remote mode //remote mode
if (gc != NULL) { if (gc != NULL) {

View File

@ -7,8 +7,6 @@
在使用gserver时不能在数据库没有unload时再用gbuild或其他命令修改数据库仅限于C/S模式 在使用gserver时不能在数据库没有unload时再用gbuild或其他命令修改数据库仅限于C/S模式
将IRC聊天放到gstore文档上freenode #gStore 将IRC聊天放到gstore文档上freenode #gStore
# 推广
必须建立一个官方网站可以展示下团队、demo需要建立社区/论坛并维护 必须建立一个官方网站可以展示下团队、demo需要建立社区/论坛并维护
另外要有桌面应用或者网页应用以可视化的方式操作数据库类似virtuoso和neo4j那种 另外要有桌面应用或者网页应用以可视化的方式操作数据库类似virtuoso和neo4j那种
server 118.89.115.42 gstore-pku.com server 118.89.115.42 gstore-pku.com
@ -18,11 +16,6 @@ server 118.89.115.42 gstore-pku.com
gstore网站中的demo应用的主体可以放在实验室主机上至少是gstore数据库应抽离出来但若实验室主机不开外网应如何而配置代理 gstore网站中的demo应用的主体可以放在实验室主机上至少是gstore数据库应抽离出来但若实验室主机不开外网应如何而配置代理
demo应用全部外链具体服务放在实验室公开的主机上通过ip:port连接 demo应用全部外链具体服务放在实验室公开的主机上通过ip:port连接
方正
微生物所
社交网络(正在让北师那个学生在做)
DBpeida数据集上SPARQL查询接口
--- ---
# 并行策略- 线程控制模块 # 并行策略- 线程控制模块
@ -142,6 +135,10 @@ join_two里面可以分块并行但不能用太多线程在末尾添加新
gstore后续需要开发的地方 gstore后续需要开发的地方
事务操作最小粒度是一个sparql/BGP一个事务要支持workload(多个查询)为一个事务 最终一致性加锁就行了,顺序一致性则要考虑各种先后关系回滚等等,多版本两阶段锁协议 事务操作最小粒度是一个sparql/BGP一个事务要支持workload(多个查询)为一个事务 最终一致性加锁就行了,顺序一致性则要考虑各种先后关系回滚等等,多版本两阶段锁协议
多领域多库解决方案。 多领域多库解决方案。
owl文件如何定义一个范式转换规则变成高效可用的RDF格式
select from和select graph有何不同考虑支持N-quad格式第四列是一个graph label说明这条边属于哪个graph
是否可以直接分成多个数据库来处理,各个数据库之间无边相连,同一查询可能包含多个数据库,比如比较字面值等等,类似关系数据库的表拼接。
(这样的话查询就不仅属于一个数据库那么应该新建Application层并把GeneralEvaluation上升到Application层中)
任务分配: 任务分配:
--- ---

View File

@ -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).** **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).**
<!--**You can write your information in [survey](http://59.108.48.38/survey) if you like.**-->
## Getting Started ## Getting Started

View File

@ -808,12 +808,15 @@ Util::getItemsFromDir(string _path)
{ {
continue; continue;
} }
//BETTER: change to use db_suffix instead
if(name.substr(len-3, 3) == ".db") if(name.substr(len-3, 3) == ".db")
{ {
string tmp = name.substr(0, len-3);
if(ret == "") if(ret == "")
ret = name; ret = tmp;
else else
ret = ret + " " + name; ret = ret + " " + tmp;
} }
} }
closedir(dp); closedir(dp);

View File

@ -18,8 +18,8 @@ int main(int argc, char * argv[])
// build a new database by a RDF file. // build a new database by a RDF file.
// note that the relative path is related to gserver. // note that the relative path is related to gserver.
gc.build("LUBM10.db", "data/LUBM_10.n3"); gc.build("LUBM10", "data/LUBM_10.n3");
gc.load("LUBM10.db"); gc.load("LUBM10");
// then you can execute SPARQL query on this database. // then you can execute SPARQL query on this database.
std::string sparql = "select ?x where \ std::string sparql = "select ?x where \
@ -36,12 +36,13 @@ int main(int argc, char * argv[])
std::cout << answer << std::endl; std::cout << answer << std::endl;
// unload this database. // unload this database.
gc.unload("LUBM10.db"); gc.unload("LUBM10");
// also, you can load some exist database directly and then query. // also, you can load some exist database directly and then query.
gc.load("LUBM10.db"); gc.load("LUBM10");
answer = gc.query(sparql); answer = gc.query(sparql);
std::cout << answer << std::endl; std::cout << answer << std::endl;
gc.unload("LUBM10");
return 0; return 0;
} }

View File

@ -17,8 +17,8 @@ public class JavaAPIExample
// build a new database by a RDF file. // build a new database by a RDF file.
// note that the relative path is related to gserver. // note that the relative path is related to gserver.
gc.build("LUBM10.db", "data/LUBM_10.n3"); gc.build("LUBM10", "data/LUBM_10.n3");
gc.load("LUBM10.db"); gc.load("LUBM10");
// then you can execute SPARQL query on this database. // then you can execute SPARQL query on this database.
String sparql = "select ?x where " String sparql = "select ?x where "
@ -35,12 +35,13 @@ public class JavaAPIExample
System.out.println(answer); System.out.println(answer);
// unload this database. // unload this database.
gc.unload("LUBM10.db"); gc.unload("LUBM10");
// also, you can load some exist database directly and then query. // also, you can load some exist database directly and then query.
gc.load("LUBM10.db"); gc.load("LUBM10");
answer = gc.query(sparql); answer = gc.query(sparql);
System.out.println(answer); System.out.println(answer);
gc.unload("LUBM10");
} }
} }

View File

@ -2,7 +2,7 @@
require 'GstoreConnector.php'; require 'GstoreConnector.php';
$host = '127.0.0.1'; $host = '127.0.0.1';
$port = 3305; $port = 3305;
$dbname = "LUBM10.db"; $dbname = "LUBM10";
$dbpath = "./data/LUBM_10.n3"; $dbpath = "./data/LUBM_10.n3";
$query1 = "select ?x where $query1 = "select ?x where
{ {
@ -15,5 +15,6 @@ $load->load($dbname);
$query = new Connector($host,$port); $query = new Connector($host,$port);
$result = $query->query($query1); $result = $query->query($query1);
echo $result; echo $result;
$load->unload($dbname);
?> ?>

View File

@ -8,8 +8,8 @@ from GstoreConnector import GstoreConnector
if __name__ == '__main__': if __name__ == '__main__':
gc = GstoreConnector('127.0.0.1', 3305) gc = GstoreConnector('127.0.0.1', 3305)
gc.build('LUBM10.db', 'data/LUBM_10.n3') gc.build('LUBM10', 'data/LUBM_10.n3')
gc.load('LUBM10.db') gc.load('LUBM10')
sparql = '''select ?x where { sparql = '''select ?x where {
?x <rdf:type> <ub:UndergraduateStudent>. ?x <rdf:type> <ub:UndergraduateStudent>.
@ -23,7 +23,8 @@ if __name__ == '__main__':
answer = gc.query(sparql) answer = gc.query(sparql)
print answer print answer
gc.unload('LUBM10.db') gc.unload('LUBM10')
gc.load('LUBM10.db') gc.load('LUBM10')
answer = gc.query(sparql) answer = gc.query(sparql)
print answer print answer
gc.unload('LUBM10')

View File

@ -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. 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 2015年05月21日 星期四 20时58分21秒 -0.484698 seconds
gbuild... 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 ... 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. We also take LUBM_10.n3 as an example.
[bookug@localhost gStore]$ bin/gquery LUBM10.db [bookug@localhost gStore]$ bin/gquery LUBM10
gquery... gquery...
argc: 2 DB_store:db_LUBM10/ argc: 2 DB_store:LUBM10/
loadTree... loadTree...
LRUCache initial... LRUCache initial...
LRUCache initial finish LRUCache initial finish

Binary file not shown.

View File

@ -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}} \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. 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. 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! database loaded successfully!
gstore>show gstore>show
lubm_10.db lubm_10
gstore>query ./data/LUBM_q0.sql 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. example folder.
\begin{verbatim} \begin{verbatim}
[bookug@localhost gStore]$ bin/gbuild LUBM10.db ./data/LUBM_10.n3 [bookug@localhost gStore]$ bin/gbuild LUBM10 ./data/LUBM_10.n3
gbuild... 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 ... begin encode RDF from : ./data/LUBM_10.n3 ...
\end{verbatim} \end{verbatim}
@ -457,9 +459,9 @@ predicates) now.}
We also take LUBM\_10.n3 as an example. We also take LUBM\_10.n3 as an example.
\begin{verbatim} \begin{verbatim}
[bookug@localhost gStore]$ bin/gquery LUBM10.db [bookug@localhost gStore]$ bin/gquery LUBM10
gquery... gquery...
argc: 2 DB_store:db_LUBM10/ argc: 2 DB_store:LUBM10/
loadTree... loadTree...
LRUCache initial... LRUCache initial...
LRUCache initial finish LRUCache initial finish
@ -547,9 +549,9 @@ load - load an existen database
unload - unload an existen database unload - unload an existen database
sparql - load query from the second argument sparql - load query from the second argument
show - show the current database's name 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. import RDF file to database done.
gsql>load lubm.db gsql>load lubm
load database done. load database done.
gsql>sparql "select ?s ?o where { ?s <rdf:type> ?o . }" gsql>sparql "select ?s ?o where { ?s <rdf:type> ?o . }"
[empty result] [empty result]
@ -820,7 +822,7 @@ GstoreConnector.h should be called like below:
GstoreConnector gc("127.0.0.1", 3305); GstoreConnector gc("127.0.0.1", 3305);
// build a new database by a RDF file. // build a new database by a RDF file.
// note that the relative path is related to gserver. // 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. // then you can execute SPARQL query on this database.
std::string sparql = "select ?x where \ std::string sparql = "select ?x where \
{\ {\
@ -834,9 +836,9 @@ std::string sparql = "select ?x where \
}"; }";
std::string answer = gc.query(sparql); std::string answer = gc.query(sparql);
// unload this database. // unload this database.
gc.unload("LUBM10.db"); gc.unload("LUBM10");
// also, you can load some exist database directly and then query. // also, you can load some exist database directly and then query.
gc.load("LUBM10.db"); gc.load("LUBM10");
// query a SPARQL in current database // query a SPARQL in current database
answer = gc.query(sparql); answer = gc.query(sparql);
\end{verbatim} \end{verbatim}
@ -894,7 +896,7 @@ GstoreConnector.java should be called like below:
GstoreConnector gc = new GstoreConnector("127.0.0.1", 3305); GstoreConnector gc = new GstoreConnector("127.0.0.1", 3305);
// build a new database by a RDF file. // build a new database by a RDF file.
// note that the relative path is related to gserver. // 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. // then you can execute SPARQL query on this database.
String sparql = "select ?x where " + "{" + String sparql = "select ?x where " + "{" +
"?x <rdf:type> <ub:UndergraduateStudent>. " + "?x <rdf:type> <ub:UndergraduateStudent>. " +
@ -907,9 +909,9 @@ String sparql = "select ?x where " + "{" +
"}"; "}";
String answer = gc.query(sparql); String answer = gc.query(sparql);
//unload this database. //unload this database.
gc.unload("LUBM10.db"); gc.unload("LUBM10");
//also, you can load some exist database directly and then query. //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); answer = gc.query(sparql);
\end{verbatim} \end{verbatim}
@ -964,7 +966,7 @@ GstoreConnector.php should be called like below:
$gc = new Connector("127.0.0.1", 3305); $gc = new Connector("127.0.0.1", 3305);
// build a new database by a RDF file. // build a new database by a RDF file.
// note that the relative path is related to gserver. // 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. // then you can execute SPARQL query on this database.
$sparql = "select ?x where " + "{" + $sparql = "select ?x where " + "{" +
"?x <rdf:type> <ub:UndergraduateStudent>. " + "?x <rdf:type> <ub:UndergraduateStudent>. " +
@ -977,9 +979,9 @@ GstoreConnector.php should be called like below:
"}"; "}";
$answer = gc->query($sparql); $answer = gc->query($sparql);
//unload this database. //unload this database.
$gc->unload("LUBM10.db"); $gc->unload("LUBM10");
//also, you can load some exist database directly and then query. //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); $answer = gc->query(sparql);
\end{verbatim} \end{verbatim}
@ -1028,7 +1030,7 @@ GstoreConnector.php should be called like below:
gc = GstoreConnector('127.0.0.1', 3305) gc = GstoreConnector('127.0.0.1', 3305)
// build a new database by a RDF file. // build a new database by a RDF file.
// note that the relative path is related to gserver. // 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. // then you can execute SPARQL query on this database.
$sparql = "select ?x where " + "{" + $sparql = "select ?x where " + "{" +
"?x <rdf:type> <ub:UndergraduateStudent>. " + "?x <rdf:type> <ub:UndergraduateStudent>. " +
@ -1042,9 +1044,9 @@ GstoreConnector.php should be called like below:
"}"; "}";
answer = gc.query(sparql) answer = gc.query(sparql)
//unload this database. //unload this database.
gc.unload('LUBM10.db') gc.unload('LUBM10')
//also, you can load some exist database directly and then query. //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) answer = gc.query(sparql)
\end{verbatim} \end{verbatim}
@ -1179,7 +1181,7 @@ GstoreConnector.php should be called like below:
</label> </label>
<div> <div>
<input id="element_1" name="databasename" class="element text medium" <input id="element_1" name="databasename" class="element text medium"
type="text" maxlength="255" value="dbpedia_2014_reduce.db"> type="text" maxlength="255" value="dbpedia_2014_reduce">
</input> </input>
</div> </div>
</li> </li>

Binary file not shown.

View File

@ -1,6 +1,4 @@
%this is for the graduation paper %NOTICE: this tex file must be compiled with xelatex
%RDF查询引擎优化研究
%RDF Query Engine Optimization
%Latex Help %Latex Help
%http://www.tuicool.com/articles/FzY3Yz %http://www.tuicool.com/articles/FzY3Yz
@ -73,7 +71,7 @@
%set the font type %set the font type
%http://blog.csdn.net/plain_jane/article/details/6189524 %http://blog.csdn.net/plain_jane/article/details/6189524
%http://www.tuicool.com/articles/aqYZRz %http://www.tuicool.com/articles/aqYZRz
\setCJKmainfont{AR PL UMing CN} %\setCJKmainfont{AR PL UMing CN}
\usepackage{cite} \usepackage{cite}
\usepackage{etoolbox} \usepackage{etoolbox}
\usepackage{float} \usepackage{float}
@ -451,6 +449,8 @@ gStore的源代码遵循BSD开源协议。你可以使用gStore、报告建议
\hyperdef{}{chapter03}{\subsection{第03章安装指南}\label{chapter03}} \hyperdef{}{chapter03}{\subsection{第03章安装指南}\label{chapter03}}
用户应该详细阅读init.conf文件并根据自己的实际情况修改它。这个文件包含gStore系统的基本配置
gStore是一个绿色软件你只需要用一个指令对它进行编译。请在gStore根目录下运行\texttt{make}来编译gStore代码连接ANTLR 库,并生成可执行的``gbuild''、``gquery''、``gserver''、``gclient''、``gconsole''。 另外gStore的api也在此时生成。 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】}一章。 如果你想使用gStore的API样例请运行\texttt{make\ APIexample}编译C++ API和Java API的样例代码。关于API的更多细节请参阅\hyperref[chapter05]{【API】}一章。
@ -507,7 +507,7 @@ gstore>load lubm_10
database loaded successfully! database loaded successfully!
gstore>show gstore>show
lubm_10.db lubm_10
gstore>query ./data/LUBM_q0.sql gstore>query ./data/LUBM_q0.sql
... ...
@ -556,9 +556,9 @@ gbuild用于由RDF三元格式文件生成一个新的数据库。
例如我们从example文件夹下的LUBM\_10.n3生成数据库。 例如我们从example文件夹下的LUBM\_10.n3生成数据库。
\begin{verbatim} \begin{verbatim}
[bookug@localhost gStore]$ bin/gbuild LUBM10.db ./data/LUBM_10.n3 [bookug@localhost gStore]$ bin/gbuild LUBM10 ./data/LUBM_10.n3
gbuild... 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 ... begin encode RDF from : ./data/LUBM_10.n3 ...
\end{verbatim} \end{verbatim}
@ -583,9 +583,9 @@ gquery用包含SPARQL的文件查询一个已有的数据库每个文件包
我们还是以LUBM\_10.n3为例。 我们还是以LUBM\_10.n3为例。
\begin{verbatim} \begin{verbatim}
[bookug@localhost gStore]$ bin/gquery LUBM10.db [bookug@localhost gStore]$ bin/gquery LUBM10
gquery... gquery...
argc: 2 DB_store:db_LUBM10/ argc: 2 DB_store:LUBM10/
loadTree... loadTree...
LRUCache initial... LRUCache initial...
LRUCache initial finish LRUCache initial finish
@ -667,9 +667,9 @@ load - load an existen database
unload - unload an existen database unload - unload an existen database
sparql - load query from the second argument sparql - load query from the second argument
show - show the current database's name 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. import RDF file to database done.
gsql>load lubm.db gsql>load lubm
load database done. load database done.
gsql>sparql "select ?s ?o where { ?s <rdf:type> ?o . }" gsql>sparql "select ?s ?o where { ?s <rdf:type> ?o . }"
[empty result] [empty result]
@ -880,7 +880,7 @@ gStore的API在gStore根目录的api/目录下,内容如下:
GstoreConnector gc("127.0.0.1", 3305); GstoreConnector gc("127.0.0.1", 3305);
// 由一个RDF文件新建一个数据库 // 由一个RDF文件新建一个数据库
// 注意文件地址是相对gserver的地址 // 注意文件地址是相对gserver的地址
gc.build("LUBM10.db", "example/LUBM_10.n3"); gc.build("LUBM10", "example/LUBM_10.n3");
// 然后你可以在这一数据库上执行SPARQL查询 // 然后你可以在这一数据库上执行SPARQL查询
std::string sparql = "select ?x where \ std::string sparql = "select ?x where \
{\ {\
@ -894,9 +894,9 @@ std::string sparql = "select ?x where \
}"; }";
std::string answer = gc.query(sparql); std::string answer = gc.query(sparql);
// 卸载这一数据库 // 卸载这一数据库
gc.unload("LUBM10.db"); gc.unload("LUBM10");
// 你也可以直接加载已存在的数据库然后进行查询 // 你也可以直接加载已存在的数据库然后进行查询
gc.load("LUBM10.db"); gc.load("LUBM10");
// 在当前数据库查询SPARQL // 在当前数据库查询SPARQL
answer = gc.query(sparql); answer = gc.query(sparql);
\end{verbatim} \end{verbatim}
@ -949,7 +949,7 @@ string query(string _sparql);
GstoreConnector gc = new GstoreConnector("127.0.0.1", 3305); GstoreConnector gc = new GstoreConnector("127.0.0.1", 3305);
// 由一个RDF文件新建一个数据库 // 由一个RDF文件新建一个数据库
// 注意文件地址是相对gserver的地址 // 注意文件地址是相对gserver的地址
gc.build("LUBM10.db", "example/LUBM_10.n3"); gc.build("LUBM10", "example/LUBM_10.n3");
// 然后你可以在这一数据库上执行SPARQL查询. // 然后你可以在这一数据库上执行SPARQL查询.
String sparql = "select ?x where " + "{" + String sparql = "select ?x where " + "{" +
"?x <rdf:type> <ub:UndergraduateStudent>. " + "?x <rdf:type> <ub:UndergraduateStudent>. " +
@ -962,9 +962,9 @@ String sparql = "select ?x where " + "{" +
"}"; "}";
String answer = gc.query(sparql); 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); answer = gc.query(sparql);
\end{verbatim} \end{verbatim}
@ -1014,7 +1014,7 @@ string query(string _sparql);
$gc = new Connector("127.0.0.1", 3305); $gc = new Connector("127.0.0.1", 3305);
// 由一个RDF文件新建一个数据库 // 由一个RDF文件新建一个数据库
// 注意文件地址是相对gserver的地址 // 注意文件地址是相对gserver的地址
$gc->build("LUBM10.db", "example/LUBM_10.n3"); $gc->build("LUBM10", "example/LUBM_10.n3");
// 然后你可以在这一数据库上执行SPARQL查询 // 然后你可以在这一数据库上执行SPARQL查询
$sparql = "select ?x where " + "{" + $sparql = "select ?x where " + "{" +
"?x <rdf:type> <ub:UndergraduateStudent>. " + "?x <rdf:type> <ub:UndergraduateStudent>. " +
@ -1027,9 +1027,9 @@ $sparql = "select ?x where " + "{" +
"}"; "}";
$answer = gc->query($sparql); $answer = gc->query($sparql);
// 卸载这一数据库 // 卸载这一数据库
$gc->unload("LUBM10.db"); $gc->unload("LUBM10");
// 你也可以直接加载已存在的数据库然后进行查询 // 你也可以直接加载已存在的数据库然后进行查询
$gc->load("LUBM10.db");// 在当前数据库查询SPARQL $gc->load("LUBM10");// 在当前数据库查询SPARQL
$answer = gc->query(sparql); $answer = gc->query(sparql);
\end{verbatim} \end{verbatim}
@ -1076,7 +1076,7 @@ gStore/api/php/PHPAPIExample展示了如何使用PHP API。PHP脚本不需要编
gc = GstoreConnector('127.0.0.1', 3305) gc = GstoreConnector('127.0.0.1', 3305)
// 由一个RDF文件新建一个数据库 // 由一个RDF文件新建一个数据库
// 注意文件地址是相对gserver的地址 // 注意文件地址是相对gserver的地址
gc.build('LUBM10.db', 'data/LUBM_10.n3') gc.build('LUBM10', 'data/LUBM_10.n3')
// 然后你可以在这一数据库上执行SPARQL查询 // 然后你可以在这一数据库上执行SPARQL查询
$sparql = "select ?x where " + "{" + $sparql = "select ?x where " + "{" +
"?x <rdf:type> <ub:UndergraduateStudent>. " + "?x <rdf:type> <ub:UndergraduateStudent>. " +
@ -1089,9 +1089,9 @@ $sparql = "select ?x where " + "{" +
"}"; "}";
answer = gc.query(sparql) answer = gc.query(sparql)
// 卸载这一数据库 // 卸载这一数据库
gc.unload('LUBM10.db') gc.unload('LUBM10')
// 你也可以直接加载已存在的数据库然后进行查询 // 你也可以直接加载已存在的数据库然后进行查询
gc.load('LUBM10.db')// 在当前数据库查询sparql gc.load('LUBM10')// 在当前数据库查询sparql
answer = gc.query(sparql) answer = gc.query(sparql)
\end{verbatim} \end{verbatim}
@ -1219,7 +1219,7 @@ switch ($format) {
</label> </label>
<div> <div>
<input id="element_1" name="databasename" class="element text medium" <input id="element_1" name="databasename" class="element text medium"
type="text" maxlength="255" value="dbpedia_2014_reduce.db"> type="text" maxlength="255" value="dbpedia_2014_reduce">
</input> </input>
</div> </div>
</li> </li>

1
logs/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.log