Tree pattern issues

23 views
Skip to first unread message

Alexei Tenitski

unread,
May 6, 2012, 11:40:08 PM5/6/12
to ne...@googlegroups.com
Hi there,

The problem I'm trying to solve is getting a set of nodes with there
related nodes (so, a set of trees).

Ie i want to select a list of objects and get tags assigned to them at
the same time (rather then do a separate call for each object).

Looks like there's some tree functionality available as described in
Tree Patter doc here:

https://github.com/tinkerpop/gremlin/wiki/Tree-Pattern

However, queries from that doc dont work in my case:

gremlin> g = TinkerGraphFactory.createTinkerGraph()
==> tinkergraph[vertices:6 edges:6]

gremlin> g.v(1).out.out.path
==> null

gremlin> g.v(1).out.out.path()
==> [v[1], v[4], v[5]]
==> [v[1], v[4], v[3]]

gremlin> g.v(1).out.out.tree.cap
undefined

==> g.v(1).out.out.tree.cap()
undefined

==> g.v(1).out.out.tree().cap()
==> No signature of method:
com.tinkerpop.gremlin.groovy.GremlinGroovyPipeline.tree() is applicable
for argument types: () values: []
==> Possible solutions: grep(), take(int), grep(java.lang.Object),
reset(), size(), store()

Some problem calling tree step, not sure what it the correct way.

Does anyone know what could be the issue here?

I'm using Neo4j 1.61

Cheers,
Alexei



Marko Rodriguez

unread,
May 6, 2012, 11:42:41 PM5/6/12
to ne...@googlegroups.com

Hi,

The tree step is in SNAPSHOT and hasn't been released yet. Do you Maven or are you simply using Gremlin via Neo Server GUI?

Marko.

http://markorodriguez.com

Alexei Tenitski

unread,
May 7, 2012, 12:14:14 AM5/7/12
to ne...@googlegroups.com
Hi Marco,

Using server GUI. What is Maven? I use REST in application and GUI to
play with Neo.

Does 1.7 include trees support?

Anyway, the original problem - getting a node and tag nodes linked to it
- it is something i would be able to do using the trees functionality?
Returning trees rather then flat lists would be a major point of
difference to rational DBs.

Cheers,
Alexei

Marko Rodriguez wrote:
> Hi,
>
> The tree step is in SNAPSHOT and hasn't been released yet. Do you Maven
> or are you simply using Gremlin via Neo Server GUI?
>
> Marko.
>
> http://markorodriguez.com
>
> On May 6, 2012 9:40 PM, "Alexei Tenitski" <ale...@ten.net.nz
> <mailto:ale...@ten.net.nz>> wrote:
>
> Hi there,
>
> The problem I'm trying to solve is getting a set of nodes with there
> related nodes (so, a set of trees).
>
> Ie i want to select a list of objects and get tags assigned to them
> at the same time (rather then do a separate call for each object).
>
> Looks like there's some tree functionality available as described in
> Tree Patter doc here:
>
> https://github.com/tinkerpop/__gremlin/wiki/Tree-Pattern
> <https://github.com/tinkerpop/gremlin/wiki/Tree-Pattern>
>
> However, queries from that doc dont work in my case:
>
> gremlin> g = TinkerGraphFactory.__createTinkerGraph()
> ==> tinkergraph[vertices:6 edges:6]
>
> gremlin> g.v(1).out.out.path
> ==> null
>
> gremlin> g.v(1).out.out.path()
> ==> [v[1], v[4], v[5]]
> ==> [v[1], v[4], v[3]]
>
> gremlin> g.v(1).out.out.tree.cap
> undefined
>
> ==> g.v(1).out.out.tree.cap()
> undefined
>
> ==> g.v(1).out.out.tree().cap()
> ==> No signature of method:
> com.tinkerpop.gremlin.groovy.__GremlinGroovyPipeline.tree() is

Marko Rodriguez

unread,
May 7, 2012, 10:05:27 AM5/7/12
to ne...@googlegroups.com
Hi,

> Using server GUI. What is Maven? I use REST in application and GUI to play with Neo.

Tree will not be available in Neo4j until the next release of Gremlin which is planned this month .

> Does 1.7 include trees support?

No.

> Anyway, the original problem - getting a node and tag nodes linked to it - it is something i would be able to do using the trees functionality? Returning trees rather then flat lists would be a major point of difference to rational DBs.

Yes, you would get your result as a Tree data structure with the ability to use dot notation to walk it.

root.child1.child11.child112 ....

Good luck with your project,
Marko.

http://markorodriguez.com

Alexei Tenitski

unread,
May 8, 2012, 5:17:36 PM5/8/12
to ne...@googlegroups.com
I see, thanks Marco, I'll use subqueries for now then.
Reply all
Reply to author
Forward
0 new messages