I'm trying to out how to exclude nodes from a query. My graph consists of users, skills, skill scoring, questions and endo
- user has skills
- skill has scorings in relation with questions ((skill)-->(scorings)-->(questions))
- endo is a relationship for users and skills scorings ((user)-->(endos)-->(scorings))
I would like to find all question for user, but exclude those questions who user has already endo relationship
I thought I could do :
MATCH (u:`User`),
u<-[rel1:`USERS`]-(s:`Skill`),
s-[rel2:`SKILLS`]->(k:`SkillScoring`),
k-[rel3:`ANSWER`]->(q:`Question`),
u<-[rel4:`ENDO`]-(e:`Endo`)
WHERE NOT((e)-->(u)) AND (u.id='1')
RETURN u, e, k, q
UPDATE:
endo nodes are connected like this.
- blue is user node
- purple is journaled endorsement node (created at)
- green is skill scoring node
In fact the relationship "ENDORSEMENT" has a node (journalised) which connects the skill scoring nodes
UPDATE:
When I execute this query, it returns me the question in connection with the user
MATCH (u:User),
u<-[rel1:USERS]-(s:SoftSkill),
s-[rel2:SOFT_SKILLS]->(k:SkillScoring),
k-[rel3:ANSWER]->(q:Question),
u<-[:ENDO]-()<-[:ENDO]->(k)
WHERE u.id='1'
RETURN q, u
by cons when I execute this query to exclude the question, the query returns me questions but also question that I don't want
MATCH (u:User),
u<-[rel1:USERS]-(s:SoftSkill),
s-[rel2:SOFT_SKILLS]->(k:SkillScoring),
k-[rel3:ANSWER]->(q:Question)
WHERE u.id='1' AND NOT u<-[:ENDO]-()<-[:ENDO]->(k)
RETURN q, u
What's wrong? Any suggestions?
Thanks