You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am in a situation where I need to query connected sub-spaces. My intuition is that I will have to write a custom Space implementation in Rust but I was wondering if there was a way to do it directly in Metta.
I need to group atoms into arbitrary "zones". Zones can be connected to other zones, forming a DAG. Querying a zone should factor in all of its atoms and the atoms of the transitive walk of its connections at the same time, and it should support compound queries that use (, ...).
I have prototypes that tag atoms in a zone, but because querying bottoms out in unify and considers each atom in turn, I cannot support compound queries. Here it is as an example of my thinking, eventually modeling a "cousin" relationship as (, (uncle me $u) (child $u $c)):
Another experiment was to leverage MeTTa spaces themselves. This enables match and compound queries, but it is still not ideal because compound queries for atoms that span spaces would not work.
Well, there is an option to put a space into another space, like (add-atom &parent &child). In this case, (match &parent ...) will also walk through &child. However, this will work for trees, but not for DAGs, I guess. So, it's indeed needed to be handled manually, but it depends on how you want to handle multiple inheritances in your case. One option would be to put all the children with deduplication temporarily for matching. OTOH, I don't think that matching in spaces inserted into other spaces is optimized. Maybe, putting everything in one space and tagging could be more efficient.
I am in a situation where I need to query connected sub-spaces. My intuition is that I will have to write a custom Space implementation in Rust but I was wondering if there was a way to do it directly in Metta.
I need to group atoms into arbitrary "zones". Zones can be connected to other zones, forming a DAG. Querying a zone should factor in all of its atoms and the atoms of the transitive walk of its connections at the same time, and it should support compound queries that use
(, ...)
.I have prototypes that tag atoms in a zone, but because querying bottoms out in
unify
and considers each atom in turn, I cannot support compound queries. Here it is as an example of my thinking, eventually modeling a "cousin" relationship as(, (uncle me $u) (child $u $c))
:Another experiment was to leverage MeTTa spaces themselves. This enables
match
and compound queries, but it is still not ideal because compound queries for atoms that span spaces would not work.Note this this prototype catches
karim
but notsarah
as a cousin, becausekarim
exists in the same zone/space as the unclefadi
butsarah
does not.Is there a way to achieve these semantics in MeTTa directly? Or is it best to start investigating custom space implementations?
The text was updated successfully, but these errors were encountered: