문제

1.How should I prevent nodes to have relationships with themselves in neo4j graph?

2.How should I force nodes to have only one relationship with each other,I mean if node A have relationship with node B this way: A--->B, there should not be any B--->A?

I know in graph making everything is on my own so I can handle both of them,but consider there is a java api which user says which nodes and relationships should be created,but I want to prevent user from 1 and 2?

Is there any possibility in neo4j for handling them?

도움이 되었습니까?

해결책

You can implement a [TransactionEventHandler][1] that performs the enforcing your constraints and register it with your GraphDatabaseService instance. A TransactionEventHandler can inspect the contents of the current transaction and eventually veto on committing, see http://docs.neo4j.org/chunked/stable/transactions-events.html.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top