We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在执行如下单元测试的时候,将查询不到任何数据信息,与返回的信息矛盾,期望的返回信息是应该包含部分三元组数据,如果不执行 updateRes 段落的 delete data ,则数据展示正常 。
@Test public void transaction() throws Exception { String transactionDBName = "transaction"; // 在服务端执行 cd /home/alexgaoyh; touch gStore-empty.nt 命令,生成一个空的文件,这样就可以进行 DB 创建 String dbPathInServer = "/home/alexgaoyh/gStore-empty.nt"; // 事务隔离级别,串行化 String isoLevel = "3"; GstoreConnector gc = new GstoreConnector(ip, port, httpType, username, password); // 先删除DB,再创建DB String dropDB = gc.drop(transactionDBName, false); System.out.println(dropDB); String buildDB = gc.build(transactionDBName, dbPathInServer); System.out.println(buildDB); // 使用当前 DB gc.load(transactionDBName, null, request_type_get); // 开启事务 String begin = gc.begin(transactionDBName, isoLevel, request_type_get); JSONObject beginJson = new JSONObject(begin); System.out.println(begin); if(beginJson.get("StatusCode").toString().equals("0")) { String tId = beginJson.get("TID").toString(); try { // 插入三元组数据 String insertRes = gc.tquery(transactionDBName, tId, "insert data { " + "<人物/#张三> <好友> <人物/#李四>." + "<人物/#张三> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <人物>." + "<人物/#李四> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <人物>." + "<人物/#张三> <性别> \"男\"^^<http://www.w3.org/2001/XMLSchema#String>.\n" + "<人物/#张三> <年龄> \"28\"^^<http://www.w3.org/2001/XMLSchema#Int>.\n" + "}", request_type_get); System.out.println(insertRes); String insert2Res = gc.tquery(transactionDBName, tId, "insert data {\n" + " <人物/#张三> <性别> \"女\"^^<http://www.w3.org/2001/XMLSchema#String>.\n" + "}", request_type_get); System.out.println(insert2Res); String updateRes = gc.tquery(transactionDBName, tId, "delete data {\n" + "<人物/#张三> <性别> \"男\"^^<http://www.w3.org/2001/XMLSchema#String>." + "}", request_type_get); System.out.println(updateRes); String commit = gc.commit(transactionDBName, tId); System.out.println(commit); } catch (Exception e) { String rollback = gc.rollback(transactionDBName, tId); System.out.println(rollback); } } String checkpoint = gc.checkpoint(transactionDBName); System.out.println(checkpoint); String res = gc.query(transactionDBName, format_json, SPARQL_SELECT_ALL, request_type_get); System.out.println(res); }
{"StatusCode":0,"StatusMsg":"Database transaction dropped."} {"StatusCode":0,"StatusMsg":"Import RDF file to database done.","failed_num":0} {"StatusCode":0,"StatusMsg":"transaction begin success","TID":"1"} {"StatusCode":0,"StatusMsg":"Transaction query success, update num: 5"} {"StatusCode":0,"StatusMsg":"Transaction query success, update num: 1"} {"StatusCode":0,"StatusMsg":"Transaction query success, update num: 1"} {"StatusCode":0,"StatusMsg":"Transaction commit success. TID: 1"} {"StatusCode":0,"StatusMsg":"Database saved successfully."} {"head":{"link":[],"vars":["s","p","o"]},"results":{"bindings":[]},"StatusCode":0,"StatusMsg":"success","AnsNum":0,"OutputLimit":-1,"ThreadId":"133564641310272","QueryTime":"1"}
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
No branches or pull requests
在执行如下单元测试的时候,将查询不到任何数据信息,与返回的信息矛盾,期望的返回信息是应该包含部分三元组数据,如果不执行 updateRes 段落的 delete data ,则数据展示正常 。
The text was updated successfully, but these errors were encountered: