Hi,
In the diagram it is shown that User node has a PIXEL_POST relationship
with Pixel node. From the Cypher query the Check_In node has HAS_PIX
relationship with Pixel node. I assume this is correct as you seem to get
the results with your queries.
Created a Neo4j graph database from your Cypher query. I created two user
nodes with id 1 and 2. User with id = 1 only has PULSE_POST relationship
with Pulse node. For this test, User with id = 2 has no PULSE_POST
relationship. Here is my Cypher query:
CREATE (cpny:Company {name: "Company"})
//User id = 1
CREATE (usr:User {id: 1})
CREATE (cpny)-[:USER]->(usr)
CREATE (pxl:Pixel {id: 1})
CREATE (plse:Pulse {id: 1})
CREATE (usr)-[:PULSE_POST]->(plse)
CREATE (chkin:CheckIn {id: 1})
CREATE (tags:Tag {id: 1})
CREATE (usr)-[:CHECKIN_POST {onPulse:true}]->(chkin)
CREATE (chkin)-[:HAS_PIX {onPulse:true}]->(pxl)
CREATE (chkin)-[:HAS_BIZ_TAG]->(tags)
CREATE (venu:Venue {id: 1})
CREATE (chkin)-[:CHECKIN_ON]->(venu)
CREATE (pxl)-[:PIXEL_ON]->(venu)
//User id = 2
CREATE (usr2:User {id: 2})
CREATE (cpny)-[:USER]->(usr2)
CREATE (px2:Pixel {id: 2})
CREATE (chkin2:CheckIn {id: 2})
CREATE (tags2:Tag {id: 2})
CREATE (usr2)-[:CHECKIN_POST {onPulse:true}]->(chkin2)
CREATE (chkin2)-[:HAS_PIX {onPulse:true}]->(px2)
CREATE (chkin2)-[:HAS_USER_TAG]->(tags2)
CREATE (venu2:Venue {id: 2})
CREATE (chkin2)-[:CHECKIN_ON]->(venu2)
CREATE (px2)-[:PIXEL_ON]->(venu2)
;
graph:
<https://lh3.googleusercontent.com/-aHRb3GvBePM/WQLnN9zuulI/AAAAAAAACNI/WyYROR9cM9wo-JjyzbdORMKJWZX_05anACLcB/s1600/ais_1.png>
Query on User id = 1:
MATCH (c)-[r0]->(n)-[r1]->(p)-[r2]->(b:Venue)
WHERE n.id = 1
optional match (n)-[r3:PULSE_POST]->(p2:Pulse)
optional match (p)-[r4:HAS_BIZ_TAG|HAS_USER_TAG]->(t:Tag)
RETURN c, r0, n, r1, p, r2, b, p2, r4, t;
graph:
<https://lh3.googleusercontent.com/-xTh_DBR-NxI/WQLngFTxqJI/AAAAAAAACNM/dc_bGym4bCwpwia4iAfGBJeO3rFlOVwugCLcB/s1600/ais_2.png>
You see Pulse node (yellow color).
Query on User id = 2:
MATCH (c)-[r0]->(n)-[r1]->(p)-[r2]->(b:Venue)
WHERE n.id = 2
optional match (n)-[r3:PULSE_POST]->(p2:Pulse)
optional match (p)-[r4:HAS_BIZ_TAG|HAS_USER_TAG]->(t:Tag)
RETURN c, r0, n, r1, p, r2, b, p2, r4, t;
graph:
<https://lh3.googleusercontent.com/-zBK0PqZcLG8/WQLn42bAfxI/AAAAAAAACNQ/UJEMOTuq7SYfUaX0SiPQaf_nzwvcJTXfQCLcB/s1600/ais_3.png>
User id = 2 has no relationship with Pulse. Running this query:
MATCH (n)-[r3:PULSE_POST]->(p2:Pulse)
RETURN n, r3, p2;
graph:
<https://lh3.googleusercontent.com/-vs7-Y5qJC4A/WQLouY0B5WI/AAAAAAAACNY/4RGAF_LBJmMcolIBKZElZ3yWyyLV60t-QCLcB/s1600/Screen%2BShot%2B04-27-17%2Bat%2B05.07%2BPM.PNG>
Again only User with id = 1 shows the Pulse node!
As Michael mentioned, you seem to have nodes with no relationship to Pulse
node. Run the above query and send me the screenshot and that will help me
to figure out the issue. Actually, run this query: call apoc.meta.graph()
and send me the screenshot.
-Kamal
On Thursday, April 27, 2017 at 12:14:20 AM UTC-7, Alliance Ais wrote:
>
>
> <https://lh3.googleusercontent.com/-YOqb3UNhdWQ/WQGaAeSlV3I/AAAAAAAAC9E/hX-WRS_xRnowb-kmLRiWNL5DMpXi238gACLcB/s1600/neo4j.jpg>
> Hi, Michael Hunger
>
> Thanks for reply. As i am bit new to neo4j so i am not getting you
> properly. Can you please help us by explaining more.
>
> I am attaching image so that help you for understand our requirement.
>
>
>
>
> On Thursday, April 27, 2017 at 12:35:45 PM UTC+5:30, Michael Hunger wrote:
>>
>> Then check the relationship (type and direction) from n to pulse if it
>> exists.
>>
>> Michael
>>
>> On Thu, Apr 27, 2017 at 8:08 AM, Alliance Ais <[email protected]>
>> wrote:
>>
>>> Thanks for given your valuable time. But We cannot fetch any pulse that
>>> you mentioned as *p2* in cypher Query. We get only null value for *p2.
>>> *Please
>>> suggest us what we have to change in my Cypher Query?
>>>
>>>
>>>
>>> On Thursday, April 27, 2017 at 1:18:43 AM UTC+5:30, Kamal Murthy wrote:
>>>>
>>>> Hi,
>>>>
>>>> I added a variable 'p2' for pulse (shown in bold) in the optional match
>>>> and added the same variable to the return list. Here is the query:
>>>>
>>>> match (n)-[r1]->(p)-[r2]->(b:business)
>>>> where id(n) = {otherUserId}
>>>>
>>>> where r1.onPulse=true and r2.onPulse= true and
>>>> (p:check_in OR p:tip OR p:review or p:rate)
>>>> optional match (n)-[:pulse_post]->*(p2*:pulse)
>>>> optional match(p)-[r3:has_pix]->(pix:pix)
>>>> OPTIONAL MATCH (p)-[tg:has_biz_tag|has_user_tag|has_hash_tag]->(tags)
>>>> return n,r1,p,r2,r3,pix,tg,tags,*p2*
>>>>
>>>> -Kamal
>>>>
>>>> On Wednesday, April 26, 2017 at 12:07:44 AM UTC-7, Alliance Ais wrote:
>>>>>
>>>>>
>>>>> <https://lh3.googleusercontent.com/-eDX3rqw_T3Y/WQBE4VCiZPI/AAAAAAAAC8o/tOrnfgJiIm4lYYxFBwj6UJcNW5zGExT9ACLcB/s1600/neo4j.jpg>
>>>>> Hi, Michael Hunger
>>>>>
>>>>> Thanks for reply and your query helped us a lot but little issue we
>>>>> have that i am sharing with you please help us as we are near to complete
>>>>> project as we stuck above requirement.
>>>>>
>>>>> Let me explain where we are getting issue.
>>>>>
>>>>> Please refer above image, while we are using your query we are getting
>>>>> rate,review and tip but not getting pulse that is posted by system user,
>>>>> while talking about pulse one important thing i would like to share with
>>>>> you is pulse post done by user is not on venue[business]. where other
>>>>> activities [check-in, review, tip, rate] done on venue[business] by user.
>>>>>
>>>>> while using your query its not getting pulse in the result set.
>>>>>
>>>>> One more thing in final result set that we are getting from your query
>>>>> , how we can set order by date in descending order for whole result set.
>>>>>
>>>>> We are waiting for your suggestion that so valuable for us.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Thursday, April 13, 2017 at 1:19:10 AM UTC+5:30, Michael Hunger
>>>>> wrote:
>>>>>>
>>>>>> match (n)-[r1]->(p)-[r2]->(b:business)
>>>>>>
>>>>>> where id(n) = {otherUserId}
>>>>>>
>>>>>> where r1.onPulse=true and r2.onPulse= true and (p:check_in OR p:tip OR
>>>>>> p:review or p:rate)
>>>>>>
>>>>>> optional match (n)-[:pulse_post]->(pulse)
>>>>>>
>>>>>> optional match(p)-[r3:has_pix]->(pix:pix)
>>>>>>
>>>>>> OPTIONAL MATCH (p)-[tg:has_biz_tag|has_user_tag|has_hash_tag]->(tags)
>>>>>>
>>>>>> return n,r1,p,r2,r3,pix,tg,tags
>>>>>>
>>>>>>
>>>>>> On Fri, Apr 7, 2017 at 9:20 AM, Alliance Ais <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> Hello Following My Neo4J Query to Get *CheckIn* or *Review* or
>>>>>>> *Pixel* etc. which is Given by User to Business.Which I got
>>>>>>> perfectly.but *I want also Get Pulse which given By User but not
>>>>>>> given on Business.* So My Following Query is not Get Pulse.
>>>>>>>
>>>>>>>
>>>>>>> <https://lh3.googleusercontent.com/-UbNvvKqhcPw/WOc9moX6piI/AAAAAAAAC8I/MiUDsXow51MiVJbvn_WCaiitZlaq9wy7gCLcB/s1600/pixelPost.jpg>
>>>>>>>
>>>>>>> start n=node({otherUserId}) with n match (n)-[r1]-(p)-[r2]-(b:business)
>>>>>>> where r1.onPulse=true and r2.onPulse= true and ('check_in' IN labels(p)
>>>>>>> OR 'tip' IN labels(p) OR 'review' IN labels(p) OR 'rate' IN labels(p))
>>>>>>> with p,r1,r2,n,b
>>>>>>> optional match(p)-[r3:has_pix]-(pix:pix)
>>>>>>> OPTIONAL MATCH (p)-[tg]-(tags)
>>>>>>> where type(tg) in ['has_biz_tag', 'has_user_tag', 'has_hash_tag']
>>>>>>> return n,r1,p,r2,r3
>>>>>>>
>>>>>>> Above my Relationship node. I want Neo4J Query for that.
>>>>>>>
>>>>>>>
>>>>>>> Also I asked in StackOverflow :
>>>>>>> http://stackoverflow.com/q/43271456/2893413
>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "Neo4j" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to [email protected].
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Neo4j" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.