Do we have relationship properties now? I didn't realize that. Great ! Michael
Tobias Ivarsson schrieb: > Oh, and about querying Neo4j to find out Node/Relationship count: I think > this is coming as an MBean in an upcoming release, if not I should log a > ticket for it... > > Since sub-graphs is a user defined construct it will not be queryable in > this way, but if you use the code I just sent you can use the size() method > on the returned list. A harder problem is that of getting the size of a > sub-graph. But remember that Neo is transactional, so if you don't think you > will have much contention on the sub-graphs you can store the size as > properties on the relationship from the global reference node to the > subgraph reference node. > > About efficiency: storing disjunct sub-graphs in Neo as I previously > described it is just as efficient as storing one big connected graph. It > might even make your program more efficient since you will never have > contention in between sub-graphs. > > Regards > /Tobias > > On Tue, Oct 7, 2008 at 11:38 PM, Tobias Ivarsson < > [EMAIL PROTECTED]> wrote: > >> Hi John, >> >> The standard way of doing this is to have a special relationship type that >> takes you from the global reference node to the reference node of each >> sub-graph. This would give you the following pattern: >> >> List<Node> getReferenceNodes() >> { >> Node globalReferenceNode = neo.getReferenceNode(); >> List<Node> result = new LinkedList<Node>(); >> for (Relationship relation : >> globalReferenceNode.getRelationships(theSubgraphReferenceRelationshipType, >> Direction.OUTGOING) ) >> { >> result.add(relation.getEndNode()); >> } >> return result; >> } >> >> >> Typed relationships is really powerful for these sorts of things. >> >> Regards >> /Tobias >> >> >> On Tue, Oct 7, 2008 at 10:02 PM, John O'Hara <[EMAIL PROTECTED]> wrote: >> >>> Hi, I was looking over the neo4j project, and after reading the >>> wiki/quickstart guide, I had a quick question that I >>> couldn't seem to find addressed anywhere? >>> >>> Can Neo4j store multiple independent graphs effectively? >>> >>> Rather than just storing one large graph in Neo4j, I'd like to a store a >>> collection of many independent (disconnected) >>> graphs. What is the best practice for dealing with this, and can it be >>> done effectively with Neo4j? How would I go >>> about finding all the independent graphs that I currently have stored? It >>> seems like I would need the >>> getReferenceNode() method to return me a list, instead of just a single >>> node, but I don't see any talk of this use case. >>> >>> >>> Could I query neo4j to find out how many graphs I have, and how big (in >>> node count, or edge count, or some metric) each >>> one is? >>> >>> >>> >>> Regards, >>> John >>> _______________________________________________ >>> Neo mailing list >>> User@lists.neo4j.org >>> https://lists.neo4j.org/mailman/listinfo/user >>> >> >> >> -- >> Tobias Ivarsson <[EMAIL PROTECTED]> >> Hacker, Neo Technology >> www.neotechnology.com >> Cellphone: +46 706 534857 >> > > > -- Michael Hunger Independent Consultant Web: http://www.jexp.de Email: [EMAIL PROTECTED] Enthusiastic Evangelist for Better Software Development Don't stop where you are: http://creating.passionate-developers.org We support Software Engineering Radio (www.se-radio.net) _______________________________________________ Neo mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user