Hi, 

A fast tip.

The traversal:

> g.v(0).outE[[label:'HOSTS']].inV[[Key:'MyCompanyName']].inE[[label:'IS_COMPANY']].inV


can be written as:

        g.v(0).out('HOSTS')[[Key:'MyCompanyName']].in('IS_COMPANY')

The latter is more succinct and should be a bit faster to evaluate.

** The steps out and in were added to Gremlin 0.9+.

Just a heads up,
Marko.

http://markorodriguez.com

On Jun 19, 2011, at 11:55 PM, Romiko Derbynew wrote:

> Hi Guys,
> 
> 
> 
> We currently thinking of how we can get type safety when we do queries, one 
> thing we do is have a category nodes, so e.g.
> 
> Here is a sample query
> 
> 
> 
> IEnumerable<User> list = 
> g.v(0).outE[[label:'HOSTS']].inV[[Key:'MyCompanyName']].inE[[label:'IS_COMPANY']].inV
> 
> 
> 
> So the part highlighted in bold leverages the category.
> 
> 
> 
> However, we could also remove the category node (Agencies) and then just have 
> more explicit relationships e.g.
> 
> IEnumerable<User> list = 
> g.v(0).outE[[label:'HOSTS_AGENCY']].inV[[Key:'MyCompanyName']].
> 
> 
> 
> 
> 
> Notice, here we now have a relationship where from the name we can see that 
> the types coming back will always be an Agency. This means relationship names 
> have information about it's target Node type, making the amount of 
> relationships proportional to the number of node types.
> 
> 
> 
> What are the advantages/disadvantages of both approaches, which achieve the 
> same result?
> 
> 
> 
> Regards
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user

_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to