singnet / das-atom-db

Persistence layer
MIT License
2 stars 0 forks source link

Add support in redis_mongo for MeTTa nodes/links mapping #100

Closed andre-senna closed 7 months ago

andre-senna commented 8 months ago

The MeTTa loader (see https://github.com/singnet/das-query-engine/issues/105) uses a mapping from MeTTa to nodes/links which makes pointless/expensive the use of multiple MongoDB collections for links with different arity. Basically the loader uses only what we currently call LINK_N collection.

So a patch is required to make redis_mongo work in a database loaded this way.

The solution I went for is to add a kwarg parameter "use-metta-mapping" defaulted to False. If passed in the RedisMongo constructor, this parameter makes it consider only LINK_N either for link additions and queries.

I believe in the near future we should drop this design of multiple collections anyway. We'll be sure after we finish https://github.com/singnet/das-query-engine/issues/136 because we may realize we need to keep these multiple collections in order to make better indexes. Actually that's the whole point of this design, anyway, when it have been conceived.