vaticle / typedb

TypeDB: the polymorphic database powered by types
https://typedb.com
Mozilla Public License 2.0
3.72k stars 337 forks source link

Reasoning in write transactions #6588

Open jmsfltchr opened 2 years ago

jmsfltchr commented 2 years ago

Description

Enable reasoning in write transactions. There are some difficulties associated with this, including whether inferred facts should be persisted when a write transaction is committed and reasoning is enabled. This is the natural way to persist rule conclusions but can be unexpected from users.

shreyas1599 commented 7 months ago

Are there any plans to support this? Have a use case where it'd be useful, outlined below.

  1. We insert a new relation.
  2. The relation insertion triggers the running of a rule to infer a bunch of other relations.
  3. We have a separate relation to persist all the inferred relations from 2) (so they can be retrieved quickly) for performance reasons.
  4. Currently to do this, I've to first open a write transaction, do 1) commit the write transaction, then do a fetch and to get all the inferred relations from 2) and then create another write transaction to persist all the results from the fetch.
  5. If reasoning was enabled in write mode, I could just open 1 write transaction and do all of the above within the same transaction.