Dynamic select within query not working.

Any insights or help would be greatly appreciated. I have to pass a list of lists in the format below. Hundreds of them which is why I'm trying to iterate in a single query. Please explain why accessing element 0 within the row data works here: g.inject([['2011-12-01', 3873], ['2023-12-02', 3946], ['2023-12-03', 3997]]). unfold().as('row'). coalesce( select('row').limit(local, 1).unfold() ) But nesting the select within the query to return a matching Vertex does not: g.inject([['2011-12-01', 3873], ['2023-12-02', 3946], ['2023-12-03', 3997]]). unfold().as('row'). coalesce( __.V().hasLabel('UsdValue').has('date', select('row').limit(local, 1).unfold()) ) Ultimately trying to create an if/then exists query but I can't get it to even match.
Solution:
Sorry it took a while for someone to get to this. I think your problem here is that you are trying to use has(String, Traversal) in __.V().hasLabel('UsdValue').has('date', select('row').limit(local, 1).unfold()) but it doesn't work the way you expect. basically, the result of the traversal you give to has() is not given as the value to the comparator. More generally, P does not take a Traversal making any such usage impossible. It is designed to work such that the value of "UsdValue" i...
Jump to solution
1 Reply
Solution
spmallette
spmallette11mo ago
Sorry it took a while for someone to get to this. I think your problem here is that you are trying to use has(String, Traversal) in __.V().hasLabel('UsdValue').has('date', select('row').limit(local, 1).unfold()) but it doesn't work the way you expect. basically, the result of the traversal you give to has() is not given as the value to the comparator. More generally, P does not take a Traversal making any such usage impossible. It is designed to work such that the value of "UsdValue" is given to your Traversal argument and if that returns a value the filter is found to be true. We document this in the Reference Documentation at https://tinkerpop.apache.org/docs/current/reference/#has-step and have a more detailed account here: https://tinkerpop.apache.org/docs/3.7.1/recipes/#_has_and_traversal_arguments
Want results from more Discord servers?
Add your server