how to merge data from two different sources

41 views
Skip to first unread message

Minh_Tiến

unread,
Sep 1, 2021, 8:10:48 AM9/1/21
to Gremlin-users
Hi all,
I am using AWS neptune to unify my data. My sample data as below
                        Vertex: Online
"~id",entity_id:int,parent_id:int,telephone:int,"~label"
"customer_address0","Anny",0909323818,"customer_address"
"customer_address1","Henry",0382889432  ,"customer_address"
"customer_address2","Daniel",13845,0929663369,"customer_address"
"customer_address3","Mark",0929663369,"customer_address"
"customer_address4","Janny",0919904009,"customer_address"
"customer_address5","James",0792233312  ,"customer_address"
"customer_address6","Jack",0919914707,"customer_address"

                      Vertex: Retail
"~id",phone:int,"~label"
"membership_card0", 0382889432,"membership_card"
"membership_card1", 0335766266,"membership_card"
"membership_card2", 0393296194,"membership_card"
"membership_card3", 0763167990,"membership_card"
"membership_card4", 0785830911,"membership_card"
"membership_card5", 0792233312,"membership_card"
we can see 0382889432 and 0792233312 are the same person. So how to unify data like this using Gremlin? 
Thanks!

Stephen Mallette

unread,
Sep 2, 2021, 6:38:38 AM9/2/21
to gremli...@googlegroups.com
Could you please clarify what you wish to have merged and how you need it done in your case? I'm not sure I follow how this data is connected in terms of your graph structure. Instead of these comma separated files, it would perhaps better to provide a Gremlin script that creates your graph and demonstrates how the data is connected?

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/7474df4e-37ac-4a3a-86dc-3b16d3030b2dn%40googlegroups.com.

Minh_Tiến

unread,
Sep 5, 2021, 11:46:06 AM9/5/21
to Gremlin-users
Actually i have two sources. In the first source, i have 7 nodes and 6 edges, online is in the first source
in the second source i have 6 nodes and 4 edges, retail in the second source.
My query in the first source: 
g.V().hasLabel("Online",telephone,"Henry").outE("has_phone") 
Result:  0382889432  
So i want to get more information of Henry through telephone number . Because Retail vertex is in another source, i don't have any relationship 
but we have the same telephone. That is my mean. Thank you so much for caring!

Vào lúc 17:38:38 UTC+7 ngày Thứ Năm, 2 tháng 9, 2021, spmal...@gmail.com đã viết:

Stephen Mallette

unread,
Sep 7, 2021, 4:38:59 PM9/7/21
to gremli...@googlegroups.com
It sounds like you want to join on the phone number where you don't have an existing edge. This answer on SO might help you:


If you didn't mean that, then I'd again suggest you provide a concrete example with some sample data - an example of what i mean is in the SO question I linked to.

Minh_Tiến

unread,
Sep 8, 2021, 6:19:56 AM9/8/21
to Gremlin-users
Thank for your helping. I found out my problem but now i have another problem as image below. I want to have all information based on a phone number, i have two edges
So i want to optimize two queries into one whether the way to do or not? Thanks!
image_2021_09_08T10_13_24_999Z.png

Vào lúc 03:38:59 UTC+7 ngày Thứ Tư, 8 tháng 9, 2021, spmal...@gmail.com đã viết:

Stephen Mallette

unread,
Sep 9, 2021, 6:26:11 AM9/9/21
to gremli...@googlegroups.com
you could use project():

g.V().has('phone','telephone','123456789').
  project('member','magneto').
    by(__.in('member_contact_to_phone_isretail').valueMap()).
    by(__.in('has_phone_magento').valueMap())

Minh_Tiến

unread,
Sep 9, 2021, 11:04:19 PM9/9/21
to Gremlin-users
.image_2021_09_10T02_54_50_559Z.pngimage_2021_09_10T02_54_18_625Z.png
Uhmm, query didn't work. Consider use fold(). but i think error happen because of my graph
My graph as above. I have two phone nodes that the same label, properties (telephone) but id is different.
Vào lúc 17:26:11 UTC+7 ngày Thứ Năm, 9 tháng 9, 2021, spmal...@gmail.com đã viết:
Reply all
Reply to author
Forward
0 new messages