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 <[email protected]> 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 Set<Element> 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
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to