我是查询的新手,我不知道我是否做得对:
String query = "{\"query\" : \"match (a:user)-[:LISTEN]->(b:user)-[:POSTED]-(p:message) where a.username='" + username
+ "' return p.message,p.timestamp,b.username union match (a:user)-[:POSTED]-(p:message) where a.username='"
+ username + "' return p.message, p.timestamp,a.username;\"}";
我希望此查询执行的操作是获取给定用户侦听的所有消息及其编写器。但是在发布时我得到了一个例外。但是,以下查询确实成功:
String query = "{\"query\" : \"match (a:user)-[:LISTEN]->(b:user)-[:POSTED]-(p:message) where a.username='" + username
+ "' return p.message,p.timestamp,a.username union match (a:user)-[:POSTED]-(p:message) where a.username='"
+ username + "' return p.message, p.timestamp,a.username;\"}";
获取b.username有什么问题?如果它存在,它肯定有一个。可能是什么原因?
编辑 - 例外:
Bad Request (400) - Bad Request
at org.restlet.resource.ClientResource.handle(ClientResource.java:858)
at org.restlet.resource.ClientResource.post(ClientResource.java:1197)
at org.restlet.resource.ClientResource.post(ClientResource.java:1143)
at serv.viewPosts.doGet(viewPosts.java:82)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)