Re: [Neo4j] Enhanced API rewrite
Niels, this sounds very interesting. Given the role of properties being unary edges, that would mean that any classic Neo4j property would now be a Node with one Property in the new Vertex sense? Having Vertices for EVERYTHING will of course make the node-implementation much more important than anything else, since every element is backed by a node, possibly with some property. I wonder how this would reflect in the storage layer that might need to be tweaked. Also, as you point out, traversals will become quite different with this API, but let's see an what the weekend brings ;) 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://startupbootcamp.org/ - Öresund - Innovation happens HERE. http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party. On Sat, Aug 6, 2011 at 2:51 AM, Niels Hoogeveen pd_aficion...@hotmail.com wrote: Today I pushed a major rewrite of the Enhanced API. See: https://github.com/peterneubauer/graph-collections/tree/master/src/main/java/org/neo4j/collections/graphdb Originally the Enhanced API was a drop-in replacement of the standard Neo4j API. This resulted in lots of wrapper classes that needed to be maintained. The rewrite of Enhanced API is no longer a drop-in replacement and contains no interface/class names that can be found in the standard API. Enhanced API no longer speaks of Nodes but of Vertices and doesn't speak of Relationships but of Edges. This helps to prevent name clashes at the expense of somewhat less recognizable names (Relationship is after all a more common word than Edge). This rewrite is not merely a renaming of classes and interfaces, but is in most part a complete rewrite and also a rethinking of the API on my part. Enhanced API consists of two basic elements: Vertex and EdgeRole. Most elements are a subclass of Vertex, though there are some specialized versions of EdgeRole. Let me start with an example: Suppose we have two vertices denoting the persons Tom and Paula, and we want to state that Tom is the father of Paula. For standard Neo4j we tend to write such a fact as: Tom --Father-- Paula For Enhanced API we can conceptually write this fact as follows: --StartRole--Tom Father --EndRole--Paula This should be read as follows: We have two Vertices: Tom and Paula and we have a BinaryEdge (similar to a Relationship in the standard API) of type Father, where Tom has the StartRole for that edge and Paula has the EndRole for that edge. So instead of a directed graph, we conceptually have an undirected bipartite graph. For binary edges (edges between two vertices), this is mostly conceptually the case, because the API will simply allow you to write: tom.createEdgeTo(paula, FATHER) (similar to tom.createRelationshipTo(paula, FATHER) as we would have in the standard API). It is also possible to fetch the start vertex of the binary relationship with the method: edge.getStartVertex() (similar to relationship.getStartNode()), although it is also possible to treat the binary edge as a generic edge and fetch that Vertex as: edge.getElement(db.getStartRole()). BinaryEdges, are a special case and have special methods which cover the same functionality as can be found in the standard Neo4j API. In general, we can say that Vertices are connected to Edges by means of EdgeRoles. In the binary case there are two predefined EdgeRoles: StartRole and EndRole. Before we get deeper into the general case of n-ary edges, let's first look at another special case: Properties. Properties can be thought of as unary edges, an edge that connects to only one Vertex (as opposed to two in the binary case). Suppose we want to state that Tom is 49 years old, we can write that as: age(49)--PropertyRole--Tom We have an edge of type age that is connected to the vertex Tom in the role of a property. Again this is mostly conceptually true, because there are lots of methods in Enhanced API that are very similar to the ones found in the standard API; getProperty, hasProperty, setProperty. Instead, we can also call methods on the property itself, after all the age property connected to the Vertex Tom, is an object all of itself. More precisely it is a Property and with that it is a UnaryEdge, which is an Edge, which is a Vertex. From the age property we can fetch the ProperyType, but we can also ask for the Vertex it is connected to: getVertex(). Since a Property is an Edge we can also fetch the connected vertex (Tom) as follows: age.getElement(db.getPropertyRole). So we have seen the two special cases: unary edges and binary edges, which work very much the same as properties and Relationships in the standard Neo4j API,
[Neo4j] Problem with datastore
I have a problem , i am using BatchInserterIndex and during my work sometimes i need to use the method getNodeById in graph database service and as i cant open two instances on the same datastore i had to shutdown the index first and open an instance of graph database service and then shutdown it and return back to my index which is truly bad . is their a way to use graph database service while using my batch index , or is their an equivalent for getNodeById with out using graph database service? -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/Problem-with-datastore-tp3232799p3232799.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Problem with datastore
Hi Ahmed, the Batchinserter system is working with Longs instead of nodes - otherwise you should be able to do much the same as in the normal API, see http://components.neo4j.org/neo4j/1.4.1/apidocs/org/neo4j/graphdb/index/BatchInserterIndex.html for getting a nodeId from the BatchInserterIndex, and https://github.com/neo4j/community/blob/master/kernel/src/main/java/org/neo4j/kernel/impl/batchinsert/BatchInserter.java and via public MapString,Object getNodeProperties( long nodeId ); you can get the Properties for a node. Would that work? 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://startupbootcamp.org/ - Öresund - Innovation happens HERE. http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party. On Sun, Aug 7, 2011 at 11:22 AM, ahmed.elsharkasy ahmed.elshark...@gmail.com wrote: I have a problem , i am using BatchInserterIndex and during my work sometimes i need to use the method getNodeById in graph database service and as i cant open two instances on the same datastore i had to shutdown the index first and open an instance of graph database service and then shutdown it and return back to my index which is truly bad . is their a way to use graph database service while using my batch index , or is their an equivalent for getNodeById with out using graph database service? -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/Problem-with-datastore-tp3232799p3232799.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ 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
[Neo4j] Neo4j Licensing
Hi After reading Agpl license again, I am still not able to understand it! My question is pretty simple. I am creating a website which uses neo4j as its database. Now if I want high availability and monitoring for my db , do I need commercial license ? or Agpl3 will be fine with my use case. If I need commercial license then I will not be able to use it because of lack of budget! Can I create a reliable website using only community edition of Neo4j? Regards, -- Manav Goel ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Problem with datastore
Yes thanks a lot this saves the problem regarding getNodeById but what about having to get the graph database service to start a transaction or to commit? can i do the same with out having to initiate a graph database service instance? -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/Problem-with-datastore-tp3232799p3233028.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
[Neo4j] cant use index after commit
i deleted some nodes and committed and was successfuly deleted but in the same run i tried to start my batch index again and i faced this exception Exception in thread main java.lang.RuntimeException: org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: nativefsl...@write.lock at org.neo4j.index.impl.lucene.LuceneBatchInserterIndex.instantiateWriter(LuceneBatchInserterIndex.java:240) at org.neo4j.index.impl.lucene.LuceneBatchInserterIndex.init(LuceneBatchInserterIndex.java:72) at org.neo4j.index.impl.lucene.LuceneBatchInserterIndexProvider.index(LuceneBatchInserterIndexProvider.java:135) at org.neo4j.index.impl.lucene.LuceneBatchInserterIndexProvider.nodeIndex(LuceneBatchInserterIndexProvider.java:102) at databaseManagers.Neo4jDatabaseManager.startIndex(Neo4jDatabaseManager.java:266) at databaseManagers.Neo4jDatabaseManager.deleteDocument(Neo4jDatabaseManager.java:155) at databaseManagers.Neo4jDatabaseManager.main(Neo4jDatabaseManager.java:450) Caused by: org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: nativefsl...@...write.lock at org.apache.lucene.store.Lock.obtain(Lock.java:84) at org.apache.lucene.index.IndexWriter.init(IndexWriter.java:1115) at org.neo4j.index.impl.lucene.LuceneBatchInserterIndex.instantiateWriter(LuceneBatchInserterIndex.java:235) ... 6 more what is the problem? -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/cant-use-index-after-commit-tp3233038p3233038.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Problem with datastore
Ahmed, The BatchInserter us totally without transactions and only good for one thread. You need to use the normal transactional database API to run in normal production. /peter Sent from my phone. On Aug 7, 2011 2:36 PM, ahmed.elsharkasy ahmed.elshark...@gmail.com wrote: Yes thanks a lot this saves the problem regarding getNodeById but what about having to get the graph database service to start a transaction or to commit? can i do the same with out having to initiate a graph database service instance? -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/Problem-with-datastore-tp3232799p3233028.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ 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] cant use index after commit
i am having this exception thrown in tx.finish , this means that the commit is not made but i dont know why -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/cant-use-index-after-commit-tp3233038p3233067.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Problem with datastore
but when i used method Node.delete() to delete the node , it throws an exception until i added the transaction how can i delete a node or a relationship with batch operations without transactions? -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/Problem-with-datastore-tp3232799p3233069.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Problem with datastore
Ahmed, Could we take a look at your code somewhere so we can see what things look like? /peter Sent from my phone. On Aug 7, 2011 3:02 PM, ahmed.elsharkasy ahmed.elshark...@gmail.com wrote: but when i used method Node.delete() to delete the node , it throws an exception until i added the transaction how can i delete a node or a relationship with batch operations without transactions? -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/Problem-with-datastore-tp3232799p3233069.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ 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] cant use index after commit
Which version? 1.4 or 1.4.1? From: user-boun...@lists.neo4j.org [user-boun...@lists.neo4j.org] On Behalf Of ahmed.elsharkasy [ahmed.elshark...@gmail.com] Sent: Sunday, August 07, 2011 8:42 AM To: user@lists.neo4j.org Subject: [Neo4j] cant use index after commit i deleted some nodes and committed and was successfuly deleted but in the same run i tried to start my batch index again and i faced this exception Exception in thread main java.lang.RuntimeException: org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: nativefsl...@write.lock at org.neo4j.index.impl.lucene.LuceneBatchInserterIndex.instantiateWriter(LuceneBatchInserterIndex.java:240) at org.neo4j.index.impl.lucene.LuceneBatchInserterIndex.init(LuceneBatchInserterIndex.java:72) at org.neo4j.index.impl.lucene.LuceneBatchInserterIndexProvider.index(LuceneBatchInserterIndexProvider.java:135) at org.neo4j.index.impl.lucene.LuceneBatchInserterIndexProvider.nodeIndex(LuceneBatchInserterIndexProvider.java:102) at databaseManagers.Neo4jDatabaseManager.startIndex(Neo4jDatabaseManager.java:266) at databaseManagers.Neo4jDatabaseManager.deleteDocument(Neo4jDatabaseManager.java:155) at databaseManagers.Neo4jDatabaseManager.main(Neo4jDatabaseManager.java:450) Caused by: org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: nativefsl...@...write.lock at org.apache.lucene.store.Lock.obtain(Lock.java:84) at org.apache.lucene.index.IndexWriter.init(IndexWriter.java:1115) at org.neo4j.index.impl.lucene.LuceneBatchInserterIndex.instantiateWriter(LuceneBatchInserterIndex.java:235) ... 6 more what is the problem? -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/cant-use-index-after-commit-tp3233038p3233038.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ 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] Enhanced API rewrite
Hi Peter, Thanks for showing an interest. A Property is indeed a unary edge in the Enhanced API and therefore (potentially) backed by a Node, but that Node doesn't contain the value. All property values are still stored the way they are stored in the standard API. If someone however decides to add a Property to a Property or create an Edge containing that Property, a Node will be created to store those properties and connect those Edges to. When the associated Node of a Property is created, the ID of that Node will be stored in the PropertyContainer of that property. Example: Suppose we have a property on a Person Vertex that denotes a personal identity number, and the user of the application want to annually check that identity number against some other database and state when it was last verified and who verified it. A Vertex (backed by a Node) for a particular Person is created and the property is set (in that Node's PropertyContainer), just like it would be the case in the standard API. When the verification is done, an additional property is created on the PropertyContainer of that Person with the name org.neo4j.collections.graphdb.[propertyname].node_id This property contains the node ID of the associated property. On that node the verification date will be set and the BinaryEdge (in principle nothing but a classic Relationship) will be created to the Person Vertex of the one who verified the personal identity code. It is certainly true that everything being a Vertex makes the Node implementation more important than ever before, but it goes even further, apart from a standard Vertex and the various VertexTypes, almost everything is an Edge. So I would say the Relationship implementation is becoming eminently important. There are certainly several tweaks to the storage layer I would love to see incorporated, mostly to hide the implementation for the user and to make sure that the maintenance of IDs takes place in core and not in a layer on top of core. In fact all of Enhanced API could much better be maintained in core, something that can actually quite easily be implemented. One of my ulterior motives with the development of Enhanced API is to tease out the technical requirements to push this functionality into core (whether Neo Tech decides to do so, is another question of course). Since the Neo4j database consists mostly of records and linked lists, the technical requirements to push things into core, are mostly a question of adding entry-points to linked lists in some records and partitioning some existing linked lists. I will write down those requirements in a separate post. This will include support for N-ary edges, since that is actually not all that difficult to implement and adds very little complexity to the database. Yes, traversals will become much more generalized in the Enhanced API, especially when we make them composable. In fact composable traversal descriptions can easily be seen as a query language giving access to all parts of the database. Niels From: peter.neuba...@neotechnology.com Date: Sun, 7 Aug 2011 09:10:02 +0200 To: user@lists.neo4j.org Subject: Re: [Neo4j] Enhanced API rewrite Niels, this sounds very interesting. Given the role of properties being unary edges, that would mean that any classic Neo4j property would now be a Node with one Property in the new Vertex sense? Having Vertices for EVERYTHING will of course make the node-implementation much more important than anything else, since every element is backed by a node, possibly with some property. I wonder how this would reflect in the storage layer that might need to be tweaked. Also, as you point out, traversals will become quite different with this API, but let's see an what the weekend brings ;) 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://startupbootcamp.org/- Öresund - Innovation happens HERE. http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party. On Sat, Aug 6, 2011 at 2:51 AM, Niels Hoogeveen pd_aficion...@hotmail.com wrote: Today I pushed a major rewrite of the Enhanced API. See: https://github.com/peterneubauer/graph-collections/tree/master/src/main/java/org/neo4j/collections/graphdb Originally the Enhanced API was a drop-in replacement of the standard Neo4j API. This resulted in lots of wrapper classes that needed to be maintained. The rewrite of Enhanced API is no longer a drop-in replacement and contains no interface/class names that can be found in the standard API. Enhanced API no longer speaks of Nodes but of Vertices and doesn't speak of Relationships but of Edges. This helps to prevent name clashes at the expense
Re: [Neo4j] cant use index after commit
1.4 -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/cant-use-index-after-commit-tp3233038p3233172.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Problem with datastore
Transaction tx2 = graphDb.beginTx(); node.delete(); graphDb.index().forNodes(wordsIndexName).remove(node); tx2.success(); although i am having a batch inserter index and i want to use it to delete the node and remove it from the batch index but i could not so i used the normal operations could you guide me how could i do the same above functionality using batch index ? -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/Problem-with-datastore-tp3232799p3233173.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] cant use index after commit
Give 1.4.1 a try. On Aug 7, 2011, at 10:36 AM, ahmed.elsharkasy ahmed.elshark...@gmail.com wrote: 1.4 -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/cant-use-index-after-commit-tp3233038p3233172.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ 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] Unique Constaint on Index
Not sure I understand this: A consistent, but hackish, attempt to acquire a cluster-wide lock is to remove a non-existent node; what does this mean, exactly; code sample? -Original Message- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of etc3 Sent: Thursday, July 07, 2011 11:49 AM To: 'Neo4j user discussions' Subject: Re: [Neo4j] Unique Constaint on Index I'm new to this framework, is there an example that demonstrates removing a non-existent property and how it would be used in this context? Thanks -Original Message- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of Chris Gioran Sent: Thursday, July 07, 2011 11:04 AM To: Neo4j user discussions Subject: Re: [Neo4j] Unique Constaint on Index Hi, the ability to acquire locks cluster-wide exists, albeit in an ad hoc fashion. Grabbing a write lock on the node you want to ensure is uniquely indexed will ensure that the operations are serialized across all cluster members. The most simple way to get that lock currently is the (somewhat hackish but entirely correct) removal of a non-existing property. cheers, CG On Thu, Jul 7, 2011 at 5:53 PM, etc3 e...@nextideapartners.com wrote: How do I ensure another request is not performing the same operation on another node in the cluster? -Original Message- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of Marko Rodriguez Sent: Thursday, July 07, 2011 10:35 AM To: Neo4j user discussions Subject: Re: [Neo4j] Unique Constaint on Index Hi, We are testing Neo4J and need to support unique emails across all users. Is this possible with the current API? You can add such a constraint when updating the indices: if(index.get('email', address).hasNext()) { throw new RuntimeException(There are two nodes that share the same email address.); } else { index.put('email', address, node); } Marko. http://markorodriguez.com ___ 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 ___ 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 ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] cant use index after commit
Hi Ahmed, if you are still having trouble, could you please provide a bare bones test case that reliably reproduces the problem? cheers, CG On Sun, Aug 7, 2011 at 6:56 PM, ahmed.elsharkasy ahmed.elshark...@gmail.com wrote: Are you sure no other reason? -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/cant-use-index-after-commit-tp3233038p3233302.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ 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] Neo4j Licensing
Hello Manav, I am not a lawyer, so what follows here is an opinion. My question is pretty simple. I am creating a website which uses neo4j as its database. Now if I want high availability and monitoring for my db , do I need commercial license ? or Agpl3 will be fine with my use case. If you use HA then your code also needs to be open source. That's one of the conditions of the AGPL. It prevents people from deriving value from using open source software without giving back. If you open source your stack in accordance with AGPLv3 then you can use HA without paying. If you cannot open source your stack then you need to obtain Neo4j under a different license. Neo Technology will be happy to provide a paid-for commercial license. If I need commercial license then I will not be able to use it because of lack of budget! Can I create a reliable website using only community edition of Neo4j? That depends on your situation. If you can tolerate downtime in your app, then you might not need HA. If you don't need read scale then you might not need HA. If you want to write a lot of crazy plumbing yourself you might not need HA. You are best placed to make those design calls since you know the design of your system. Remember that although Neo4j is fanatically open source (you can read the code of what you're using), not all of Neo4j is always free - if you're using Neo4j in a closed-source commercial environment, then you should obtain a commercial license otherwise you may even fall foul of the AGPL. Jim ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Unique Constaint on Index
I see, that makes sense, ty Does this code work the same for embedded single node and cluster high availability graph db's? -Original Message- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of Michael Hunger Sent: Sunday, August 07, 2011 1:04 PM To: Neo4j user discussions Subject: Re: [Neo4j] Unique Constaint on Index Just from my head. tx = graphdb.beginTransaction(); try { Node lockNode = graphdb.getReferenceNode(); // or another node that is used for locking this unique index lockNode.removeProperty(__non_existent_property__); index=graphdb.index().forNodes(unique-name); Node user = index.get(name,name).getSingle(); if (user==null) { user=graphdb.createNode(); user.setProperty(name,name); index.add(user,name,name); } tx.success(); } finally { tx.finish(); } Am 07.08.2011 um 17:40 schrieb etc1: Not sure I understand this: A consistent, but hackish, attempt to acquire a cluster-wide lock is to remove a non-existent node; what does this mean, exactly; code sample? -Original Message- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of etc3 Sent: Thursday, July 07, 2011 11:49 AM To: 'Neo4j user discussions' Subject: Re: [Neo4j] Unique Constaint on Index I'm new to this framework, is there an example that demonstrates removing a non-existent property and how it would be used in this context? Thanks -Original Message- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of Chris Gioran Sent: Thursday, July 07, 2011 11:04 AM To: Neo4j user discussions Subject: Re: [Neo4j] Unique Constaint on Index Hi, the ability to acquire locks cluster-wide exists, albeit in an ad hoc fashion. Grabbing a write lock on the node you want to ensure is uniquely indexed will ensure that the operations are serialized across all cluster members. The most simple way to get that lock currently is the (somewhat hackish but entirely correct) removal of a non-existing property. cheers, CG On Thu, Jul 7, 2011 at 5:53 PM, etc3 e...@nextideapartners.com wrote: How do I ensure another request is not performing the same operation on another node in the cluster? -Original Message- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of Marko Rodriguez Sent: Thursday, July 07, 2011 10:35 AM To: Neo4j user discussions Subject: Re: [Neo4j] Unique Constaint on Index Hi, We are testing Neo4J and need to support unique emails across all users. Is this possible with the current API? You can add such a constraint when updating the indices: if(index.get('email', address).hasNext()) { throw new RuntimeException(There are two nodes that share the same email address.); } else { index.put('email', address, node); } Marko. http://markorodriguez.com ___ 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 ___ 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 ___ 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 ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] cant use index after commit
Ahmed, please make sure not to mix BatchInserter and the normal API in the same program. Batch-Inserter does not support removal of nodes and relationships. Cheers Michael Am 07.08.2011 um 18:22 schrieb Chris Gioran: Hi Ahmed, if you are still having trouble, could you please provide a bare bones test case that reliably reproduces the problem? cheers, CG On Sun, Aug 7, 2011 at 6:56 PM, ahmed.elsharkasy ahmed.elshark...@gmail.com wrote: Are you sure no other reason? -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/cant-use-index-after-commit-tp3233038p3233302.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ 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 ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Unique Constaint on Index
Yeah it is the same code, locks are held across the cluster. An explicit locking API will make it in one of the future versions of Neo4j, it has not been decided when that will happen. Cheers Michael Am 07.08.2011 um 19:20 schrieb etc1: I see, that makes sense, ty Does this code work the same for embedded single node and cluster high availability graph db's? -Original Message- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of Michael Hunger Sent: Sunday, August 07, 2011 1:04 PM To: Neo4j user discussions Subject: Re: [Neo4j] Unique Constaint on Index Just from my head. tx = graphdb.beginTransaction(); try { Node lockNode = graphdb.getReferenceNode(); // or another node that is used for locking this unique index lockNode.removeProperty(__non_existent_property__); index=graphdb.index().forNodes(unique-name); Node user = index.get(name,name).getSingle(); if (user==null) { user=graphdb.createNode(); user.setProperty(name,name); index.add(user,name,name); } tx.success(); } finally { tx.finish(); } Am 07.08.2011 um 17:40 schrieb etc1: Not sure I understand this: A consistent, but hackish, attempt to acquire a cluster-wide lock is to remove a non-existent node; what does this mean, exactly; code sample? -Original Message- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of etc3 Sent: Thursday, July 07, 2011 11:49 AM To: 'Neo4j user discussions' Subject: Re: [Neo4j] Unique Constaint on Index I'm new to this framework, is there an example that demonstrates removing a non-existent property and how it would be used in this context? Thanks -Original Message- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of Chris Gioran Sent: Thursday, July 07, 2011 11:04 AM To: Neo4j user discussions Subject: Re: [Neo4j] Unique Constaint on Index Hi, the ability to acquire locks cluster-wide exists, albeit in an ad hoc fashion. Grabbing a write lock on the node you want to ensure is uniquely indexed will ensure that the operations are serialized across all cluster members. The most simple way to get that lock currently is the (somewhat hackish but entirely correct) removal of a non-existing property. cheers, CG On Thu, Jul 7, 2011 at 5:53 PM, etc3 e...@nextideapartners.com wrote: How do I ensure another request is not performing the same operation on another node in the cluster? -Original Message- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of Marko Rodriguez Sent: Thursday, July 07, 2011 10:35 AM To: Neo4j user discussions Subject: Re: [Neo4j] Unique Constaint on Index Hi, We are testing Neo4J and need to support unique emails across all users. Is this possible with the current API? You can add such a constraint when updating the indices: if(index.get('email', address).hasNext()) { throw new RuntimeException(There are two nodes that share the same email address.); } else { index.put('email', address, node); } Marko. http://markorodriguez.com ___ 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 ___ 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 ___ 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 ___ 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] Problem with datastore
If you have indexed the node before (in the batch-inserter) then you might later use the index (with the same name) to retrieve the node and delete it. You can also reach that node later by knowing its id or by traversing to it via intermediate relationships. Batch insertion is faster because it doesn't use transactions and is not thread safe (no locks) and no safepoints. Cheers Michael Am 07.08.2011 um 20:04 schrieb ahmed.elsharkasy: ohhh yes i got this point now but i have a last question in my problem if i want to delete a node , i must get the index to this node first and then access the node , in this case i should also use the normal graph database index not the batch one? i tried this but i found that the batch index are faster -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/Problem-with-datastore-tp3232799p3233524.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ 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] Neo4j Licensing
Manav, Also, contact me for a good startup - commercial setup. We are not in the business of stripping startups bare, so I am sure we can work it out :) /peter Sent from my phone. On Aug 7, 2011 7:19 PM, Jim Webber j...@neotechnology.com wrote: Hello Manav, I am not a lawyer, so what follows here is an opinion. My question is pretty simple. I am creating a website which uses neo4j as its database. Now if I want high availability and monitoring for my db , do I need commercial license ? or Agpl3 will be fine with my use case. If you use HA then your code also needs to be open source. That's one of the conditions of the AGPL. It prevents people from deriving value from using open source software without giving back. If you open source your stack in accordance with AGPLv3 then you can use HA without paying. If you cannot open source your stack then you need to obtain Neo4j under a different license. Neo Technology will be happy to provide a paid-for commercial license. If I need commercial license then I will not be able to use it because of lack of budget! Can I create a reliable website using only community edition of Neo4j? That depends on your situation. If you can tolerate downtime in your app, then you might not need HA. If you don't need read scale then you might not need HA. If you want to write a lot of crazy plumbing yourself you might not need HA. You are best placed to make those design calls since you know the design of your system. Remember that although Neo4j is fanatically open source (you can read the code of what you're using), not all of Neo4j is always free - if you're using Neo4j in a closed-source commercial environment, then you should obtain a commercial license otherwise you may even fall foul of the AGPL. Jim ___ 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] Node#getRelationshipTypes
2011/8/6 Niels Hoogeveen pd_aficion...@hotmail.com This is the thread about store layer changes for type/direction, and in my opinion this is still quite low hanging fruit. Sure, the impact needs to be tested rigorously, which may take considerable time, but the implementation is quite straight-forward and the potential gains are large. Agreeing to disagree. Implementing it shouldn't be very hard, but that's only a small part of it. It would require quite hefty amounts of testing to be considered production quality... not even mentioning writing and testing migration of existing databases. Or we just have different views of what kind of fruit to consider low hanging. Niels Date: Sat, 6 Aug 2011 22:16:15 +0200 From: matt...@neotechnology.com To: user@lists.neo4j.org Subject: Re: [Neo4j] Node#getRelationshipTypes Oh, confused this thread with store layer changes for type/direction of relationships. This fruit in this thread is pretty low hanging. Den lördagen den 6:e augusti 2011 skrev Mattias Perssonmatt...@neotechnology.com: I would not consider this low hanging fruit btw Den onsdagen den 3:e augusti 2011 skrev Niels Hoogeveenpd_aficion...@hotmail.com: Hmmm... Does that require the inclusion of golden parachutes as well? Anyway, addressing the readers of this message that have time allocation authority. I hope my suggestion, or another technical solution that solves the same issues will be picked up for 1.5. This is as far as I can tell pretty much low hanging fruit. There are probably all sorts of tweaks that can improve the performance of Neo4j, but this one can improve the performance of Neo4j big time (under certain conditions). As a user who is confronted with several very densely connected nodes, I have tried all sorts of means to solve my issues, but none as rewarding as a solution in core would be. Niels Date: Wed, 3 Aug 2011 16:31:04 +0200 From: matt...@neotechnology.com To: user@lists.neo4j.org Subject: Re: [Neo4j] Node#getRelationshipTypes A golden helicopter might do the trick :) 2011/8/3 Niels Hoogeveen pd_aficion...@hotmail.com How does one persuade the time allocation authorities? Niels Date: Wed, 3 Aug 2011 09:28:45 +0200 From: matt...@neotechnology.com To: user@lists.neo4j.org Subject: Re: [Neo4j] Node#getRelationshipTypes Yup, it's a pretty sane approach and somewhat along the lines of how I feel it would be done. It's been said a long time that this functionality will be implemented some day and it's just that a significant amount of time have to be invested... maybe not for implementing it, but for discovering all bugs and inconveniences to have it on par with production quality. And that kind of time haven't been allocated yet. I appreciate your thoughts and time on all this! Best, Mattias 2011/8/3 Niels Hoogeveen pd_aficion...@hotmail.com I would like to make a suggestion that would both address my feature request and increase performance of the database. Right now the NodeRecord (org.neo4j.kernel.impl.nioneo.store.NodeRecord) contains the ID of the first Relationship, while the RelationshipRecord contain the ID's of the previous and next relationship for both sides of the relationship. My suggestion is as follows: Create a new store: noderelationshiptypestore.db The layout of this store is given by the NodeRelationshipTypeRecord: id previousrelationshiptype nextrelationshiptype firstrelationship The NodeRecord would now need to point to the first outgoing NodeRelationshipType and to the first incoming NodeRelationshipType instead of to the first Relationship. On insert of a Relationship, one side of the relationship will update the store from the outgoing side, the other side will update the store for the incoming side. I will list the steps to take here for the outgoing side (the incoming side is almost identical). From the NodeReco-- Mattias Persson, [matt...@neotechnology.com] Hacker, Neo Technology www.neotechnology.com -- Mattias Persson, [matt...@neotechnology.com] Hacker, Neo Technology www.neotechnology.com ___ 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 -- Mattias Persson, [matt...@neotechnology.com] Hacker, Neo Technology www.neotechnology.com ___ Neo4j mailing list User@lists.neo4j.org
[Neo4j] neo4j spatial via rest, weird error
When one of my nodes is selected by a findgeometriesinlayer query the plugin throws the following error. I can't tell what's different about this node. Any ideas where I should look? BTW, I tried to remove the relationship to the rtree index and then re-attach, but that doesn't help. Other nodes come back just fine. Any ideas? Many thanks! - == 500 Internal Server Error - == { - == message : java.lang.Integer cannot be cast to java.lang.Double, - == exception : java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Double, - == stacktrace : [ org.neo4j.gis.spatial.encoders.SimplePointEncoder.decodeGeometry(SimplePointEncoder.java:55), org.neo4j.gis.spatial.AbstractSearch.decode(AbstractSearch.java:83), org.neo4j.gis.spatial.query.SearchWithin.onEnvelopeIntersection(SearchWithin.java:44), org.neo4j.gis.spatial.query.AbstractSearchIntersection.onIndexReference(AbstractSearchIntersection.java:45), org.neo4j.gis.spatial.RTreeIndex.visit(RTreeIndex.java:276), org.neo4j.gis.spatial.RTreeIndex.executeSearch(RTreeIndex.java:231), org.neo4j.gis.spatial.server.plugin.SpatialPlugin.findGeometriesInLayer(SpatialPlugin.java:175), sun.reflect.GeneratedMethodAccessor1133.invoke(Unknown Source), sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.lang.reflect.Method.invoke(Method.java:616), org.neo4j.server.plugins.PluginMethod.invoke(PluginMethod.java:57), org.neo4j.server.plugins.PluginManager.invoke(PluginManager.java:153), org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:275), org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:121), sun.reflect.GeneratedMethodAccessor107.invoke(Unknown Source), sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.lang.reflect.Method.invoke(Method.java:616), com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:184), com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67), com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:276), com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133), com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83), com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133), com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:71), com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1171), com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1103), com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1053), com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1043), com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:406), com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:477), com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:662), javax.servlet.http.HttpServlet.service(HttpServlet.java:820), org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511), org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390), org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182), org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765), org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114), org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152), org.mortbay.jetty.Server.handle(Server.java:326), org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542), org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943), org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756), org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218), org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404), org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228), org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) ] - == } ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] neo4j spatial via rest, weird error
Probably one of the gemoetry attributes was just (for instance 0) so that it got encoded as a property with an integer type not a double as expected. Probably the SimplePointEncoder should be a bit more forgiving and use Number.doubleValue() on the actual value it gets back. so changing decodeGeometry to: public Geometry decodeGeometry(PropertyContainer container) { double x = ((Number) container.getProperty(xProperty)).doubleValue(); double y = ((Number) container.getProperty(yProperty)).doubleValue(); Coordinate coordinate = new Coordinate(x, y); return getGeometryFactory().createPoint(coordinate); } Michael Am 07.08.2011 um 22:19 schrieb Boris Kizelshteyn: When one of my nodes is selected by a findgeometriesinlayer query the plugin throws the following error. I can't tell what's different about this node. Any ideas where I should look? BTW, I tried to remove the relationship to the rtree index and then re-attach, but that doesn't help. Other nodes come back just fine. Any ideas? Many thanks! - == 500 Internal Server Error - == { - == message : java.lang.Integer cannot be cast to java.lang.Double, - == exception : java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Double, - == stacktrace : [ org.neo4j.gis.spatial.encoders.SimplePointEncoder.decodeGeometry(SimplePointEncoder.java:55), org.neo4j.gis.spatial.AbstractSearch.decode(AbstractSearch.java:83), org.neo4j.gis.spatial.query.SearchWithin.onEnvelopeIntersection(SearchWithin.java:44), org.neo4j.gis.spatial.query.AbstractSearchIntersection.onIndexReference(AbstractSearchIntersection.java:45), org.neo4j.gis.spatial.RTreeIndex.visit(RTreeIndex.java:276), org.neo4j.gis.spatial.RTreeIndex.executeSearch(RTreeIndex.java:231), org.neo4j.gis.spatial.server.plugin.SpatialPlugin.findGeometriesInLayer(SpatialPlugin.java:175), sun.reflect.GeneratedMethodAccessor1133.invoke(Unknown Source), sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.lang.reflect.Method.invoke(Method.java:616), org.neo4j.server.plugins.PluginMethod.invoke(PluginMethod.java:57), org.neo4j.server.plugins.PluginManager.invoke(PluginManager.java:153), org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:275), org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:121), sun.reflect.GeneratedMethodAccessor107.invoke(Unknown Source), sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.lang.reflect.Method.invoke(Method.java:616), com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:184), com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67), com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:276), com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133), com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83), com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133), com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:71), com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1171), com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1103), com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1053), com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1043), com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:406), com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:477), com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:662), javax.servlet.http.HttpServlet.service(HttpServlet.java:820), org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511), org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390), org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182), org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765), org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114), org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152), org.mortbay.jetty.Server.handle(Server.java:326), org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542), org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943), org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756),
Re: [Neo4j] Neo4j Licensing
Hello If you use HA then your code also needs to be open source Well, more than open source, your code has to be GPL-compatible - Charles Edward Bedón Cortázar ITIL Foundation Certified Open Source Network Inventory for the masses! http://kuwaiba.sourceforge.net | Follow Kuwaiba on Twitter Linux Registered User #38 Am Sun, 07 Aug 2011 12:19:44 -0500 Jim Webberlt;j...@neotechnology.comgt; schrieb Hello Manav, I am not a lawyer, so what follows here is an opinion. gt; My question is pretty simple. I am creating a website which uses neo4j gt; as its database. Now if I want high availability and monitoring for my db , gt; do I need commercial license ? or Agpl3 will be fine with my use case. If you use HA then your code also needs to be open source. That's one of the conditions of the AGPL. It prevents people from deriving value from using open source software without giving back. If you open source your stack in accordance with AGPLv3 then you can use HA without paying. If you cannot open source your stack then you need to obtain Neo4j under a different license. Neo Technology will be happy to provide a paid-for commercial license. gt; If I need commercial license then I will not be able to use it because of gt; lack of budget! Can I create a reliable website using only community edition gt; of Neo4j? That depends on your situation. If you can tolerate downtime in your app, then you might not need HA. If you don't need read scale then you might not need HA. If you want to write a lot of crazy plumbing yourself you might not need HA. You are best placed to make those design calls since you know the design of your system. Remember that although Neo4j is fanatically open source (you can read the code of what you're using), not all of Neo4j is always free - if you're using Neo4j in a closed-source commercial environment, then you should obtain a commercial license otherwise you may even fall foul of the AGPL. Jim ___ 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] Node#getRelationshipTypes
Yes, let's not argue about something as elusive as the definition of low hanging fruit. In the mean time I wrote down my suggestions for store refactoring more succinctly and added some more suggestions. Niels Date: Sun, 7 Aug 2011 22:09:48 +0200 From: matt...@neotechnology.com To: user@lists.neo4j.org Subject: Re: [Neo4j] Node#getRelationshipTypes 2011/8/6 Niels Hoogeveen pd_aficion...@hotmail.com This is the thread about store layer changes for type/direction, and in my opinion this is still quite low hanging fruit. Sure, the impact needs to be tested rigorously, which may take considerable time, but the implementation is quite straight-forward and the potential gains are large. Agreeing to disagree. Implementing it shouldn't be very hard, but that's only a small part of it. It would require quite hefty amounts of testing to be considered production quality... not even mentioning writing and testing migration of existing databases. Or we just have different views of what kind of fruit to consider low hanging. Niels Date: Sat, 6 Aug 2011 22:16:15 +0200 From: matt...@neotechnology.com To: user@lists.neo4j.org Subject: Re: [Neo4j] Node#getRelationshipTypes Oh, confused this thread with store layer changes for type/direction of relationships. This fruit in this thread is pretty low hanging. Den lördagen den 6:e augusti 2011 skrev Mattias Perssonmatt...@neotechnology.com: I would not consider this low hanging fruit btw Den onsdagen den 3:e augusti 2011 skrev Niels Hoogeveenpd_aficion...@hotmail.com: Hmmm... Does that require the inclusion of golden parachutes as well? Anyway, addressing the readers of this message that have time allocation authority. I hope my suggestion, or another technical solution that solves the same issues will be picked up for 1.5. This is as far as I can tell pretty much low hanging fruit. There are probably all sorts of tweaks that can improve the performance of Neo4j, but this one can improve the performance of Neo4j big time (under certain conditions). As a user who is confronted with several very densely connected nodes, I have tried all sorts of means to solve my issues, but none as rewarding as a solution in core would be. Niels Date: Wed, 3 Aug 2011 16:31:04 +0200 From: matt...@neotechnology.com To: user@lists.neo4j.org Subject: Re: [Neo4j] Node#getRelationshipTypes A golden helicopter might do the trick :) 2011/8/3 Niels Hoogeveen pd_aficion...@hotmail.com How does one persuade the time allocation authorities? Niels Date: Wed, 3 Aug 2011 09:28:45 +0200 From: matt...@neotechnology.com To: user@lists.neo4j.org Subject: Re: [Neo4j] Node#getRelationshipTypes Yup, it's a pretty sane approach and somewhat along the lines of how I feel it would be done. It's been said a long time that this functionality will be implemented some day and it's just that a significant amount of time have to be invested... maybe not for implementing it, but for discovering all bugs and inconveniences to have it on par with production quality. And that kind of time haven't been allocated yet. I appreciate your thoughts and time on all this! Best, Mattias 2011/8/3 Niels Hoogeveen pd_aficion...@hotmail.com I would like to make a suggestion that would both address my feature request and increase performance of the database. Right now the NodeRecord (org.neo4j.kernel.impl.nioneo.store.NodeRecord) contains the ID of the first Relationship, while the RelationshipRecord contain the ID's of the previous and next relationship for both sides of the relationship. My suggestion is as follows: Create a new store: noderelationshiptypestore.db The layout of this store is given by the NodeRelationshipTypeRecord: id previousrelationshiptype nextrelationshiptype firstrelationship The NodeRecord would now need to point to the first outgoing NodeRelationshipType and to the first incoming NodeRelationshipType instead of to the first Relationship. On insert of a Relationship, one side of the relationship will update the store from the outgoing side, the other side will update the store for the incoming side. I will list the steps to take here for the outgoing side (the incoming side is almost identical). From the NodeReco-- Mattias Persson, [matt...@neotechnology.com] Hacker, Neo Technology www.neotechnology.com -- Mattias Persson, [matt...@neotechnology.com] Hacker, Neo Technology www.neotechnology.com
[Neo4j] is there a limit to how much data rest batch can take?
I'm getting a weird error when batching a large dataset (about 200 calls), it's below. Any thoughts? Many thanks! - 500 Unable to commit transaction - == html - == head - == meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1/ - == titleError 500 Unable to commit transaction/title - == /head - == bodyh2HTTP ERROR 500/h2 - == pProblem accessing /db/data/batch. Reason: - == preUnable to commit transaction/pre/ph3Caused by:/h3preorg.neo4j.graphdb.TransactionFailureException: Unable to commit transaction - == at org.neo4j.kernel.TopLevelTransaction.finish(TopLevelTransaction.java:98) - == at org.neo4j.server.rest.web.BatchOperationService.performBatchOperations(BatchOperationService.java:102) - == at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) - == at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) - == at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) - == at java.lang.reflect.Method.invoke(Method.java:616) - == at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:184) - == at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67) - == at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:276) - == at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83) - == at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133) - == at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:71) - == at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1171) - == at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1103) - == at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1053) - == at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1043) - == at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:406) - == at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:477) - == at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:662) - == at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) - == at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) - == at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390) - == at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) - == at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) - == at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) - == at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) - == at org.mortbay.jetty.Server.handle(Server.java:326) - == at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) - == at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943) - == at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) - == at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) - == at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) - == at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228) - == at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) - == Caused by: javax.transaction.RollbackException: Failed to commit, transaction rolledback - == at org.neo4j.kernel.impl.transaction.TxManager.rollbackCommit(TxManager.java:792) - == at org.neo4j.kernel.impl.transaction.TxManager.commit(TxManager.java:627) - == at org.neo4j.kernel.impl.transaction.TransactionImpl.commit(TransactionImpl.java:107) - == at org.neo4j.kernel.TopLevelTransaction.finish(TopLevelTransaction.java:85) - == ... 33 more - == /pre - == h3Caused by:/h3prejavax.transaction.RollbackException: Failed to commit, transaction rolledback - == at org.neo4j.kernel.impl.transaction.TxManager.rollbackCommit(TxManager.java:792) - == at org.neo4j.kernel.impl.transaction.TxManager.commit(TxManager.java:627) - == at org.neo4j.kernel.impl.transaction.TransactionImpl.commit(TransactionImpl.java:107) - == at org.neo4j.kernel.TopLevelTransaction.finish(TopLevelTransaction.java:85) - == at org.neo4j.server.rest.web.BatchOperationService.performBatchOperations(BatchOperationService.java:102) - == at
Re: [Neo4j] is there a limit to how much data rest batch can take?
I should add that I can insert the same calls one by one without error. What could it be? On Sun, Aug 7, 2011 at 8:31 PM, Boris Kizelshteyn bo...@popcha.com wrote: I'm getting a weird error when batching a large dataset (about 200 calls), it's below. Any thoughts? Many thanks! - 500 Unable to commit transaction - == html - == head - == meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1/ - == titleError 500 Unable to commit transaction/title - == /head - == bodyh2HTTP ERROR 500/h2 - == pProblem accessing /db/data/batch. Reason: - == preUnable to commit transaction/pre/ph3Caused by:/h3preorg.neo4j.graphdb.TransactionFailureException: Unable to commit transaction - == at org.neo4j.kernel.TopLevelTransaction.finish(TopLevelTransaction.java:98) - == at org.neo4j.server.rest.web.BatchOperationService.performBatchOperations(BatchOperationService.java:102) - == at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) - == at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) - == at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) - == at java.lang.reflect.Method.invoke(Method.java:616) - == at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:184) - == at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67) - == at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:276) - == at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83) - == at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133) - == at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:71) - == at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1171) - == at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1103) - == at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1053) - == at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1043) - == at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:406) - == at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:477) - == at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:662) - == at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) - == at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) - == at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390) - == at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) - == at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) - == at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) - == at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) - == at org.mortbay.jetty.Server.handle(Server.java:326) - == at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) - == at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943) - == at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) - == at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) - == at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) - == at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228) - == at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) - == Caused by: javax.transaction.RollbackException: Failed to commit, transaction rolledback - == at org.neo4j.kernel.impl.transaction.TxManager.rollbackCommit(TxManager.java:792) - == at org.neo4j.kernel.impl.transaction.TxManager.commit(TxManager.java:627) - == at org.neo4j.kernel.impl.transaction.TransactionImpl.commit(TransactionImpl.java:107) - == at org.neo4j.kernel.TopLevelTransaction.finish(TopLevelTransaction.java:85) - == ... 33 more - == /pre - == h3Caused by:/h3prejavax.transaction.RollbackException: Failed to commit, transaction rolledback - == at org.neo4j.kernel.impl.transaction.TxManager.rollbackCommit(TxManager.java:792) - == at org.neo4j.kernel.impl.transaction.TxManager.commit(TxManager.java:627) - == at
[Neo4j] sub-graphs
While I am at it, let's post another brain dump. A couple of weeks ago, I worked on SortedTree/IndexRelationships in an attempt to solve the densely-connected-node-problem. SortedTree is a Btree layed-out in the graph, sorted by some function on a node (eg. the nodeId, or a property value). This approach worked, to a degree, but at some point, load times decrease because of reorganizations of the tree. Too much memory is needed to keep the entire tree in memory and standard nodes and relationships are simply too fine grained for the job. Instead of loading each individual node and each individual relationships in an index block, it would be nice to be able to load the entire block with one read operation, and swap out an entire memory block when memory is needed. This brought me to the idea of sub-graphs. Let's say every node (and possibly relationship) is a graph, containing nodes and relationships. Each graph has its own store (if the contained graph is not empty). Relationships are lightweight (offset based) when associated with Nodes (and possibly Relationships) within the same graph, but require an extra store_id when associating with nodes (and possibly Relationship) outside that graph. This gives control over where things are stored, and what is stored together. Using RelationshipRoles, as I described in another post we can state which association of a Relationship is certainly stored local, and what is certainly stored in another another Graph and what is either stored local or in another Graph. This way we can have full control over the locality of the associations of a Relationship. If we make each index block of SortedTree its own graph we can make sure that all Relationship associations are local, except the ones eventually pointing to the Nodes we want indexed, those are certainly stored in another Graph. This way the store will only contain Nodes and Relationships belonging to that index block, so we can load the entire store in a set of buffers and flush those buffers when no longer needed. This approach could also be used for sharding the database. Since each node in the graph can be a store of its own, we have a natural means to distribute graphs over different shards. Lets define a shard as a set of graphs, which membership is decided by some rules defined on the RelationshipTypes used in the shard. We could add the following options to the RelationshipRoles: must be shard, may be in shard and must not be in shard. This way the RelationshipRoles used in a store determine the dependencies of that store. RelationshipRoles can form 9 possible combinations of settings over the locality of each Relationship association, one of which is mutually exclusive and some are tautological or inconsequential: Must be in store and Must be in shard (is tautological). Must be in store and May be in shard (is inconsequential). Must be in store and Must not be in shard (is impossible) May be in store and Must be in shard May be in store and May be in shard (is inconsequential) May be in store and Must not be in shard (is inconsequential) Must not be in store and Must be in shard Must not be in store and May be in shard (inconsequential) Must not be in store and Must not be in shard (is tautological) So that leaves the following RelationshipRole options: Must be in store May be in store and Must be in shard May be in shard Must not be in store and Must be in shard Must not be in store Must not be in shard The default RelationshipRoles of a standard binary relationship are StartNode and EndNode, which both will have as default setting Must be in store. This way an implementation of such an approach remains backwards compatible. When combining RelationshipRoles into a RelationshipType, at least one RelationshipRole in the set must not have the setting Must not be in store, which is implied by Must not be in shard. Any such combination cannot be stored, since no store can contain any of the associated Nodes. When creating a Relationship, a store adds that Relationship when at least one associated Node is actually present in the database. When adding NodeTypes to the mix, the distribution of Nodes and Relationships over the various stores can even be further controlled. If we would know for each created Node if it must have an associated RelationshipRole, may have an associated RelationshipRole, or must not have an associated RelationshipRole, it becomes possible to decide if a Node Must be added to a store, may be added to a store, or must not be added to a store. For the may be added to a store cases, a Coordinator can decide where to store those particular Nodes. Finally, this approach allows for distributed traversals. Traversals are always local, when a traversal branch hits upon a relationship association that is external to the store, that traversal will asynchronously be continued on that other store. When the traversal ends its
[Neo4j] Indices missing on database copy
By the way, thanks to Michael and T. noppanit for your quick replies! Grace and peace, WBT ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user