cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Getting properties in label 1 that is not exist in label 2

HELLO
I have a csv file with 7 columns i need to get numbers in Made_Call which are not in Receive_call
I had tried many different ways such as [not a.property in b.property] or [none(a.property in b.property where a.property<> b.property)] but always return the common number in the two labels
only apoc subtract function returned the right result but it takes to much time
for larger recordes and also when request to print other related properties gave same result for mentioned ways above .

I need the best way to get the number in column1 that are not in column2
graph relationship based way is prefered

From_Locationa|Made_Call|To_Location|Receiver_Call|Exchange|Duration_of_Call|EVENT_TYPE

06F610044E7D3D 919360123 null 913390956 MSC-BC1 BENGHAZ 00:00:28 Voice
06F610044E7D3D 918856289 null 917078034 MSC-BC1 BENGHAZ 00:01:29 Voice
06F610044E7D3D 911536552 null 7.72E+12 MSC-BC1 BENGHAZ 00:00:28 Voice
06F610044E7D3D 919393414 06F61004507E39 2.19E+11 MSC-BC1 BENGHAZ 00:00:20 Voice
06F610044E7D3D 916176032 null 925742429 MSC-BC1 BENGHAZ 00:00:06 Voice
06F610044E7D3D 916176032 null 925742429 MSC-BC1 BENGHAZ 00:00:06 Voice
06F610044E7D3D 916176032 06F610044F7DF3 125555776 MSC-BC1 BENGHAZ 00:00:06 Voice
06F610044E7D3D 910592535 null 910338043 MSC-BC1 BENGHAZ 00:01:37 Voice
06F610044E7D3D 922151021 06F610076D7AB5 2.19E+11 MSC-BC1 BENGHAZ 00:04:09 Voice
06F610044E7D3D 912003151 null 910338043 MSC-BC1 BENGHAZ 00:00:11 Voice
06F610044E7D3D 912003151 null 6.72E+12 MSC-BC1 BENGHAZ 00:00:11 Voice
06F610044E7D3D 925742429 null 919360123 MSC-BC1 BENGHAZ 00:00:35 SMS
06F610044E7D3D 9176595811 06F61008FD5250 2.19E+11 MSC-BC1 BENGHAZ 00:00:14 Voice
06F610044E7D3D 929100035 null 911439116 MSC-BC1 BENGHAZ 00:00:12 Voice

5 REPLIES 5

Hi Ibi
Welcome; let see if we can find an alternative solutions
Rgds
Arthur

anthapu
Graph Fellow

I see one bad usage of relationships here in the model. You have 2 way relationship (Made_Call_To and Received_Call). They are redundant from model perspective unless there is a scenario where only one of them is possible.

Also, if you can post your Cypher query it might be easier to understand what is happening and what needs to be done.

thank you for responding
i know that is not correct but i have tried a lot of relented solutions presented in this and other developers communities without reaching to solution, i uploaded this picture as a sample of the estimated result should be like .

Can you please post the cypher query to see what is happening?


//9USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:/cdr33.csv" AS ROW FIELDTERMINATOR';'
///////////////////////////////////////FIRST PART///////////////////////////////
//////////////////////////////////////CAll NOT RECEIVE//////////////////////////
CREATE (CallinNode:Make_Call {  }) 
SET CallinNode = ROW,
  CallinNode.Duration_of_Call = toint(ROW.Duration_of_Call)
CREATE (CalledNode:Reciever_Call {  }) 
SET CalledNode = ROW,
CalledNode.calledPartyNumber= toInt(ROW.Receiver_Call)
 ;
match(a:Make_Call)
match(b:Reciever_Call)  
where a.EVENT_TYPE = "Voice" 
with apoc.coll.subtract(Collect(a.Made_Call),Collect(a.Receiver_Call)) as  x
Unwind x as k
CREATE (u:Call_Not_Receive { phone: '' })
FOREACH (f IN k | 
    SET u.phone = apoc.convert.toString(f)
)
;
//////////////////////////////////////SECOND PART////////////////////////////////////////
match(a:Make_Call)
match(b:Reciever_Call)
with a as n, b as m
where n.EVENT_TYPE = "SMS"
//where Tower = 1
with apoc.coll.subtract(Collect(n.Receiver_Call), Collect(n.Made_Call))  as c
Unwind c as b

CREATE (p:RECEIVE_SMS_NOT_SENT { phone: '' })
FOREACH (f IN b| 
    SET p.phone = apoc.convert.toString(f)
);


here code that i am using
and what i am looking for another query that gives the same result but graph based