Enter code here...
1) dictionary ={'name': g.V(vertex).values('name').next(),
'uid': g.V(vertex).values('uid').next(),
'email': g.V(vertex).values('email').next()}
2) dictionary = {g.V(vertex).valueMap().next()}
--
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-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/15d7a971-bb79-4eb4-b315-438453f8a38b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
gremlin> g.V(1).project("firstname","lastname","age").by(values("firstname", "name")).by(coalesce(values("lastname"), constant("N/A"))).by("age")==>[firstname:marko,lastname:N/A,age:29]
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/CAA-H43_qT4v1SOrDoQHcq7jqKLwXJAsLO3ADXaBoEa2Z31JWrg%40mail.gmail.com.
--
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-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/6e0594a0-4672-46a2-a2e3-f4384594fa1b%40googlegroups.com.
> For me it is quite obvious that if I have name property there will be only one name, if I have email there will be one email etc.It's not really quite obvious actually - it's a modelling choice. Maybe you would define "name" as being only one name, but someone else might use multi-properties to for a name field. How about this use case:g.addV('person').property(list,'name', 'robert', 'date', '1/1/1977').property(list,'name','bob','date','1/1/2017')keeping track of someone's name changes over time. Anyway, I guess my point is that while you might not use multi-properties, it is a feature of TinkerPop that people tend to make use of in graphs that support it. You just have to account for it in your traversals.
> I find queries in Gremlin quite wiredI'm not sure what you mean by that unless you meant to type "weird" instead of "wired" - hehe.
There are a number of OGM (object graph mapper) tools in the TinkerPop community if you find working with those kinds of tools easier for building applications. Some folks really like that approach. Perhaps you should consider looking at those. Of course, ultimately, I don't think you can completely escape having to write Gremlin (anymore that you can completely escape writing SQL when using an ORM with relational databases). Eventually, you will hit a scenario of sufficient complexity that will simply require it.
On Tue, Oct 17, 2017 at 3:03 PM, Tomasz <troj...@gmail.com> wrote:
Stephen, you are right about "selecting" only values which I really need but I don't understand why Gremlin prefers multi-properties. Do you know why does happen? For me it is quite obvious that if I have name property there will be only one name, if I have email there will be one email etc. It is standard in SQL database that fields are atomic.
I rewrite application which uses relations database with ORM and I find queries in Gremlin quite wired. I don't know if is true or I don't understand it (gremlin).
Tomek
--
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 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/0e17f620-6bc3-4bbb-8013-a4e918eb2ce4%40googlegroups.com.
g.addV('person').property(list,'name', 'robert', 'date', '1/1/1977').property(list,'name','bob','date','1/1/2017')
org.janusgraph.core.SchemaViolationException: Key is defined for SINGLE cardinality which conflicts with specified: list
--
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-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/d9cb55e1-12fb-4589-8035-8b7d21ba96c9%40googlegroups.com.