How would a graph model handle a conditional relationship like:
(Alice -[Dates]-> Bob)
Where [Dates] exists IF and ONLY IF
(Bob -[Owns]-> Ferrari) is true
Besides just querying, I'm wondering whether the relationship be applied by the database engine based on the condition or whether this needs to be managed in the application.
The answer of FrobberOfBits is very good and holds true for the ArangoDB database as well. However ArangoDB offers a micro-service framework called "Foxx" that allows you to define additional API endpoints for your database that can execute custom code.
One application for Foxx would exactly be your problem: * Define an endpoint to remove the relation that does two things: 1) Delete the relation 2) Check for all logical constraints or side-effects and apply them
This gives you the advantage that is executed directly in the database (only one query-trigger) and your application code is free of these constraints.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With