How can I add a condition in "SIMILARITY"

cypher

(Mehdi Ajroud) #1

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 .


(Mark Needham) #2

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?


(Mehdi Ajroud) #3

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 .


(Mehdi Ajroud) #4

Here is the solution :