sap13n
sap13n
ATApache TinkerPop
Created by sap13n on 6/12/2023 in #questions
Aggregating vertices with set-cardinality properties
You're a saint! Thanks!
15 replies
ATApache TinkerPop
Created by sap13n on 6/12/2023 in #questions
Aggregating vertices with set-cardinality properties
I'm curious though, in the *least-favorable solution you shared there is filter referencing keys and values:
choose(
select(keys).not(__.is('samples')),
select(values).unfold(),
select(values)
)
choose(
select(keys).not(__.is('samples')),
select(values).unfold(),
select(values)
)
Do they exist in the Java Client? I can't find __.keys() but thre are __.key() and __.values()
15 replies
ATApache TinkerPop
Created by sap13n on 6/12/2023 in #questions
Aggregating vertices with set-cardinality properties
so, perfect, this works!
15 replies
ATApache TinkerPop
Created by sap13n on 6/12/2023 in #questions
Aggregating vertices with set-cardinality properties
apologies, I copy-paste issue on my part. I wrapped the parameters in by('id') when it should just be by(id)
15 replies
ATApache TinkerPop
Created by sap13n on 6/12/2023 in #questions
Aggregating vertices with set-cardinality properties
@spmallette
15 replies
ATApache TinkerPop
Created by sap13n on 6/12/2023 in #questions
Aggregating vertices with set-cardinality properties
Whoa, thanks for the warning about local! Regarding vlabel and vid, looks like they are not returned from AWS Neptune.
15 replies
ATApache TinkerPop
Created by sap13n on 6/12/2023 in #questions
Aggregating vertices with set-cardinality properties
oh i see that map(...) is replaced by local(...) in my example but this means that that the result is the same in my tests. I was just tinkering with the query...
15 replies
ATApache TinkerPop
Created by sap13n on 6/12/2023 in #questions
Aggregating vertices with set-cardinality properties
Thanks @spmallette I was able to adjust the last suggestion to make it work the way I was expecting (I need the element Id and Label as well). Unfortunately I couldn't figure out how to include this information with project(...) This is the query I ended up with:
g.V()
.hasLabel('SampleContainer')
.filter(properties('samples').count().is(P.gte(2)))
.valueMap(true)
.local(unfold()
.group()
.by(keys)
.by(choose(
select(keys).not(__.is('samples')),
select(values).unfold(),
select(values)
)
)
)
g.V()
.hasLabel('SampleContainer')
.filter(properties('samples').count().is(P.gte(2)))
.valueMap(true)
.local(unfold()
.group()
.by(keys)
.by(choose(
select(keys).not(__.is('samples')),
select(values).unfold(),
select(values)
)
)
)
15 replies