Here's a question about efficient queries.

I have a graph with information about publications, topics, and persons,
among other things. Now I need to extract from this graph who has knowledge
about a certain topic.

One part of my query matches persons that know about a topic or its
sub-topics, like so:

match (n {name:"Cognitive
Science"})-[r:INCLUDES*]->(o)<-[rr:KNOWS_ABOUT]-(person:Person) return
o.name as Topic, person.name as Researcher
UNION
match (n {name:"Cognitive Science"})<-[rr:KNOWS_ABOUT]-(person:Person)
return n.name as Topic, person.name as Researcher

Since this is only a part of a much larger query, I'd like to get rid of
the second line, but I can't come up with a query that includes matches to
the 'super topic' (Cognitive Science).
Is there an identity relationship so that the first could be reformulated
in a way that node o is the same as node n? Would it be a good approach to
explicitly make every node identical to itself via this relationship?

E.g.
match (n {name:"Cognitive
Science"})-[r:IDENTITY|INCLUDES*]->(o)<-[rr:KNOWS_ABOUT]-(person:Person)

Or is using a path a solution?

Any input is welcome, thanks.

best regards,
Christoph

-- 
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 neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to