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.

How can I add a condition in "SIMILARITY"

Excuting the query of similarity was successuful by using this :

MATCH (at1:Attrib)<-[r:ASSIGNED]-(c:Contrat)-[x:ASSIGNED]->(at2:Attrib)
MERGE  (at1)-[s:SIMILARITY]-(at2)

And then , to display only Attribs which are working together , I worked with this query and it's fine :

MATCH (at:Attrib)<-[r]-(c:Contrat)
WITH DISTINCT c.id AS Contrat , collect(DISTINCT at.label) AS Attributaires, count( DISTINCT at.id) AS Count
Return  Attributaires;

and this the result :

My question is how can I remove duplicates for "at" in the graph and not only in the list . if 2 at have the same ID and they re displayed then we display only one at .

1 ACCEPTED SOLUTION

Here is the solution :

View solution in original post

3 REPLIES 3

I'm not sure that I understand exactly what you'd like to do...could you maybe share a sample dataset that I can create locally and then say what you'd like the output of your query to be?

Actually this is the graph that I obtained after excuting "similarity" .


And here is the list of "Attributes" which are working together :

What I want to do exactly is : deleting the duplicates nodes which have the same ID (ID : 111 apearing twice for example here in the graph , I want to havejust one instead of two nodes with the same ID .

Here is the solution :