v1Id = 123456;
v2Id = 654321;
g.V(v1Id).as('v1').match(
__.as('v1').both('someEdgeLabel').count().as('v1LinkedVertices').filter(
both('someEdgeLabel').id().is(eq(v2Id))
).count().as('v1DirectCommonVerticesWithV2'),
).select('v1LinkedVertices', 'v1DirectCommonVerticesWithV2')
[
{
v1LinkedVertices: x, // x = number
v1DirectCommonVerticesWithV2: y // y = number
}
]
[
{
v1LinkedVertices_MinusOne: x-1, // x = number
v1DirectCommonVerticesWithV2_MultipliedByTwo: 2*y, // x = number
stuffDoneHere: z // z = x/y}
]
gremlin> g.V().values("age")==>29==>27==>32==>35
gremlin> g.V().values("age").sum()==>123
gremlin> g.V().values("age").fold(1, mult)==>876960
gremlin> g.V().values("age").map(union(identity(), constant(-1)).sum())==>28==>26==>31==>34
gremlin> g.V().values("age").map(union(identity(), identity()).sum())==>58==>54==>64==>70
gremlin> g.V().values("age").map(union(identity(), constant(2)).fold(1, mult))==>58==>54==>64==>70
--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/855b0fca-dae7-4a17-a6cf-634a078d54cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
userId = 40968224
jobId = 12320
g.V().hasLabel('joboffer').as('job').match(
__.as('job').out('tagged').count().as('jobTags'),
__.as('job').both('tagged').hasLabel('tag').filter(
both('knows').hasLabel('user').id().is(eq(userId))
).count().as('commonTags'),
).select('jobTags', 'commonTags')
[ { jobTags: 5, commonTags: 3 } ]
userId = 40968224
jobId = 12320
g.V().hasLabel('joboffer').as('job').match(
__.as('job').out('tagged').count().as('jobTags'),
__.as('job').both('tagged').hasLabel('tag').filter(
both('knows').hasLabel('user').id().is(eq(userId))
).count().as('commonTags'),
).select('jobTags', 'commonTags')
I can assure you that this query is working
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/ce35a666-c788-47ee-a39e-00f5a2ccd79f%40googlegroups.com.
I don't have a solution for divisions that doesn't use lambdas.
--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/a2bacdca-f495-42da-97f8-df7df9e557fb%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/183231ab-e69f-42e6-830a-4bc2e069d023%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/f7293ffd-d9fa-46bd-aef0-6e151e7350ff%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/dfcfe21f-ec3d-4d51-9ae6-478b5587715b%40googlegroups.com.