node.js - How to abort query on demand using Neo4j drivers -


i making search engine application using node.js , neo4j allows users submit graph traversal query via web-based user interface. want give users option cancel query after has been submitted (i.e. if user decides change query parameters). thus, need way abort query using either command node.js-to-neo4j driver or via cypher query.

after few hours of searching, haven't been able find way using of node.js-to-neo4j drivers. can't seem find cypher query allows killing of query. overlooking something, or not possible neo4j? using neo4j 2.0.4, willing upgrade newer version of neo4j if has query killing capabilities.

starting neo4j version 2.2.0, it's possible kill queries ui , via rest interface. don't know if existing nodejs drivers support feature, if not can still achieve same functionality making http request rest interface.

if run query in browser in version 2.2.x or later, notice there (x) close link @ top-right corner of area queries executed , displayed.

you can achieve same results wrapping queries in transactions , rolling them back. in fact, opened web inspector see how browser ui canceling running queries.

i think recommended approach:

  1. begin transaction cypher query want run. transaction assigned identifier, i.e. request post http://localhost:7474/db/data/transaction , response location: http://localhost:7474/db/data/transaction/7
  2. if want cancel query, delete transaction using identifier got in step 1, i.e. delete http://localhost:7474/db/data/transaction/7

you find more info transactional cypher http endpoint , examples in official docs.

update: node-neo4j seems support transaction handling, including rollback. see docs.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -