small medium large xlarge

Portrait_pragsmall
15 May 2012, 20:27
David Mitchell (8 posts)

I’m getting an error when attempting to do the elvis’ connection to kevin example in the console. I changed to ‘Albert Brooks’ since Elvis didn’t have very many links with the data I had in the db, but using neo4j’s data browser I was able to find Albert’s connection to Kevin so I thought I’d see what I could get there.

I get the following error:

No signature of method: com.tinkerpop.gremlin.groovy.GremlinGroovyPipeline.rightShift() is applicable for argument types: (java.lang.Integer) values: [1]

Here’s the code (pasted from the book, with the name changes):

bacon = g.V.filter{it.name == “Kevin Bacon”}.next() albert = g.V.filter{it.name == “Albert Brooks”}.next()

(albert.costars.loop(1){ it.loops < 4 & !it.object.equals(bacon) }.filter{it.equals(bacon)}.paths » 1).name.grep{it}

Portrait_pragsmall
15 May 2012, 20:49
David Mitchell (8 posts)

This, however, does work:

(albert.costars.loop(1){ it.loops < 4 & !it.object.equals(bacon) }.filter{it.equals(bacon)}.paths).next().name.grep{it}

as does this:

(albert.costars.loop(1){ it.loops < 4 & !it.object.equals(bacon) }.filter{it.equals(bacon)}.paths.next()).name.grep{it}

Portrait_pragsmall
15 May 2012, 21:05
David Mitchell (8 posts)

Then in Random Walk:

bacon.outE{ rand.nextDouble() <= 0.01 }.inV.inE.outV.loop(5){ it.loops < 3 }.name

Doesn’t work, but

bacon.outE.filter{ rand.nextDouble() <= 0.33 }.inV.inE.outV.loop(5){ it.loops < 3 }.name

does.

25233_377319146748_591736748_3799641_97127_n_pragsmall
12 Jun 2012, 23:59
Eric Redmond (21 posts)

Thanks for these. they made a non-passive change to groovy right before publishing (namely, “filter” used to be implied, but now it must be made explicit), but I believe we caught them all.

You must be logged in to comment