AT
Apache TinkerPopskywalker_101010
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
spmallette•88d 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_argumentsApache TinkerPop is an open source graph computing framework and the home of the Gremlin graph query language.
1.3KMembers
View on DiscordWant results from more Discord servers?
More PostsAdding multiple properties to a vertex using gremlin-goHello Community,
I have a question regarding how multiple properties can be added to a vertex using Is it possible to walk 2 different graphs using custom TraversalStrategy in Gremlin?I have 2 different graphs in 2 different Neptune cluster. Both of them can have few reference verticSideEffect a variable, Use it later after BarrierStep?I seek a query that builds a list and then needs to both sum the list's mapped values and divide theMemory issue on repeatI am traversing all nodes occuring in the same cluster given one of the nodes in that cluster.
SurpWhich database should i use for my DJ set planning software?Hi, i want to develop a software that lets DJs plan a set (i.e. playlist) and i'm wondering if graphHow will i add unique values to the vertices or edge properties in NeptuneI can't get a doc regarding adding unique data through gremlin. Is there any way to do it, other tha