I don't really understand you problem, but it sounds like if you have few
collection types you can go with relationship types by different names.
Else, if the number of collections is big you can make use of indexing,
http://components.neo4j.org/neo4j-index/ to index your nodes and get them
directly by name later on, f.ex:

   IndexService index = new LuceneIndexService( graphDb );

   Node startNode = graphDb.createNode();
   Node collectionType1 = graphDb.createNode();
   Node collectionType1_1 = graphDb.createNode();
   Node collectionType1_2 = graphDb.createNode();
   Node collectionType2 = graphDb.createNode();
   Node collectionType2_1 = graphDb.createNode();
   Node collectionType2_2 = graphDb.createNode();

   startNode.createRelationshipTo( collectionType1, myType );
   collectionType1.createRelationshipTo( collectionType1_1, myType );
   collectionType1.createRelationshipTo( collectionType1_2, myType );
   startNode.createRelationshipTo( collectionType2, myType );
   collectionType2.createRelationshipTo( collectionType2_1, myType );
   collectionType2.createRelationshipTo( collectionType2_2, myType );

   index.index( collectionType1, "collection_type", "1" );
   index.index( collectionType1_1, "collection_type", "1_1" );
   index.index( collectionType1_2, "collection_type", "1_2" );
   index.index( collectionType2, "collection_type", "2" );
   index.index( collectionType2_1, "collection_type", "2_1" );
   index.index( collectionType2_2, "collection_type", "2_2" );

   ....

   Node collectionType2_1 = index.getSingleNode( "collection_type", "2_1" );

2010/4/29 Stefan Berndt <kont...@stberndt.de>

> Hello I'm familiarizing with Neo4j more and more.
>
> After testing some rudimentary things I'm now trying to write my first
> Neo4j application with the following Graph:
>
> StartNode |----->CollectionType1--->CollectionType1_1
>          |           |
>          |           |------------>CollectionType1_2
>          |
>          |----->CollectionType2--->CollectionType2_1
>                      |------------>CollectionType2_2
>
> There are off course more Collections than 2 and the Items of the
> Collections are also more.
>
> Now I want define my Startnode as a really Startnode. and the Nodes
> CollectionType1...CollectionTypeN as reference nodes.
> Off course i can  get this nodes by GraphDataBaseService.getAllNodes() and
> iterate then over the Iterable until i've found my Node. But I dunno the
> Runtime Behavior if my nodespace becomes really big. Is there another Way
> to define this Startnodes or other important Nodes.
> I thank you for your help.
>
> Cheers,
> Stefan
>
> _______________________________________________
> Neo mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to