简体   繁体   English

在Neo4J编程中使用Java将字符串结果转换为ExecutionResult

[英]String result to ExecutionResult using java in Neo4J programming

In my application, for Neo4j db, Team is using standalone instead of server. 在我的应用程序中,对于Neo4j db,Team使用的是独立服务器,而不是服务器。 But team is provided with one jsp to view results in string format. 但是为团队提供了一个jsp来以字符串格式查看结果。

In JSP page, we are having one form to write the cypher query in textarea, and having button to fire the request to server. 在JSP页面中,我们采用一种形式在textarea中编写密码查询,并具有将请求激发到服务器的按钮。 after firing the request to server, test result will be printed in web page in the form of String. 向服务器发出请求后,测试结果将以String形式打印在网页中。

Here, We need a kind of mechanism to convert printed string in web page to neo4j "ExecutionResult" Object. 在这里,我们需要一种机制来将网页中的打印字符串转换为neo4j“ ExecutionResult”对象。

Can some one provide the code snippet for conversion? 有人可以提供要转换的代码段吗?

You could simply send a JSON request from your web page back to the server, something like 您可以简单地将JSON请求从您的网页发送回服务器,例如

$(document).ready(function() {
  $("#log").append($("#query").html());
})

http://jsfiddle.net/peterneubauer/WnPYp/ to grab the HTML element and send it with an AJAX request to the server? http://jsfiddle.net/peterneubauer/WnPYp/来获取HTML元素并将其与AJAX请求一起发送到服务器?

There is no reverse way, you would have to write a parser yourself. 没有相反的方法,您必须自己编写一个解析器。

But you could have the client not only have a textual result but at the same time a richer JSON result and/or a link to post that json to your site. 但是,您不仅可以让客户端获得文本结果,而且还可以拥有更丰富的JSON结果和/或将该JSON发布到您的站点的链接。

For some ideas look at the code for http://console.neo4j.org which is at http://github.com/neo4j-contrib/rabbithole 对于某些想法,请查看http://console.neo4j.org的代码,该代码位于http://github.com/neo4j-contrib/rabbithole

It converts the ExecutionResult into JSON and renders it as a jquery datatable in the client. 它将ExecutionResult转换为JSON,并将其呈现为客户端中的jquery数据表。 And also has an additional popup (query details) for detailed data. 并且还有一个用于显示详细数据的附加弹出窗口(查询详细信息)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM