just describe your domain and your use-cases for usage and the graph model you developed and we can discuss it.
Michael Sent from my iBrick4 Am 15.06.2011 um 02:43 schrieb Tatham Oddie <[email protected]>: > Hi Michael, > > (Warning: graph db n00b disclaimer still applies) > > Category nodes are an interesting approach. > > Would you mind validating the graph we've come up with to make sure we're on > the right track? > > > -- Tatham > > > -----Original Message----- > From: [email protected] [mailto:[email protected]] On > Behalf Of Michael Hunger > Sent: Wednesday, 15 June 2011 1:42 AM > To: Neo4j user discussions > Subject: Re: [Neo4j] Query Number of Nodes with Property Filter > > you can use category nodes to connect nodes of a certain type to. > > then you can count the nodes using a traversal > > you dont have to go via an index to do things like that > > > Sent from my iBrick4 > > > Am 14.06.2011 um 17:10 schrieb Marko Rodriguez <[email protected]>: > >> Hi, >> >>> Is it possible that when we create the Automatic Index, that we can filter >>> it on specific nodes? >> >> No. >> >>> Referring to the diagram below, we have a Node with a property _Type= >>> Agency. I would like to create an index (aidx-agency-key) based on Key but >>> only for the Nodes with _Type=Agency. >>> So, pseudo code would be: >>> g.createAutomaticIndex('myIndex', Vertex.class, new pair[,] >>> {Node._Type=Agency},“Key”) >>> >>> Is this the right approach, or are we doing something wrong >> >> You can't do that with AutomaticIndices. >> >>> The solution we want is to be able to count all the Nodes in the database >>> with a property _Type=Agency and property Key=”myKey” or to checking the >>> existence of a Node with _Type=”Agency” and Key=”myKey”. >> >> Yea. The not so efficient way to do that is: >> >> g.idx('myIndex').get('_Type','Agency')[[key:'myKey']].count() >> >> 1. get agencies >> 2. iterate and filter out those whose key doesn't equal 'myKey' >> 3. count up what gets emitted from the pipeline. >> >> Perhaps Neo4j guys can help as there are some things with Lucene indices and >> the 'AND' clause. Given that AutomaticIndex, when used with Neo4jGraph, is >> just a wrapper to Lucene, I believe you can do stuff like '_Type AND >> Key=myKey' ? -- I've never done it so I don't know... Rick, on this list, >> knows the ins and outs of indices.... >> >>> >>> and to do a count or check if it exists would be multiple filters >>> g.V[[_Typey:Agency],[ Name:Acme]].count() >> >> Yea, thats a bit excessive -- too many things to iterate through. You can do >> the previous: >> g.idx('myIndex').get('_Type','Agency')[[key:'myKey']].count() >> >>> >> >> Good luck, >> Marko. >> >> http://markorodriguez.com >> >> _______________________________________________ >> Neo4j mailing list >> [email protected] >> https://lists.neo4j.org/mailman/listinfo/user > _______________________________________________ > Neo4j mailing list > [email protected] > https://lists.neo4j.org/mailman/listinfo/user > <ReferenceGraph-WithCategoryNodes.png> > _______________________________________________ > Neo4j mailing list > [email protected] > https://lists.neo4j.org/mailman/listinfo/user _______________________________________________ Neo4j mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

