Re: [Neo4j] Can I model a Graph data structure without persisting it in DB using Neo4j ?
Any suggestions on this please ? It is really acting as a blocker for me. I have tried multiple alternatives, but I come up with one issue or the other. On Wed, Jun 22, 2011 at 8:51 PM, V vlin...@gmail.com wrote: I am confused, elements is defined as @RelatedTo(type = ELEMENT, elementClass = Element.class, direction = OUTGOING) private SetElement elements; if I call getElements() without persisting the node first, will it not return null ? It is throwing null pointer exception. When I persist the node before calling getElements, then it returns empty set. This is in line with my original email. Do you want me to do something else? Please let me know On Wed, Jun 22, 2011 at 8:39 PM, Michael Hunger michael.hun...@neotechnology.com wrote: getElements() returns a set of your elements. If you do an add(element) on those then you build up an in-memory structure. So if you use just the getters and setters of your instances you can navigate this structure, but you can't use any of the graph operations supplied by neo4j (remember it is still just in memory) Cheers Michael Am 22.06.2011 um 17:06 schrieb V: Michael - In my quest for a cleaner solution , I am coming back to your original reply What do you mean by *Right now this works only with the getElements().add method.* Please elaborate . Thanks for your help . On Sun, Jun 19, 2011 at 2:34 AM, Michael Hunger michael.hun...@neotechnology.com wrote: Right now this works only with the getElements().add method. But then you don't get all the graph methods (traversals and such). We discussed some time ago writing a virtual graph layer on top of the real nodes and relationships for SDG. (That should be then used to have a simpler handling of attached/detached nodes and keeping back-references for cluster-persistance). But that hasn't happend yet and I'm not convinced it will make it in the 1.1. timeframe. Cheers Michael P.S. You can still persist your graph and remove the nodes later (either index them on a transient index or keep their node-id's somewhere). Am 18.06.2011 um 03:40 schrieb V: Any suggestions on this please ? On Fri, Jun 17, 2011 at 11:03 PM, V vlin...@gmail.com wrote: I created a graph model with 2 classes Node and Element as follows: public class Node { @RelatedTo(type = ELEMENT, elementClass = Element.class, direction = OUTGOING) private SetElement Element; public void addElement(Element e) { relateTo(e, Relationships.ELEMENT.toString()); } } public class Element{ public String name; } I want to create an in memory graph structure without persisting the nodes as follows : Node n = new Node(); n.addElement(new Element()); *However it throws an exception as the Node n has not been persisted so the call to relateTo(..) fails. * If instead I do n.persist() and then call addElement(..) it works fine as the aspect kicks in. Any workaround for this ? That is, is there a way I can still use the above style without persisting the Node object ? My application needs this as first I create a structure and persist it, and then I create another structure to pass around some values to the persisted structure when doing some computations. -Karan ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Can I model a Graph data structure without persisting it in DB using Neo4j ?
Neo4j is not implementing storing and traversing memory only structures. So it would be really advisable to do that in your domain layer only. I'll look into the elements returning null. I thought I already solved that some time ago. Which version of SDG are you using? Cheers Michael Am 30.06.2011 um 15:00 schrieb V: Any suggestions on this please ? It is really acting as a blocker for me. I have tried multiple alternatives, but I come up with one issue or the other. On Wed, Jun 22, 2011 at 8:51 PM, V vlin...@gmail.com wrote: I am confused, elements is defined as @RelatedTo(type = ELEMENT, elementClass = Element.class, direction = OUTGOING) private SetElement elements; if I call getElements() without persisting the node first, will it not return null ? It is throwing null pointer exception. When I persist the node before calling getElements, then it returns empty set. This is in line with my original email. Do you want me to do something else? Please let me know On Wed, Jun 22, 2011 at 8:39 PM, Michael Hunger michael.hun...@neotechnology.com wrote: getElements() returns a set of your elements. If you do an add(element) on those then you build up an in-memory structure. So if you use just the getters and setters of your instances you can navigate this structure, but you can't use any of the graph operations supplied by neo4j (remember it is still just in memory) Cheers Michael Am 22.06.2011 um 17:06 schrieb V: Michael - In my quest for a cleaner solution , I am coming back to your original reply What do you mean by Right now this works only with the getElements().add method. Please elaborate . Thanks for your help . On Sun, Jun 19, 2011 at 2:34 AM, Michael Hunger michael.hun...@neotechnology.com wrote: Right now this works only with the getElements().add method. But then you don't get all the graph methods (traversals and such). We discussed some time ago writing a virtual graph layer on top of the real nodes and relationships for SDG. (That should be then used to have a simpler handling of attached/detached nodes and keeping back-references for cluster-persistance). But that hasn't happend yet and I'm not convinced it will make it in the 1.1. timeframe. Cheers Michael P.S. You can still persist your graph and remove the nodes later (either index them on a transient index or keep their node-id's somewhere). Am 18.06.2011 um 03:40 schrieb V: Any suggestions on this please ? On Fri, Jun 17, 2011 at 11:03 PM, V vlin...@gmail.com wrote: I created a graph model with 2 classes Node and Element as follows: public class Node { @RelatedTo(type = ELEMENT, elementClass = Element.class, direction = OUTGOING) private SetElement Element; public void addElement(Element e) { relateTo(e, Relationships.ELEMENT.toString()); } } public class Element{ public String name; } I want to create an in memory graph structure without persisting the nodes as follows : Node n = new Node(); n.addElement(new Element()); However it throws an exception as the Node n has not been persisted so the call to relateTo(..) fails. If instead I do n.persist() and then call addElement(..) it works fine as the aspect kicks in. Any workaround for this ? That is, is there a way I can still use the above style without persisting the Node object ? My application needs this as first I create a structure and persist it, and then I create another structure to pass around some values to the persisted structure when doing some computations. -Karan ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Can I model a Graph data structure without persisting it in DB using Neo4j ?
I am using the latest version 1.1.0.M1 Please have a look and let me know Karan On Fri, Jul 1, 2011 at 2:29 AM, Michael Hunger michael.hun...@neotechnology.com wrote: Neo4j is not implementing storing and traversing memory only structures. So it would be really advisable to do that in your domain layer only. I'll look into the elements returning null. I thought I already solved that some time ago. Which version of SDG are you using? Cheers Michael Am 30.06.2011 um 15:00 schrieb V: Any suggestions on this please ? It is really acting as a blocker for me. I have tried multiple alternatives, but I come up with one issue or the other. On Wed, Jun 22, 2011 at 8:51 PM, V vlin...@gmail.com wrote: I am confused, elements is defined as @RelatedTo(type = ELEMENT, elementClass = Element.class, direction = OUTGOING) private SetElement elements; if I call getElements() without persisting the node first, will it not return null ? It is throwing null pointer exception. When I persist the node before calling getElements, then it returns empty set. This is in line with my original email. Do you want me to do something else? Please let me know On Wed, Jun 22, 2011 at 8:39 PM, Michael Hunger michael.hun...@neotechnology.com wrote: getElements() returns a set of your elements. If you do an add(element) on those then you build up an in-memory structure. So if you use just the getters and setters of your instances you can navigate this structure, but you can't use any of the graph operations supplied by neo4j (remember it is still just in memory) Cheers Michael Am 22.06.2011 um 17:06 schrieb V: Michael - In my quest for a cleaner solution , I am coming back to your original reply What do you mean by *Right now this works only with the getElements().add method.* Please elaborate . Thanks for your help . On Sun, Jun 19, 2011 at 2:34 AM, Michael Hunger michael.hun...@neotechnology.com wrote: Right now this works only with the getElements().add method. But then you don't get all the graph methods (traversals and such). We discussed some time ago writing a virtual graph layer on top of the real nodes and relationships for SDG. (That should be then used to have a simpler handling of attached/detached nodes and keeping back-references for cluster-persistance). But that hasn't happend yet and I'm not convinced it will make it in the 1.1. timeframe. Cheers Michael P.S. You can still persist your graph and remove the nodes later (either index them on a transient index or keep their node-id's somewhere). Am 18.06.2011 um 03:40 schrieb V: Any suggestions on this please ? On Fri, Jun 17, 2011 at 11:03 PM, V vlin...@gmail.com wrote: I created a graph model with 2 classes Node and Element as follows: public class Node { @RelatedTo(type = ELEMENT, elementClass = Element.class, direction = OUTGOING) private SetElement Element; public void addElement(Element e) { relateTo(e, Relationships.ELEMENT.toString()); } } public class Element{ public String name; } I want to create an in memory graph structure without persisting the nodes as follows : Node n = new Node(); n.addElement(new Element()); *However it throws an exception as the Node n has not been persisted so the call to relateTo(..) fails. * If instead I do n.persist() and then call addElement(..) it works fine as the aspect kicks in. Any workaround for this ? That is, is there a way I can still use the above style without persisting the Node object ? My application needs this as first I create a structure and persist it, and then I create another structure to pass around some values to the persisted structure when doing some computations. -Karan ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Can I model a Graph data structure without persisting it in DB using Neo4j ?
Michael - In my quest for a cleaner solution , I am coming back to your original reply What do you mean by *Right now this works only with the getElements().add method.* Please elaborate . Thanks for your help . On Sun, Jun 19, 2011 at 2:34 AM, Michael Hunger michael.hun...@neotechnology.com wrote: Right now this works only with the getElements().add method. But then you don't get all the graph methods (traversals and such). We discussed some time ago writing a virtual graph layer on top of the real nodes and relationships for SDG. (That should be then used to have a simpler handling of attached/detached nodes and keeping back-references for cluster-persistance). But that hasn't happend yet and I'm not convinced it will make it in the 1.1. timeframe. Cheers Michael P.S. You can still persist your graph and remove the nodes later (either index them on a transient index or keep their node-id's somewhere). Am 18.06.2011 um 03:40 schrieb V: Any suggestions on this please ? On Fri, Jun 17, 2011 at 11:03 PM, V vlin...@gmail.com wrote: I created a graph model with 2 classes Node and Element as follows: public class Node { @RelatedTo(type = ELEMENT, elementClass = Element.class, direction = OUTGOING) private SetElement Element; public void addElement(Element e) { relateTo(e, Relationships.ELEMENT.toString()); } } public class Element{ public String name; } I want to create an in memory graph structure without persisting the nodes as follows : Node n = new Node(); n.addElement(new Element()); *However it throws an exception as the Node n has not been persisted so the call to relateTo(..) fails. * If instead I do n.persist() and then call addElement(..) it works fine as the aspect kicks in. Any workaround for this ? That is, is there a way I can still use the above style without persisting the Node object ? My application needs this as first I create a structure and persist it, and then I create another structure to pass around some values to the persisted structure when doing some computations. -Karan ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Can I model a Graph data structure without persisting it in DB using Neo4j ?
getElements() returns a set of your elements. If you do an add(element) on those then you build up an in-memory structure. So if you use just the getters and setters of your instances you can navigate this structure, but you can't use any of the graph operations supplied by neo4j (remember it is still just in memory) Cheers Michael Am 22.06.2011 um 17:06 schrieb V: Michael - In my quest for a cleaner solution , I am coming back to your original reply What do you mean by Right now this works only with the getElements().add method. Please elaborate . Thanks for your help . On Sun, Jun 19, 2011 at 2:34 AM, Michael Hunger michael.hun...@neotechnology.com wrote: Right now this works only with the getElements().add method. But then you don't get all the graph methods (traversals and such). We discussed some time ago writing a virtual graph layer on top of the real nodes and relationships for SDG. (That should be then used to have a simpler handling of attached/detached nodes and keeping back-references for cluster-persistance). But that hasn't happend yet and I'm not convinced it will make it in the 1.1. timeframe. Cheers Michael P.S. You can still persist your graph and remove the nodes later (either index them on a transient index or keep their node-id's somewhere). Am 18.06.2011 um 03:40 schrieb V: Any suggestions on this please ? On Fri, Jun 17, 2011 at 11:03 PM, V vlin...@gmail.com wrote: I created a graph model with 2 classes Node and Element as follows: public class Node { @RelatedTo(type = ELEMENT, elementClass = Element.class, direction = OUTGOING) private SetElement Element; public void addElement(Element e) { relateTo(e, Relationships.ELEMENT.toString()); } } public class Element{ public String name; } I want to create an in memory graph structure without persisting the nodes as follows : Node n = new Node(); n.addElement(new Element()); However it throws an exception as the Node n has not been persisted so the call to relateTo(..) fails. If instead I do n.persist() and then call addElement(..) it works fine as the aspect kicks in. Any workaround for this ? That is, is there a way I can still use the above style without persisting the Node object ? My application needs this as first I create a structure and persist it, and then I create another structure to pass around some values to the persisted structure when doing some computations. -Karan ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Can I model a Graph data structure without persisting it in DB using Neo4j ?
I am confused, elements is defined as @RelatedTo(type = ELEMENT, elementClass = Element.class, direction = OUTGOING) private SetElement elements; if I call getElements() without persisting the node first, will it not return null ? It is throwing null pointer exception. When I persist the node before calling getElements, then it returns empty set. This is in line with my original email. Do you want me to do something else? Please let me know On Wed, Jun 22, 2011 at 8:39 PM, Michael Hunger michael.hun...@neotechnology.com wrote: getElements() returns a set of your elements. If you do an add(element) on those then you build up an in-memory structure. So if you use just the getters and setters of your instances you can navigate this structure, but you can't use any of the graph operations supplied by neo4j (remember it is still just in memory) Cheers Michael Am 22.06.2011 um 17:06 schrieb V: Michael - In my quest for a cleaner solution , I am coming back to your original reply What do you mean by *Right now this works only with the getElements().add method.* Please elaborate . Thanks for your help . On Sun, Jun 19, 2011 at 2:34 AM, Michael Hunger michael.hun...@neotechnology.com wrote: Right now this works only with the getElements().add method. But then you don't get all the graph methods (traversals and such). We discussed some time ago writing a virtual graph layer on top of the real nodes and relationships for SDG. (That should be then used to have a simpler handling of attached/detached nodes and keeping back-references for cluster-persistance). But that hasn't happend yet and I'm not convinced it will make it in the 1.1. timeframe. Cheers Michael P.S. You can still persist your graph and remove the nodes later (either index them on a transient index or keep their node-id's somewhere). Am 18.06.2011 um 03:40 schrieb V: Any suggestions on this please ? On Fri, Jun 17, 2011 at 11:03 PM, V vlin...@gmail.com wrote: I created a graph model with 2 classes Node and Element as follows: public class Node { @RelatedTo(type = ELEMENT, elementClass = Element.class, direction = OUTGOING) private SetElement Element; public void addElement(Element e) { relateTo(e, Relationships.ELEMENT.toString()); } } public class Element{ public String name; } I want to create an in memory graph structure without persisting the nodes as follows : Node n = new Node(); n.addElement(new Element()); *However it throws an exception as the Node n has not been persisted so the call to relateTo(..) fails. * If instead I do n.persist() and then call addElement(..) it works fine as the aspect kicks in. Any workaround for this ? That is, is there a way I can still use the above style without persisting the Node object ? My application needs this as first I create a structure and persist it, and then I create another structure to pass around some values to the persisted structure when doing some computations. -Karan ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Can I model a Graph data structure without persisting it in DB using Neo4j ?
Thanks Michael. I think this definitely would be an important layer to worth including soon. Meanwhile can you elaborate what you meant by transient index ? I would like to keep a very simplified design for transient graphs and not persist any nodes at all if possible. On Sun, Jun 19, 2011 at 2:34 AM, Michael Hunger michael.hun...@neotechnology.com wrote: Right now this works only with the getElements().add method. But then you don't get all the graph methods (traversals and such). We discussed some time ago writing a virtual graph layer on top of the real nodes and relationships for SDG. (That should be then used to have a simpler handling of attached/detached nodes and keeping back-references for cluster-persistance). But that hasn't happend yet and I'm not convinced it will make it in the 1.1. timeframe. Cheers Michael P.S. You can still persist your graph and remove the nodes later (either index them on a transient index or keep their node-id's somewhere). Am 18.06.2011 um 03:40 schrieb V: Any suggestions on this please ? On Fri, Jun 17, 2011 at 11:03 PM, V vlin...@gmail.com wrote: I created a graph model with 2 classes Node and Element as follows: public class Node { @RelatedTo(type = ELEMENT, elementClass = Element.class, direction = OUTGOING) private SetElement Element; public void addElement(Element e) { relateTo(e, Relationships.ELEMENT.toString()); } } public class Element{ public String name; } I want to create an in memory graph structure without persisting the nodes as follows : Node n = new Node(); n.addElement(new Element()); *However it throws an exception as the Node n has not been persisted so the call to relateTo(..) fails. * If instead I do n.persist() and then call addElement(..) it works fine as the aspect kicks in. Any workaround for this ? That is, is there a way I can still use the above style without persisting the Node object ? My application needs this as first I create a structure and persist it, and then I create another structure to pass around some values to the persisted structure when doing some computations. -Karan ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Can I model a Graph data structure without persisting it in DB using Neo4j ?
transient index only meaning an index that you add the nodes to that will be removed after your operation finished. Sorry to not be of more help here. Cheers Michael Am 20.06.2011 um 15:23 schrieb V: Thanks Michael. I think this definitely would be an important layer to worth including soon. Meanwhile can you elaborate what you meant by transient index ? I would like to keep a very simplified design for transient graphs and not persist any nodes at all if possible. On Sun, Jun 19, 2011 at 2:34 AM, Michael Hunger michael.hun...@neotechnology.com wrote: Right now this works only with the getElements().add method. But then you don't get all the graph methods (traversals and such). We discussed some time ago writing a virtual graph layer on top of the real nodes and relationships for SDG. (That should be then used to have a simpler handling of attached/detached nodes and keeping back-references for cluster-persistance). But that hasn't happend yet and I'm not convinced it will make it in the 1.1. timeframe. Cheers Michael P.S. You can still persist your graph and remove the nodes later (either index them on a transient index or keep their node-id's somewhere). Am 18.06.2011 um 03:40 schrieb V: Any suggestions on this please ? On Fri, Jun 17, 2011 at 11:03 PM, V vlin...@gmail.com wrote: I created a graph model with 2 classes Node and Element as follows: public class Node { @RelatedTo(type = ELEMENT, elementClass = Element.class, direction = OUTGOING) private SetElement Element; public void addElement(Element e) { relateTo(e, Relationships.ELEMENT.toString()); } } public class Element{ public String name; } I want to create an in memory graph structure without persisting the nodes as follows : Node n = new Node(); n.addElement(new Element()); However it throws an exception as the Node n has not been persisted so the call to relateTo(..) fails. If instead I do n.persist() and then call addElement(..) it works fine as the aspect kicks in. Any workaround for this ? That is, is there a way I can still use the above style without persisting the Node object ? My application needs this as first I create a structure and persist it, and then I create another structure to pass around some values to the persisted structure when doing some computations. -Karan ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Can I model a Graph data structure without persisting it in DB using Neo4j ?
Any suggestions on this please ? On Fri, Jun 17, 2011 at 11:03 PM, V vlin...@gmail.com wrote: I created a graph model with 2 classes Node and Element as follows: public class Node { @RelatedTo(type = ELEMENT, elementClass = Element.class, direction = OUTGOING) private SetElement Element; public void addElement(Element e) { relateTo(e, Relationships.ELEMENT.toString()); } } public class Element{ public String name; } I want to create an in memory graph structure without persisting the nodes as follows : Node n = new Node(); n.addElement(new Element()); *However it throws an exception as the Node n has not been persisted so the call to relateTo(..) fails. * If instead I do n.persist() and then call addElement(..) it works fine as the aspect kicks in. Any workaround for this ? That is, is there a way I can still use the above style without persisting the Node object ? My application needs this as first I create a structure and persist it, and then I create another structure to pass around some values to the persisted structure when doing some computations. -Karan ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user