Hi Max,
This is a problem I’ve just been working on! Currently TypeDB doesn’t have server-side functionality for this, but you can do it on client-side using several API calls in one transaction. I’ve written some functions to do it here, and we should be imlementing it on the server side some time in the future:
As for the strange behaviour with fact duplication, that’s not entirely intentional and we’ll be changing it in the future. To clarify: if a rule infers a fact that already exists (either as a base fact or as an inferred fact), a duplicate is not created. What you are currently experiencing is that the base fact being incorrectly marked as inferred because it can be, even though it is not, and is a known issue. If you have any comments on how you think this should work, please let me know and I’ll take them into consideration when we decide how to resolve this issue.
Please keep me updated on your progress with this, and I’d love to hear more about your project. I recommend you join our Discord server at Vaticle where you can @ me if you have any issues with this.
- James