Hypergraph modeling in neo4j
質問
MATCH (hank)-[]->(hyperedge)-[]->(cletus)
If Hank has multiple relationships to hyperedge and/or hyperedge has multiple relationships to Cletus, but there is only one relationship from Hank through hyperedge to Cletus, will this query give me that relationship?
Assuming the answer to that is yes, if I do this:
CREATE (hank)-[:FOO]->(hyperedge)-[:BAR]->(cletus)
will
MATCH (hank)-[:FOO]->(hyperedge)-[:BAR]->(cletus)
give me the relationship I just created, if Hank has multiple FOO
relationships to hyperedge and/or hyperedge has multiple BAR
relationships to Cletus?
解決
It depends, if hank, hyperedge and cletus are fixed, then yes,
Otherwise you probably want to use:
MATCH shortestPath((hank)-[:FOO]->(hyperedge)-[:BAR]->(cletus))
to get only one.
Otherwise you have to "tag" that relationship somehow, e.g. with a property.
MATCH (hank)-[:FOO {tag:1}]->(hyperedge)-[:BAR {tag:1}]->(cletus)
所属していません StackOverflow