spmallette
spmallette
ATApache TinkerPop
Created by red on 10/14/2024 in #questions
Naming multiple vertices
@red like @Kelvin Lawrence i think that to give good advice we'd need to better understand what the query looks like prior to this point because i think it might be best to avoid trying to iterate two collections at the same time in Gremlin. it can be done, but it's not particularly pretty and often times rethinking how a query is written can remove the need to do that. if you could give us a Gremlin script with sample data and then what a full query looks like as an example then we could try to optimize it.
9 replies
ATApache TinkerPop
Created by pieter on 10/18/2024 in #questions
select T.id + optional properties
there's a number of ways you might try to solve that. how about just using coalesce() in the by():
gremlin> g = TinkerFactory.createModern().traversal()
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
gremlin> g.V().as('a').out().as('b').select('a','b').by('name').by('age')
==>[a:marko,b:27]
==>[a:marko,b:32]
gremlin> g.V().as('a').out().as('b').select('a','b').by('name').by(coalesce(values('age'), constant(-1)))
==>[a:marko,b:-1]
==>[a:marko,b:27]
==>[a:marko,b:32]
==>[a:josh,b:-1]
==>[a:josh,b:-1]
==>[a:peter,b:-1]
gremlin> g = TinkerFactory.createModern().traversal()
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
gremlin> g.V().as('a').out().as('b').select('a','b').by('name').by('age')
==>[a:marko,b:27]
==>[a:marko,b:32]
gremlin> g.V().as('a').out().as('b').select('a','b').by('name').by(coalesce(values('age'), constant(-1)))
==>[a:marko,b:-1]
==>[a:marko,b:27]
==>[a:marko,b:32]
==>[a:josh,b:-1]
==>[a:josh,b:-1]
==>[a:peter,b:-1]
the second one fails because you did select(...).elementMap(...) which isn't possible because elementMap() can't work on the Map that select() produces.
5 replies
ATApache TinkerPop
Created by Memo on 10/16/2024 in #questions
Basic vertex querying does not work in Amazon Neptune but it works with local Gremlin Server
Neptune does not yet support the "properties on elements" feature that was introduced in TinkerPop 3.7.x that allows graph elements like Vertex and Edge to be returned with properties. If you care to understand the history around this design choice you can read this: https://lists.apache.org/thread/xltcon4zxnwq4fyw2r2126syyrqm8spy In 3.7.x we describe how "properties on elements" works in the upgrade documentation: https://tinkerpop.apache.org/docs/current/upgrade/#_properties_on_elements It is therefore expected that when you return a Vertex with Neptune you don't get any properties, but it is odd that when you use elementMap() or valueMap() that you get empty maps. I'm not sure what to make of that. could you say what Neptune and TinkerPop versions you are using?
9 replies
ATApache TinkerPop
Created by gdotv on 10/17/2024 in #questions
Is there a way to specify a query execution timeout via the GremlinLangScriptEngine?
no, it's just like standard ScriptEngine implementations in that it operates in the current thread without interrupt. we'd wrapped the GremlinScriptEngine up into the GremlinExecutor to try to generalize behavior for timeouts and Future based execution. you would have to use that class to get that sort of behavior and avoid direct use of the GremlinLangScriptEngine directly.
5 replies
ATApache TinkerPop
Created by Alex on 10/11/2024 in #questions
Possibilities to improve performance on query?
with Neptune you can't use the profile() step. you have to use the /profile endpoint as shown in that link i provided
7 replies
ATApache TinkerPop
Created by Alex on 10/11/2024 in #questions
Possibilities to improve performance on query?
it might be helpful if you share a profile of your query: https://docs.aws.amazon.com/neptune/latest/userguide/gremlin-profile-api.html
7 replies
ATApache TinkerPop
Created by Max on 10/2/2024 in #questions
Confusing behavior of `select()`.
there is a trick for select() which i think i almost like as a trick more than if we made select() take any input: g.inject(1.0, 2.0, 3.0, 3.0).group().select(constant(3.0))
11 replies
ATApache TinkerPop
Created by nhthavn on 10/3/2024 in #questions
Neo4j news
The TinkerPop Community has long maintained compatibility with neo4j, but recent releases of neo4j haven't been made easily compatible for ongoing maintenance of that support. As a result, support for neo4j has been pinned to a really old version at 3.x. Recent discussions within the TinkerPop community are generally in favor of dropping support for neo4j for TinkerPop 4.x which was an easier decision now that TinkerGraph supports basic transactions giving us a way to test that functionality. As for your question about why we keep neo4j news in the #graph-news channel, I suppose i'm mostly responsible for that. As someone who has been working on TinkerPop since its earliest days, we've long thought of TinkerPop as a place to talk about graphs, not just TinkerPop enabled graph, but all graphs. Traditionally, it's been that way, but in more recent times that general conversation seems to have drifted to other places. You're the second person to question the inclusion of neo4j here in graph-news so perhaps there are more folks who find it confusing as to why it is present. it's also fairly noisy as they post with great consistency and if you follow graphs generally, you're probably getting that information other places already. i've been thinking about removing it. i'd be happy to hear if you or others agree with that happening.
5 replies
ATApache TinkerPop
Created by Julius Hamilton on 9/30/2024 in #questions
Good CLI REPL allowing unlabeled edges?
i think the recommendation would be to do as you suggested at the end of your qeustion and to just use default labels and just ignore them in Gremlin, like g.V().out() as opposed to g.V().out('default'). speaking more to your questions, i'm not sure what other graph frameworks you might use. i could be wrong, but i think NetworkX lets you create labelless graph elements: https://networkx.org/
4 replies
ATApache TinkerPop
Created by Max on 9/28/2024 in #questions
Sequential edge creation between streamed vertices
@Kelvin Lawrence do you have any other ways that you might do what's asked in this question?
5 replies
ATApache TinkerPop
Created by Max on 9/28/2024 in #questions
Sequential edge creation between streamed vertices
i think that's about as good as most approaches. we're missing a step that coudl simplify this code though. i've long wanted a partition() step so that you could change all that code to just:
g.V().hasLabel('person').
partition(2).
addE('next').from....
g.V().hasLabel('person').
partition(2).
addE('next').from....
5 replies
ATApache TinkerPop
Created by e8l on 9/27/2024 in #questions
[Bug?] gremlinpython is hanged up or not recovering connection after connection error has occurred
sorry it's taking a bit to reply here, but i think these cases might need a bit of investigation to get some answers. cc/ @Yang Xia
9 replies
ATApache TinkerPop
Created by red on 9/27/2024 in #questions
Vertex hashmaps
it needed deeper changes (and a mentality change) for years but those are in place now. so at this point its mostly a feature gap. note that, javascript and non jvm language variants still wont be able to execute Gremlin natively on the subgraph, but at least you can get a representation of the aubgraph to work with in other ways. building a Gremlin processing engine in each language would be awesome but thats not a gap we will likely see filled anytime soon :gremlin_smile:
7 replies
ATApache TinkerPop
Created by red on 9/27/2024 in #questions
Vertex hashmaps
since you tagged this question with javascript i think that aggregate() is probably your best approach. in java, you would probably prefer subgraph() because it gives you a Graph representation which you could in turn run Gremlin on and as a result is quite convenient. we hope to see better support for subgraph() in javascript (and other language variants) in future releases.
7 replies
ATApache TinkerPop
Created by nhthavn on 9/25/2024 in #questions
Benchmarking
that's a fairly broad question, so i'll give a broad answer. one of the nice things about TinkerPop is that it lets you connect to a lot of different graph databases with the same code, so it does allow you to compare performance of different graph databases. that said, doing a good benchmark is still a bit hard as it's not enough to just use Gremlin to generate a random graph and issue a few queries. among other things, a critical step is to gain a decent understanding of the workings of the graphs you want to test to get any sort of reasonable comparison. if you search the internet a bit, you will likely come across LDBC benchmark (https://ldbcouncil.org/benchmarks/snb/tools) for TinkerPop. I'm not sure that any are well maintained these days and from what i recall each had some issues that didn't make them ideal (e.g. sub-optimal Gremlin queries, improper indexing, etc). that said they might be something to look as a sort of starting point.
3 replies
ATApache TinkerPop
Created by Julius Hamilton on 9/24/2024 in #questions
Why is T.label immutable and do we have to create a new node to change a label?
yeah, i see that in sqlg's case you have a situation where changing the label for one vertex isn't quite as direct as something like TinkerGraph where it's probably just: vertex.setLabel("new-label") which updates a member variable.
20 replies
ATApache TinkerPop
Created by Julius Hamilton on 9/24/2024 in #questions
Why is T.label immutable and do we have to create a new node to change a label?
i see...you're thinking of a bigger picture and one that fits the specific nature of the OP's question about changing the label for all vertices of a particular label. you might just want to do that from a schema perspective, whre you are modifying the schema as a whole. i still think there is a Gremlin component though where you just want to do g.V(1).property(label, 'new-label') and just change it for one vertex.
20 replies
ATApache TinkerPop
Created by Julius Hamilton on 9/24/2024 in #questions
Why is T.label immutable and do we have to create a new node to change a label?
didn't really think too hard about it, but shouldn't we just allow property(label, 'new-label') to work?
20 replies
ATApache TinkerPop
Created by Julius Hamilton on 9/24/2024 in #questions
Why is T.label immutable and do we have to create a new node to change a label?
you have a few questions here @Julius Hamilton
Why is T.label immutable
i'm not sure there's a particular reason except to say that many graphs have not allowed that functionality so TinkerPop hasn't offered a way to do it.
and do we have to create a new node to change a label?
yes
We cannot do g.V('some label').property(T.label, 'new label').iterate()
no, because you can't modify the label as mentioned earlier, but also V() does not take a label as an argument. it would be more correct to do g.V().hasLabel('some label').property(...) to modify all things with a particular label (but, again label and id cannot be one of those things. you'd have to sort of clone the vertex. there are some patterns for doing it: https://stackoverflow.com/q/51900116/1831717 also, in the future, i think a mutable label probably should be allowed. we'll see how that comes to pass.
20 replies