#### Dynamic edge creation

Ankur Goel <ankur...@...>

Hi,

In JanusGraph to create edges we have two steps process:
1. First identify the vertex
2. Then create edges between vertex
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...@...>

or you can flip it around

Robert Dale

On Fri, Sep 15, 2017 at 5:32 AM, Ankur Goel wrote:
Hi,

In JanusGraph to create edges we have two steps process:
1. First identify the vertex
2. Then create edges between vertex
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

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.

Robert Dale <rob...@...>

Robert Dale

On Fri, Sep 15, 2017 at 6:56 AM, Robert Dale wrote:

or you can flip it around

Robert Dale

On Fri, Sep 15, 2017 at 5:32 AM, Ankur Goel wrote:
Hi,

In JanusGraph to create edges we have two steps process:
1. First identify the vertex
2. Then create edges between vertex
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

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.

Ankur Goel <ankur...@...>

Thnx Robert,

i am looking for a query like create edges where they have common properties without explicitly defining properties values:

~AnkurG

On Friday, September 15, 2017 at 3:02:46 PM UTC+5:30, Ankur Goel wrote:
Hi,

In JanusGraph to create edges we have two steps process:
1. First identify the vertex
2. Then create edges between vertex
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...@...>

Robert Dale

On Fri, Sep 15, 2017 at 9:44 AM, Ankur Goel wrote:
Thnx Robert,

i am looking for a query like create edges where they have common properties without explicitly defining properties values:

~AnkurG

On Friday, September 15, 2017 at 3:02:46 PM UTC+5:30, Ankur Goel wrote:
Hi,

In JanusGraph to create edges we have two steps process:
1. First identify the vertex
2. Then create edges between vertex
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

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.

Daniel Kuppitz <me@...>

This should do the trick:

g.V().has('player').as('a').
V().has('Country').where(eq('a')).by('name').by('POB').

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 wrote:
Thnx Robert,

i am looking for a query like create edges where they have common properties without explicitly defining properties values:

~AnkurG

On Friday, September 15, 2017 at 3:02:46 PM UTC+5:30, Ankur Goel wrote:
Hi,

In JanusGraph to create edges we have two steps process:
1. First identify the vertex
2. Then create edges between vertex
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

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.

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 wrote:

Robert Dale

On Fri, Sep 15, 2017 at 9:44 AM, Ankur Goel wrote:
Thnx Robert,

i am looking for a query like create edges where they have common properties without explicitly defining properties values:

~AnkurG

On Friday, September 15, 2017 at 3:02:46 PM UTC+5:30, Ankur Goel wrote:
Hi,

In JanusGraph to create edges we have two steps process:
1. First identify the vertex
2. Then create edges between vertex
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

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/CABed_4q6%3DB%2BNPgu-QgFETS1fjckAVF%3DbVCWMnaT7%3Dyq1o6eCpg%40mail.gmail.com.

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:

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:
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 wrote:

Robert Dale

On Fri, Sep 15, 2017 at 9:44 AM, Ankur Goel wrote:
Thnx Robert,

i am looking for a query like create edges where they have common properties without explicitly defining properties values:

~AnkurG

On Friday, September 15, 2017 at 3:02:46 PM UTC+5:30, Ankur Goel wrote:
Hi,

In JanusGraph to create edges we have two steps process:
1. First identify the vertex
2. Then create edges between vertex
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

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/CABed_4q6%3DB%2BNPgu-QgFETS1fjckAVF%3DbVCWMnaT7%3Dyq1o6eCpg%40mail.gmail.com.

--
You received this message because you are subscribed to a topic in the Google Groups "JanusGraph users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/janusgraph-users/7Cn4G__XGjU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/CA%2Bf9seVEwxs2%2BHFmQV-8mJ_2LU79tjkAJ5AeorsH%3De2PtLwk4g%40mail.gmail.com.

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:

Robert Dale

On Mon, Sep 18, 2017 at 1:58 AM, Ankur Goel wrote:
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:

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:
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 wrote:

Robert Dale

On Fri, Sep 15, 2017 at 9:44 AM, Ankur Goel wrote:
Thnx Robert,

i am looking for a query like create edges where they have common properties without explicitly defining properties values:

~AnkurG

On Friday, September 15, 2017 at 3:02:46 PM UTC+5:30, Ankur Goel wrote:
Hi,

In JanusGraph to create edges we have two steps process:
1. First identify the vertex
2. Then create edges between vertex
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

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/CABed_4q6%3DB%2BNPgu-QgFETS1fjckAVF%3DbVCWMnaT7%3Dyq1o6eCpg%40mail.gmail.com.

--
You received this message because you are subscribed to a topic in the Google Groups "JanusGraph users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/janusgraph-users/7Cn4G__XGjU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/CA%2Bf9seVEwxs2%2BHFmQV-8mJ_2LU79tjkAJ5AeorsH%3De2PtLwk4g%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/CAFDtHAns%3Do9iTrB7q8w%2Bz%2BWvuQvcf9KXnfyOgg2JRGnVg-0sQQ%40mail.gmail.com.

Robert Dale <rob...@...>

Change `outE()` to `bothE()` since you don't care about direction.

On Monday, September 18, 2017 at 6:21:59 AM UTC-4, Robert Dale wrote:
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:

Robert Dale

On Mon, Sep 18, 2017 at 1:58 AM, Ankur Goel wrote:
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:

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:
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 wrote:

Robert Dale

On Fri, Sep 15, 2017 at 9:44 AM, Ankur Goel wrote:
Thnx Robert,

i am looking for a query like create edges where they have common properties without explicitly defining properties values:

~AnkurG

On Friday, September 15, 2017 at 3:02:46 PM UTC+5:30, Ankur Goel wrote:
Hi,

In JanusGraph to create edges we have two steps process:
1. First identify the vertex
2. Then create edges between vertex
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

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/CABed_4q6%3DB%2BNPgu-QgFETS1fjckAVF%3DbVCWMnaT7%3Dyq1o6eCpg%40mail.gmail.com.

--
You received this message because you are subscribed to a topic in the Google Groups "JanusGraph users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/janusgraph-users/7Cn4G__XGjU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/CA%2Bf9seVEwxs2%2BHFmQV-8mJ_2LU79tjkAJ5AeorsH%3De2PtLwk4g%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/CAFDtHAns%3Do9iTrB7q8w%2Bz%2BWvuQvcf9KXnfyOgg2JRGnVg-0sQQ%40mail.gmail.com.

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:
Hi,

In JanusGraph to create edges we have two steps process:
1. First identify the vertex
2. Then create edges between vertex
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

 1 - 11 of 11