Can't call Neocons spatial commands within a transaction

52 views
Skip to first unread message

Zubair Quraishi

unread,
Nov 7, 2013, 2:24:41 AM11/7/13
to clojur...@googlegroups.com
I have been using Neocons from Neo4j 1.9, but recently moved to Neo4j 2.0, which makes transactions mandatory. However, I can't figure out how to put the Neocons Spatial commands inside a transaction. Can anyone help?

Rohit Aggarwal

unread,
Nov 7, 2013, 1:19:58 PM11/7/13
to clojur...@googlegroups.com
Actually transactions aren't mandatory. They are only required if you want transactional support. 

The big requirement for transactional support in Neo4j is that all the work needs to be done through cypher. It uses cypher exclusively. From the docs:

"The Neo4j transactional HTTP endpoint allows you to execute a series of Cypher statements within the scope of a transaction."

I don't know much Neocons spatial namespace. But I can see that it uses Neo4j spatial API but they are not cypher statements.

If you can transform your work to cypher statements, you should be good to go. I don't know much about spatial support for cypher. But thats something for the neo4j team.

Hope this helps.

Zubair Quraishi

unread,
Nov 9, 2013, 3:57:54 AM11/9/13
to clojur...@googlegroups.com
Ok, that makes sense. So how can I make transaction non-mandatory in Neo4j 2.0 then?

Rohit Aggarwal

unread,
Nov 10, 2013, 8:19:15 AM11/10/13
to clojur...@googlegroups.com
The transaction API is in addition to the existing APIs and all the APIs which work in neocons 1.9 would continue to work in neocons 2.0 as-is without any change. So if you don't want to use transactions and you have any code in neocons 1.9, you needn't change anything in your code as the API is the same. .

Does this clarify your question?

Michael Klishin

unread,
Nov 10, 2013, 9:17:03 AM11/10/13
to clojur...@googlegroups.com

2013/11/10 Rohit Aggarwal <rohit.a...@gmail.com>

The transaction API is in addition to the existing APIs and all the APIs which work in neocons 1.9 would continue to work in neocons 2.0 as-is without any change. So if you don't want to use transactions and you have any code in neocons 1.9, you needn't change anything in your code as the API is the same. .

Minor correction: in Neocons 1.1 with Neo4J 1.9.

Zubair Quraishi

unread,
Nov 11, 2013, 2:14:05 AM11/11/13
to clojur...@googlegroups.com
Could you send me an example from Neo4j 1.9 Spatial that works with Neo4j 2.0 Spatial, as every piece of code I had for Neo4j 1.9 Spatial now returns NotInTransactionException in Neo4j 2.0? Just a few lines of the Clojure Neocons code is all I need, and then I can merge it into the rest of my code base. The code that doesn't work in Neo4j 2.0 is here:


: the find-within-distance function for example

Michael Klishin

unread,
Nov 11, 2013, 3:44:09 AM11/11/13
to clojur...@googlegroups.com

2013/11/11 Zubair Quraishi <zub...@gmail.com>

Could you send me an example from Neo4j 1.9 Spatial that works with Neo4j 2.0 Spatial, as every piece of code I had for Neo4j 1.9 Spatial now returns NotInTransactionException in Neo4j 2.0?

I'm not sure there are any open source examples. Please contact
the person who contributed support for the Spatial plugin.

Rohit Aggarwal

unread,
Nov 11, 2013, 4:56:35 AM11/11/13
to clojur...@googlegroups.com
Zubair,
I tried to do some basic debugging on your issue but before I began, I noticed some inconsistencies in the URI endpoints.

In Neo4j 2.0.0M6 (with the SpatialPlugin installed), all the exposed URIs are here:


But in your webapp.framework.server.neo4j-helper namespace, method 'post-spatial' (which is the core helper method) refers to a non existing URI.

Rohit Aggarwal

unread,
Nov 11, 2013, 4:59:47 AM11/11/13
to clojur...@googlegroups.com
Ignore my earlier post. I made a mistake. your URI does seem to be correct.

Rohit Aggarwal

unread,
Nov 11, 2013, 5:14:35 AM11/11/13
to clojur...@googlegroups.com
Zubair,
The error is most likely in the spatial plugin and not neocons.

I tried the following code in REPL:

and I got the error you were mentioning:

Hope this helps.


On Monday, 11 November 2013 09:56:35 UTC, Rohit Aggarwal wrote:

Zubair Quraishi

unread,
Nov 12, 2013, 10:18:56 AM11/12/13
to clojur...@googlegroups.com
Hi Rohit,

 Yes, the error you posted in:


: is the same error I was getting, so I can confirm we are both having the same problem. So does this mean that the a fix is needed in Neo4j 2.0 Spatial or with Neocons? Or both?

Thanks
Zubair

Rohit Aggarwal

unread,
Nov 12, 2013, 10:48:56 AM11/12/13
to clojur...@googlegroups.com
Zubair,
I am very sure the error was due to the spatial plugin version mismatch. Michael Hunger put a new jar for the plugin here yesterday. 

Using that I get this new error:


But this is due to the fact that I have no data in my database. I am no longer getting the "NotInTransactionException".

This should hopefully solve your problem.

Michael Klishin

unread,
Nov 12, 2013, 11:49:30 AM11/12/13
to clojur...@googlegroups.com
2013/11/12 Rohit Aggarwal <rohit.a...@gmail.com>

I am very sure the error was due to the spatial plugin version mismatch.

Yup. Plugins may need an update to work with new releases, especially major
ones such as 2.0. There is nothing Neocons-specific about that.

Please ask on the Neo4J mailing list.

Zubair Quraishi

unread,
Nov 13, 2013, 4:26:47 AM11/13/13
to clojur...@googlegroups.com
Ok, thanks. Looks like this is definitely a problem with the Spatial Plugin then. Thanks ! :)

Rohit Aggarwal

unread,
Nov 13, 2013, 4:50:29 AM11/13/13
to clojur...@googlegroups.com
Zubair,
If you find any issues with the neocons' implementation of any of the core APIs, do raise that as an issue on github. 

When I was trying to debug the issue, I even started to use Advanced REST client (an extension for chrome) just to figure out if the issue was with neocons or the plugin.

cheers 

Zubair Quraishi

unread,
Nov 14, 2013, 1:38:11 AM11/14/13
to clojur...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages