Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-15-2020 03:33 AM
I have asked this question over StackOverflow as well and can be found here.
Given that I'm very new to Neo4j. I have a schema which looks like the below image:
Here Has
nodes are different for example Passport, Merchant, Driving License, etc.
and also these nodes are describing the customer node (looking for future scope of filtering customers based on these nodes) .
SIMILAR
is a self-relation meaning there exists a customer with ID:1
is related to another customer with ID:2
with a score of 2800
.
I have the following questions:
()-[:HAS]->(Phone)
having {active: "+91-1231241", historic_phone_numbers: ["+91-121213", "+91-1231421"]}
)// With number_of_relation > 1
MATCH (searched:Customer)-[r:SIMILAR]->(matched:Customer)
WHERE r.score > 2700
WITH searched, COLLECT(matched.customer_id) AS MatchedList, count(r) as cnt
WHERE cnt > 1
UNWIND MatchedList AS matchedCustomer
MATCH (person:Customer {customer_id: matchedCustomer})-[:HAS|:LIVES_IN|:IS_EMPLOYED_BY]->(related)
RETURN searched, person, related
Result what I got is below, notice one customer node not having its describing nodes:
// without number_of_relation > 1
// second attempt - for a sample customer_id
MATCH (matched)<-[r:SIMILAR]-(c)-[:HAS|:LIVES_IN|:IS_EMPLOYED_BY]->(b)
WHERE size(keys(b)) > 0
AND c.customer_id = "1b093559-a39b-4f95-889b-a215cac698dc"
AND r.score > 2700
RETURN b AS props, c AS src_cust, r AS relation, matched
Result I got are below, notice related nodes are not having their describing nodes:
customer {name: "Dave"}
has phone {active_number: "+91-12345"}
is similar to customer {name: "Mike"}
has phone {active_number: "+91-12345"}
. How can I get started with this?If something is unclear, please ask. I can explain with examples.
All the sessions of the conference are now available online