Re: [Neo4j] Using EmbeddedGraphDatabase in Tomcat
Victor and Stephane, Thanks for your ideas, I'll let you know how it goes. I may also try a Spring solution since I'd like to understand Spring MVC better. Kalin * ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] neo4j.py: STOP_AT_DEPTH_ONE undefined
Hi Peter, If you scan farther down in the neo4j.py documentation at http://components.neo4j.org/neo4j.py/ in the Traversal section, there is the following. stop Definition of when the traversal should stop. Valid values are STOP_AT_DEPTH_ONE and STOP_AT_END_OF_GRAPH Alternatively the traversal class may define a more advanced stop predicate in the form of a method called 'isStopNode'.which suggests STOP_AT_DEPTH_ONE is appropriate. I'll try the approach you suggested. Thanks! Chris Message: 2 > Date: Thu, 11 Nov 2010 01:18:38 +0100 > From: Peter Neubauer > Subject: Re: [Neo4j] neo4j: STOP_AT_DEPTH_ONE undefined > To: Neo4j user discussions > Message-ID: > > Content-Type: text/plain; charset=ISO-8859-1 > > Chris, > looking at the docs over at http://components.neo4j.org/neo4j.py/, it > seems you would do something like StopAtDepth(1) . > > Have not tested it, but indeed, there is no STOP_AT_DEPTH_ONE anywhere > in the source code ... > > Does that work better? > > Cheers, > > /peter neubauer > > GTalk:? ? ? neubauer.peter > Skype? ? ?? peter.neubauer > Phone? ? ?? +46 704 106975 > LinkedIn?? http://www.linkedin.com/in/neubauer > Twitter? ? ? http://twitter.com/peterneubauer > > http://www.neo4j.org? ? ? ? ? ? ?? - Your high performance graph database. > http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party. > > > > On Wed, Nov 10, 2010 at 8:58 PM, Chris Diehl wrote: > > Hi Peter, > > > > FYI, I just wrote a Python script to implement a simple traversal and got > > the following error when using STOP_AT_DEPTH_ONE as the stopping > criterion. > > > > Traceback (most recent call last): > > ?File "traversal_example.py", line 6, in > > ? ?class SentMessages(neo4j.Traversal): > > ?File "traversal_example.py", line 9, in SentMessages > > ? ?stop = neo4j.STOP_AT_DEPTH_ONE > > AttributeError: 'module' object has no attribute 'STOP_AT_DEPTH_ONE' > > > > If I switch to STOP_AT_END_OF_GRAPH, all is well. > > > > Here's a representative code snippet. A slight variation on the example > > shown on the neo4j.py webpage. > > > > from __future__ import with_statement > > import neo4j > > > > class Hackers(neo4j.Traversal): > > ? ?types = [ > > ? ? ? ?neo4j.Outgoing.knows, > > ? ? ? ?neo4j.Outgoing.coded_by, > > ? ? ? ?] > > ? ?order = neo4j.DEPTH_FIRST > > ? ?stop = neo4j.STOP_AT_DEPTH_ONE > > > > ? ?def isReturnable(self, position): > > ? ? ? ?return (not position.is_start > > ? ? ? ? ? ? ? ?and position.last_relationship.type == 'coded_by') > > > > Chris > > ___ > > Neo4j mailing list > > User@lists.neo4j.org > > https://lists.neo4j.org/mailman/listinfo/user > > > > > -- > > Message: 3 > Date: Wed, 10 Nov 2010 19:52:23 -0500 > From: "Wilson, Kalin" > Subject: [Neo4j] Using EmbeddedGraphDatabase in Tomcat > To: > Message-ID: > Content-Type: text/plain; charset="us-ascii" > > I am trying to learn Neo4J and prototype a simple web app using a simple > servlet/JSP approach (no Spring or other framework) in Tomcat. > > I have an instance of EmbeddedGraphDatabase that gets stored in a > ThreadLocal variable for use by other classes in a Singleton manner. > > This singleton variable gets initialized in a ServletContextListener and > shutdown() gets called in the listener's contextDestroyed() method. > > > > The first time the app is started the database is initialized properly > and everything seems OK. However, if I make code changes in a debugging > session and the changed files get hot deployed, subsequent database > accesses result in a lock exception. To recover I have to kill tomcat > and delete the database files. It doesn't seem that I'm calling > shutdown() at the right time to protect the database. > > > > I'm assuming that database access should be through some sort of > singleton, is this correct? I'm used to using a JPA EntityManager. > > > > Assuming I can't use Spring injection, etc, what is the recommended > pattern for managing the GraphDatabaseService instance in a web app? > > > > Any help is appreciated. > > Kalin > > > > -- > > Message: 4 > Date: Thu, 11 Nov 2010 01:13:26 -0200 > From: Victor Augusto de Campos > Subject: Re: [Neo4j] Using EmbeddedGraphDatabase in Tomcat > To: Neo4j user discussions > Message-ID: > > Content-Type: text/plain; charset=ISO-8859-1 > > Kalin, > I'm developing in a pretty similar case, except for that I'm not using > Spring and trying to not use the JEE stack at all (obviously the only > exception being Servlets :P). > > I do use a singleton and start in a static manner (not at > contextInitialized()) and added a shutdown() into contextDestroyed() and > it's all working fine, even hot deploying and etc, I've never experienced > it > to maintain a lock. > > I'd suggest you to try that approach and see if it works (and of course, to > give a feedback to any trouble you run into), it's working pretty well for > me, except for some time
[Neo4j] Neoclipse & Neo 1.2
Seems that opening a Neo 1.2 database with Neoclipse 0.41 (or attempting to, it didn't actually work) fails, but also somehow trashes the database. Anyone else experience this? ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] RemoteGraphDatabase
This is a known issue. RemoteGraphDatabase was built as a tool for being able to connect to a running Graph Database and introspect the live state of the database without down the application. The problem is in the RemoteGraphDatabase server that has issues with transaction handling under concurrent access. There are plans for fixing this issue, and also to work on making it possible to use RemoteGraphDatabase as an actual connector for implementing an application on (your use case). This will be done before the RemoteGraphDatabase component hits version 1.0, the current version is 0.7, but we have not decided on when this is going to be done though. Cheers, Tobias On Thu, Nov 11, 2010 at 2:33 PM, Anees Haider wrote: > > > Hi, > > > > When I run the code with org.neo4j.kernel.EmbeddedGraphDatabase along with > org.neo4j.index.lucene.LuceneIndexService, it always executes magnificently > without even a single warning, but when I execute the code with > org.neo4j.remote.RemoteGraphDatabase along with > org.neo4j.remote.RemoteIndexService, it hardly run 1%-5% correctly, else > 95%-99% it gives org.neo4j.graphdb.NotInTransactionException exception. > > > > Please help me out, I will be grateful to you. > > > > > > > > Thanks and regards, > > Anees Haider > > > > > > P.S. We have to move from embedded graph database to remote graph database > because we have modular architecture (a lot of modules) and each module > (separate process) has to make separate connection to the neo4j database. > > ___ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > -- Tobias Ivarsson Hacker, Neo Technology www.neotechnology.com Cellphone: +46 706 534857 ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
[Neo4j] RemoteGraphDatabase
Hi, When I run the code with org.neo4j.kernel.EmbeddedGraphDatabase along with org.neo4j.index.lucene.LuceneIndexService, it always executes magnificently without even a single warning, but when I execute the code with org.neo4j.remote.RemoteGraphDatabase along with org.neo4j.remote.RemoteIndexService, it hardly run 1%-5% correctly, else 95%-99% it gives org.neo4j.graphdb.NotInTransactionException exception. Please help me out, I will be grateful to you. Thanks and regards, Anees Haider P.S. We have to move from embedded graph database to remote graph database because we have modular architecture (a lot of modules) and each module (separate process) has to make separate connection to the neo4j database. ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] neo4j.py issue reading index
Chris, nice things are working out for you! The current plan is to give the Neo4j language bindings a fair bit of upgrade and love after neo4j 1.2 is released (planned december), unless someone steps up and does some work before that ;) Cheers, /peter neubauer GTalk: neubauer.peter Skype peter.neubauer Phone +46 704 106975 LinkedIn http://www.linkedin.com/in/neubauer Twitter http://twitter.com/peterneubauer http://www.neo4j.org - Your high performance graph database. http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party. On Wed, Nov 10, 2010 at 7:51 PM, Chris Diehl wrote: > Peter, > > That does indeed help, thanks! We will look forward to the next version of > the Python bindings. For now, this should get us started. > Any ETA on the next revision? > > Thanks again, > > Chris > > Message: 1 >> Date: Tue, 9 Nov 2010 18:14:22 +0100 >> From: Peter Neubauer >> Subject: Re: [Neo4j] neo4j.py issue reading index >> To: Neo4j user discussions >> Message-ID: >> >> Content-Type: text/plain; charset=ISO-8859-1 >> >> Chris, >> now that Tobias is on site again, I got the code to work, it looks >> like this now: >> >> from __future__ import with_statement >> import neo4j >> >> graphdb = neo4j.GraphDatabase("neodb/test") >> with graphdb.transaction: >> addIdx = graphdb.index("address",create=True) >> n = graphdb.node(color="Red", widht=16, height=32) >> addIdx[n['color']] = n >> >> graphdb.shutdown() >> graphdb = neo4j.GraphDatabase("neodb/test") >> with graphdb.transaction: >> addIdx = graphdb.index("address",create=True) >> >> >> Two points: >> >> 1. Indexes are created lazily, so unless you actually add something to >> it it will not be created, thus not being available on the next >> opening of the db. >> >> 2. addIdx = graphdb.index("address",create=True) is broken, so >> omitting the create=True breaks things. Always use it, will be >> rectified upon overhaul of the python bindings. >> >> Does this help? >> >> Cheers, >> >> /peter neubauer >> >> GTalk:? ? ? neubauer.peter >> Skype? ? ?? peter.neubauer >> Phone? ? ?? +46 704 106975 >> LinkedIn?? http://www.linkedin.com/in/neubauer >> Twitter? ? ? http://twitter.com/peterneubauer >> >> http://www.neo4j.org? ? ? ? ? ? ?? - Your high performance graph database. >> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party. >> >> > ___ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] [SPAM] Using EmbeddedGraphDatabase in Tomc at
We avoid hot deployment for a whole body of reasons...not just neo. - Reply message - From: "Wilson, Kalin" Date: Wed, Nov 10, 2010 7:52 pm Subject: [SPAM] [Neo4j] Using EmbeddedGraphDatabase in Tomcat To: I am trying to learn Neo4J and prototype a simple web app using a simple servlet/JSP approach (no Spring or other framework) in Tomcat. I have an instance of EmbeddedGraphDatabase that gets stored in a ThreadLocal variable for use by other classes in a Singleton manner. This singleton variable gets initialized in a ServletContextListener and shutdown() gets called in the listener's contextDestroyed() method. The first time the app is started the database is initialized properly and everything seems OK. However, if I make code changes in a debugging session and the changed files get hot deployed, subsequent database accesses result in a lock exception. To recover I have to kill tomcat and delete the database files. It doesn't seem that I'm calling shutdown() at the right time to protect the database. I'm assuming that database access should be through some sort of singleton, is this correct? I'm used to using a JPA EntityManager. Assuming I can't use Spring injection, etc, what is the recommended pattern for managing the GraphDatabaseService instance in a web app? Any help is appreciated. Kalin ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Using EmbeddedGraphDatabase in Tomcat
Wilson, Kalin wrote: > I am trying to learn Neo4J and prototype a simple web app using a simple > servlet/JSP approach (no Spring or other framework) in Tomcat. > > I have an instance of EmbeddedGraphDatabase that gets stored in a > ThreadLocal variable for use by other classes in a Singleton manner. > > This singleton variable gets initialized in a ServletContextListener and > shutdown() gets called in the listener's contextDestroyed() method. > > > > The first time the app is started the database is initialized properly > and everything seems OK. However, if I make code changes in a debugging > session and the changed files get hot deployed, subsequent database > accesses result in a lock exception. To recover I have to kill tomcat > and delete the database files. It doesn't seem that I'm calling > shutdown() at the right time to protect the database. > > > > I'm assuming that database access should be through some sort of > singleton, is this correct? I'm used to using a JPA EntityManager. > > > > Assuming I can't use Spring injection, etc, what is the recommended > pattern for managing the GraphDatabaseService instance in a web app? > > > > Any help is appreciated. > > Kalin > > ___ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > > Hi Kalin, You could use the graphdatabase service [add-on to the standard neo4j package] to start/stop your graph db. You can extend httpservlet and -start your graph db with the graphdatabase service on the init() method -stop your graph db with the graphdatabase service on the destroy() method When you start tomcat or start your web application via tomcat manager, the init() method will be called and will gracefully start your graph db. When you stop tomcat or stop your web application via tomcat manager, the destroy() method will be called and will gracefully stop your graph db. It works perfectly for me :) Cheers, Stephane Urdy ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user