There are two types of nodes lets say Person and City. Also there are two types of relationship between Person and City. I want to merge relationships into one virtually in order to display single edge. But it creates more than one virtual relationship. Any help?
You can match the person-city pairs but reduce it to a set of distinct pairs and then create the cirtual relationship.
MATCH (person:Person)--(city:City)
WITH DISTINCT person, city
RETURN person, city, apoc.create.vRelationship(person, 'DOES_A_THING_IN', {}, city)
There is a set of artists, from which some artists create a temporary group and organize a event in any city. After it different groups organize events in different city or same city as done by some other group.
I want to query the data when artist A participates in the event then the events done in same city by Artist B in a series of Dates.
MATCH seriesB = (bArtist:Artist)-[:HAS_PARTICIPATED]->(bEventArtists:EventArtists)-[:ORGANIZED]->(bEvent:Event)<-[:HAS_EVENT]-(bCityActivityDate:CityActivityDate)<-[:HAS_ACTIVITY_DATE]-(bCity:City), seriesA = (aArtist:Artist)-[:HAS_PARTICIPATED]->(aEventArtists:EventArtists)-[:ORGANIZED]->(aEvent:Event)<-[:HAS_EVENT]-(aCityActivityDate:CityActivityDate)<-[:HAS_ACTIVITY_DATE]-(aCity:City)
WHERE bArtist.name = 'ROCKON' and aArtist.name = 'SUN RISERS' and bCityEventDate.cityId = aCityEventDate.cityId
and aCityEventDate.eventDate< bCityEventDate.eventDate
WITH distinct bArtist,bEvent
,apoc.create.vRelationship(bArtist,'B_PERFORMED_IN',{},bEvent) as bPerformedRel
,apoc.create.vRelationship(aArtist,'A_PERFORMED_IN',{},aEvent) as aPerformedRel
,apoc.create.vRelationship(bCity,'INVITED_B',{},bEvent) as bInvitedRel
,apoc.create.vRelationship(aCity,'INVITED_A',{},aEvent) as aInvitedRel
,bCity,aEvent,aArtist,aCity limit 5
RETURN *
Here for example if A has perfomed only single time in Paris and then different groups also performed in Paris each time with random artists. Lets say two times Artis B also performed in Paris then above query create multiple virtual relationship edges of relation for each relation between (aArtist & aEvent) and also for (aCity & aEvent). As A has performed only once there should be only one edge but it increase as per the relation between (bArtist & bEvent) for the same city.