Re: [Neo4j] New Bug Logged - Gremlin 114

2011-11-30 Thread Romiko Derbynew
Not too bad, I have a work around in our fluent api to reverse them.

-Original Message-
From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On 
Behalf Of Peter Neubauer
Sent: Wednesday, 30 November 2011 7:20 PM
To: Neo4j user discussions
Cc: mystory-develop...@barnardos.org.au
Subject: Re: [Neo4j] New Bug Logged - Gremlin 114

Thanks Romiko,
will look into it first time when I have time. How critical is it for you?

Cheers,

/peter neubauer

GTalk:      neubauer.peter
Skype       peter.neubauer
Phone       +46 704 106975
LinkedIn   http://www.linkedin.com/in/neubauer
Twitter      http://twitter.com/peterneubauer

brew install neo4j && neo4j start
heroku addons:add neo4j



On Wed, Nov 30, 2011 at 1:31 AM, Romiko Derbynew  
wrote:
> Hi,
>
> New bugged logged at: https://github.com/neo4j/community/issues/114
>
> Details below for others to peruse.
>
> Gremlin Table Projections - Column Order Incorrect when using chained 
> .As('x').As('y')
>
> EXPECTED Order: Createdy, ReferralGroup, ReferralId, ReferralData
>
> When AS statements appear next to each other.
> Consider A (WORKS - But not logical - have to reverse order when more than 1 
> AS statement is chained together right after each other for column array to 
> match):
> {"script":"g.v(0).outE[[label:'HOSTS']].inV.filter{ it.Key == 'romikoagency' 
> }.inE[[label:'USER_BELONGS_TO']].outV.filter{ it.Username == 
> 'romiko.derbynew' 
> }.as('CreatedBy').outE[[label:'USER_LINKED_TO_PROGRAM']].inV.as('ReferralGroup').inE[[label:'HAS_SUGGESTED_PROGRAM']].outV.inE[[label:'REFERRAL_HAS_DECISIONS_SECTION']].outV.as('ReferralDate').as('ReferralId').table(new
>  Table()){it.Username}{it.Name}{it.UniqueId}{it.DateInitiatedUtc}.cap"
> }
>
> notice: as('ReferralDate').as('ReferralId') and then notice the column 
> order below is opposite this: "columns"  "ReferralId", 
> "ReferralDate" ]
>
> Results
> [ [ {
> "data" : [ [ "romiko.derbynew", "Testa", 331, 
> "/Date(1322007153048+1100)/" ], [ "romiko.derbynew", "Testa", 321, 
> "/Date(1322003375637+1100)/" ]], "columns" : [ "CreatedBy", 
> "ReferralGroup", "ReferralId", "ReferralDate" ] } ] ]
>
>
> Consider B (Does not work - this is more LOGICAL from gremlin 
> perspective but is bugged, the Chained AS right after each other gets 
> reversed in the column array.) 
> {"script":"g.v(0).outE[[label:'HOSTS']].inV.filter{ it.Key == 'romikoagency' 
> }.inE[[label:'USER_BELONGS_TO']].outV.filter{ it.Username == 
> 'romiko.derbynew' 
> }.as('CreatedBy').outE[[label:'USER_LINKED_TO_PROGRAM']].inV.as('ReferralGroup').inE[[label:'HAS_SUGGESTED_PROGRAM']].outV.inE[[label:'REFERRAL_HAS_DECISIONS_SECTION']].outV.as('ReferralId').as('ReferralDate').table(new
>  Table()){it.Username}{it.Name}{it.UniqueId}{it.DateInitiatedUtc}.cap"
> }
>
> Notice: .as('ReferralId').as('ReferralDate') and then the columns 
> "columns"  "ReferralDate", "ReferralId" ]
>
> Results
> [ [ {
> "data" : [ [ "romiko.derbynew", "Testa", 331, 
> "/Date(1322007153048+1100)/" ]], "columns" : [ "CreatedBy", 
> "ReferralGroup", "ReferralDate", "ReferralId" ] } ] ]
>
>
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] New Bug Logged - Gremlin 114

2011-11-30 Thread Marko Rodriguez
Hi,

Actually, I know how to solve your problem. See below.

> g.v(0).outE[[label:'HOSTS']].inV.filter{ it.Key == 'romikoagency' 
> }.inE[[label:'USER_BELONGS_TO']].outV.filter{ it.Username == 
> 'romiko.derbynew' 
> }.as('CreatedBy').outE[[label:'USER_LINKED_TO_PROGRAM']].inV.as('ReferralGroup').inE[[label:'HAS_SUGGESTED_PROGRAM']].outV.inE[[label:'REFERRAL_HAS_DECISIONS_SECTION']].outV.as('ReferralId').as('ReferralDate').table(new
>  Table()){it.Username}{it.Name}{it.UniqueId}{it.DateInitiatedUtc}.cap

You can not do two as() steps in a row. Do a toString() on your Pipeline 
representation (e.g. cap.toString()). You will notice that your first as() 
step is wrapped by the second one. To rectify this, insert an identity. For 
example: as('ReferralId')._.as('ReferralDate').

Also, here are some optimizations to your expression that you might want to 
consider. The first and the third are to make it easier on the eyes (and a bit 
faster as well). The second is to make it faster.

outE[[label:'HOSTS']].inV   ---turn into--> 
 out('HOSTS')
filter{it.Key == 'romikoagency'}---turn into--> 
filter{it.getProperty('Key') == 'romikoagency'}
inE[[label:'USER_BELONGS_TO']].outV ---turn into--> 
in('USER_BELONGS_TO')

See: https://github.com/tinkerpop/gremlin/wiki/Gremlin-Groovy-Path-Optimizations

Enjoy!,
Marko.

http://markorodriguez.com

___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] New Bug Logged - Gremlin 114

2011-11-30 Thread Marko Rodriguez
Hi,

Please put this into the Gremlin issue tracker. 

https://github.com/tinkerpop/gremlin/issues

The table is not intended to be ordered with the location of the named "as" 
steps. It was just not engineered that way. However, others have brought this 
up. I suspect for Gremlin 1.5 (Gremlin 1.4 is being released soon), we can have 
the behavior ordered.

Thanks Romiko and Peter,
Marko.

http://markorodriguez.com

On Nov 30, 2011, at 1:20 AM, Peter Neubauer wrote:

> Thanks Romiko,
> will look into it first time when I have time. How critical is it for you?
> 
> Cheers,
> 
> /peter neubauer
> 
> GTalk:  neubauer.peter
> Skype   peter.neubauer
> Phone   +46 704 106975
> LinkedIn   http://www.linkedin.com/in/neubauer
> Twitter  http://twitter.com/peterneubauer
> 
> brew install neo4j && neo4j start
> heroku addons:add neo4j
> 
> 
> 
> On Wed, Nov 30, 2011 at 1:31 AM, Romiko Derbynew
>  wrote:
>> Hi,
>> 
>> New bugged logged at: https://github.com/neo4j/community/issues/114
>> 
>> Details below for others to peruse.
>> 
>> Gremlin Table Projections - Column Order Incorrect when using chained 
>> .As('x').As('y')
>> 
>> EXPECTED Order: Createdy, ReferralGroup, ReferralId, ReferralData
>> 
>> When AS statements appear next to each other.
>> Consider A (WORKS - But not logical - have to reverse order when more than 1 
>> AS statement is chained together right after each other for column array to 
>> match):
>> {"script":"g.v(0).outE[[label:'HOSTS']].inV.filter{ it.Key == 'romikoagency' 
>> }.inE[[label:'USER_BELONGS_TO']].outV.filter{ it.Username == 
>> 'romiko.derbynew' 
>> }.as('CreatedBy').outE[[label:'USER_LINKED_TO_PROGRAM']].inV.as('ReferralGroup').inE[[label:'HAS_SUGGESTED_PROGRAM']].outV.inE[[label:'REFERRAL_HAS_DECISIONS_SECTION']].outV.as('ReferralDate').as('ReferralId').table(new
>>  Table()){it.Username}{it.Name}{it.UniqueId}{it.DateInitiatedUtc}.cap"
>> }
>> 
>> notice: as('ReferralDate').as('ReferralId') and then notice the column order 
>> below is opposite this: "columns"  "ReferralId", "ReferralDate" ]
>> 
>> Results
>> [ [ {
>> "data" : [ [ "romiko.derbynew", "Testa", 331, "/Date(1322007153048+1100)/" 
>> ], [ "romiko.derbynew", "Testa", 321, "/Date(1322003375637+1100)/" ]],
>> "columns" : [ "CreatedBy", "ReferralGroup", "ReferralId", "ReferralDate" ]
>> } ] ]
>> 
>> 
>> Consider B (Does not work - this is more LOGICAL from gremlin perspective 
>> but is bugged, the Chained AS right after each other gets reversed in the 
>> column array.)
>> {"script":"g.v(0).outE[[label:'HOSTS']].inV.filter{ it.Key == 'romikoagency' 
>> }.inE[[label:'USER_BELONGS_TO']].outV.filter{ it.Username == 
>> 'romiko.derbynew' 
>> }.as('CreatedBy').outE[[label:'USER_LINKED_TO_PROGRAM']].inV.as('ReferralGroup').inE[[label:'HAS_SUGGESTED_PROGRAM']].outV.inE[[label:'REFERRAL_HAS_DECISIONS_SECTION']].outV.as('ReferralId').as('ReferralDate').table(new
>>  Table()){it.Username}{it.Name}{it.UniqueId}{it.DateInitiatedUtc}.cap"
>> }
>> 
>> Notice: .as('ReferralId').as('ReferralDate') and then the columns "columns" 
>>  "ReferralDate", "ReferralId" ]
>> 
>> Results
>> [ [ {
>> "data" : [ [ "romiko.derbynew", "Testa", 331, "/Date(1322007153048+1100)/" 
>> ]],
>> "columns" : [ "CreatedBy", "ReferralGroup", "ReferralDate", "ReferralId" ]
>> } ] ]
>> 
>> 
>> ___
>> Neo4j mailing list
>> User@lists.neo4j.org
>> https://lists.neo4j.org/mailman/listinfo/user
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user

___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] New Bug Logged - Gremlin 114

2011-11-30 Thread Peter Neubauer
Thanks Romiko,
will look into it first time when I have time. How critical is it for you?

Cheers,

/peter neubauer

GTalk:      neubauer.peter
Skype       peter.neubauer
Phone       +46 704 106975
LinkedIn   http://www.linkedin.com/in/neubauer
Twitter      http://twitter.com/peterneubauer

brew install neo4j && neo4j start
heroku addons:add neo4j



On Wed, Nov 30, 2011 at 1:31 AM, Romiko Derbynew
 wrote:
> Hi,
>
> New bugged logged at: https://github.com/neo4j/community/issues/114
>
> Details below for others to peruse.
>
> Gremlin Table Projections - Column Order Incorrect when using chained 
> .As('x').As('y')
>
> EXPECTED Order: Createdy, ReferralGroup, ReferralId, ReferralData
>
> When AS statements appear next to each other.
> Consider A (WORKS - But not logical - have to reverse order when more than 1 
> AS statement is chained together right after each other for column array to 
> match):
> {"script":"g.v(0).outE[[label:'HOSTS']].inV.filter{ it.Key == 'romikoagency' 
> }.inE[[label:'USER_BELONGS_TO']].outV.filter{ it.Username == 
> 'romiko.derbynew' 
> }.as('CreatedBy').outE[[label:'USER_LINKED_TO_PROGRAM']].inV.as('ReferralGroup').inE[[label:'HAS_SUGGESTED_PROGRAM']].outV.inE[[label:'REFERRAL_HAS_DECISIONS_SECTION']].outV.as('ReferralDate').as('ReferralId').table(new
>  Table()){it.Username}{it.Name}{it.UniqueId}{it.DateInitiatedUtc}.cap"
> }
>
> notice: as('ReferralDate').as('ReferralId') and then notice the column order 
> below is opposite this: "columns"  "ReferralId", "ReferralDate" ]
>
> Results
> [ [ {
> "data" : [ [ "romiko.derbynew", "Testa", 331, "/Date(1322007153048+1100)/" ], 
> [ "romiko.derbynew", "Testa", 321, "/Date(1322003375637+1100)/" ]],
> "columns" : [ "CreatedBy", "ReferralGroup", "ReferralId", "ReferralDate" ]
> } ] ]
>
>
> Consider B (Does not work - this is more LOGICAL from gremlin perspective but 
> is bugged, the Chained AS right after each other gets reversed in the column 
> array.)
> {"script":"g.v(0).outE[[label:'HOSTS']].inV.filter{ it.Key == 'romikoagency' 
> }.inE[[label:'USER_BELONGS_TO']].outV.filter{ it.Username == 
> 'romiko.derbynew' 
> }.as('CreatedBy').outE[[label:'USER_LINKED_TO_PROGRAM']].inV.as('ReferralGroup').inE[[label:'HAS_SUGGESTED_PROGRAM']].outV.inE[[label:'REFERRAL_HAS_DECISIONS_SECTION']].outV.as('ReferralId').as('ReferralDate').table(new
>  Table()){it.Username}{it.Name}{it.UniqueId}{it.DateInitiatedUtc}.cap"
> }
>
> Notice: .as('ReferralId').as('ReferralDate') and then the columns "columns" 
>  "ReferralDate", "ReferralId" ]
>
> Results
> [ [ {
> "data" : [ [ "romiko.derbynew", "Testa", 331, "/Date(1322007153048+1100)/" ]],
> "columns" : [ "CreatedBy", "ReferralGroup", "ReferralDate", "ReferralId" ]
> } ] ]
>
>
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] New Bug Logged - Gremlin 114

2011-11-29 Thread Romiko Derbynew
Hi,

New bugged logged at: https://github.com/neo4j/community/issues/114

Details below for others to peruse.

Gremlin Table Projections - Column Order Incorrect when using chained 
.As('x').As('y')

EXPECTED Order: Createdy, ReferralGroup, ReferralId, ReferralData

When AS statements appear next to each other.
Consider A (WORKS - But not logical - have to reverse order when more than 1 AS 
statement is chained together right after each other for column array to match):
{"script":"g.v(0).outE[[label:'HOSTS']].inV.filter{ it.Key == 'romikoagency' 
}.inE[[label:'USER_BELONGS_TO']].outV.filter{ it.Username == 'romiko.derbynew' 
}.as('CreatedBy').outE[[label:'USER_LINKED_TO_PROGRAM']].inV.as('ReferralGroup').inE[[label:'HAS_SUGGESTED_PROGRAM']].outV.inE[[label:'REFERRAL_HAS_DECISIONS_SECTION']].outV.as('ReferralDate').as('ReferralId').table(new
 Table()){it.Username}{it.Name}{it.UniqueId}{it.DateInitiatedUtc}.cap"
}

notice: as('ReferralDate').as('ReferralId') and then notice the column order 
below is opposite this: "columns"  "ReferralId", "ReferralDate" ]

Results
[ [ {
"data" : [ [ "romiko.derbynew", "Testa", 331, "/Date(1322007153048+1100)/" ], [ 
"romiko.derbynew", "Testa", 321, "/Date(1322003375637+1100)/" ]], 
"columns" : [ "CreatedBy", "ReferralGroup", "ReferralId", "ReferralDate" ]
} ] ]


Consider B (Does not work - this is more LOGICAL from gremlin perspective but 
is bugged, the Chained AS right after each other gets reversed in the column 
array.)
{"script":"g.v(0).outE[[label:'HOSTS']].inV.filter{ it.Key == 'romikoagency' 
}.inE[[label:'USER_BELONGS_TO']].outV.filter{ it.Username == 'romiko.derbynew' 
}.as('CreatedBy').outE[[label:'USER_LINKED_TO_PROGRAM']].inV.as('ReferralGroup').inE[[label:'HAS_SUGGESTED_PROGRAM']].outV.inE[[label:'REFERRAL_HAS_DECISIONS_SECTION']].outV.as('ReferralId').as('ReferralDate').table(new
 Table()){it.Username}{it.Name}{it.UniqueId}{it.DateInitiatedUtc}.cap"
}

Notice: .as('ReferralId').as('ReferralDate') and then the columns "columns" 
 "ReferralDate", "ReferralId" ]

Results
[ [ {
"data" : [ [ "romiko.derbynew", "Testa", 331, "/Date(1322007153048+1100)/" ]],
"columns" : [ "CreatedBy", "ReferralGroup", "ReferralDate", "ReferralId" ]
} ] ]


___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user