Date
1 - 11 of 11
Dynamic edge creation
Ankur Goel <ankur...@...>
Hi, In JanusGraph to create edges we have two steps process:
Linkage between both steps is through App only. How ever in neo4j, we can create edges using one step: MATCH (a:player), (b:Country) WHERE a.POB = "X" AND b.name = "Y" CREATE (a)-[r: Z]->(b) RETURN a,b Can we achieve the same in JanusGraph using Janus or tinkerpoop. ~AnkurG
|
|
Robert Dale <rob...@...>
g.V().has('player','POB','X').as('a').V().has('Country','name','Y').addE('Z').from('a') or you can flip it around g.V().has('Country','name','Y').as('b').V().has('player','POB','X').addE('Z').to('b') Robert Dale
On Fri, Sep 15, 2017 at 5:32 AM, Ankur Goel <ankur...@...> wrote:
|
|
Robert Dale <rob...@...>
Robert Dale
On Fri, Sep 15, 2017 at 6:56 AM, Robert Dale <rob...@...> wrote:
|
|
Ankur Goel <ankur...@...>
Thnx Robert, i am looking for a query like create edges where they have common properties without explicitly defining properties values: g.V().has('player','POB',${A}). ~AnkurG
On Friday, September 15, 2017 at 3:02:46 PM UTC+5:30, Ankur Goel wrote:
|
|
Robert Dale <rob...@...>
g.V().hasLabel('player').as('player').V().hasLabel('Country').where(eq('player')).by('name').by('POB').addE('Z').from('player') Robert Dale
On Fri, Sep 15, 2017 at 9:44 AM, Ankur Goel <ankur...@...> wrote:
|
|
Daniel Kuppitz <me@...>
This should do the trick:
However, note that this query will do 2 full table scans under the hood (unless Janus already has some runtime optimization that I'm not aware of). In any case it will be at least one full table scan. Cheers, Daniel On Fri, Sep 15, 2017 at 6:44 AM, Ankur Goel <ankur...@...> wrote:
|
|
Daniel Kuppitz <me@...>
Oops, Gmail didn't notify me about your response, sorry for the double-post.
On Fri, Sep 15, 2017 at 6:57 AM, Robert Dale <rob...@...> wrote:
|
|
Ankur Goel <ankur...@...>
Thnx Robert n Daniel, Its working like charm. But it got stuck in other use case: where i want to create relation based on team: g.V().hasLabel('player').as('p1').V().hasLabel('player').where(eq('l1')).by('teamName').addE('sameTeam').from('p1') in this i want to create edges between same teamName player. Above gremlin query is working but creating all combination of edges. For example for a 3 node of player label having same team name, its creating 9 edges, instead of 3 only. Double edges for between two vertex and one loop to same vertex. ~AnkurG
On Fri, Sep 15, 2017 at 7:54 PM, Daniel Kuppitz <me@...> wrote:
|
|
Robert Dale <rob...@...>
If `l1` is `p1` then yes, this will create an edge from every player p1 to every player p2. You're not filtering anything out so all players show up in both `V().hasLabel('player')`. If you want to filter out `self` and `has existing 'sameTeam' edge, try this: g.V().hasLabel('player').as('p1').V().hasLabel('player').where(neq('p1')).where(eq('p1')).by('teamName') Robert Dale
On Mon, Sep 18, 2017 at 1:58 AM, Ankur Goel <ankur...@...> wrote:
|
|
Robert Dale <rob...@...>
On Monday, September 18, 2017 at 6:21:59 AM UTC-4, Robert Dale wrote:
|
|
Ankur Goel <ankur...@...>
Thnx Robert, it helped big time.
On Friday, September 15, 2017 at 3:02:46 PM UTC+5:30, Ankur Goel wrote:
|
|