[#212] Integration of new CHAIN operator in tokens-based query#1055
Merged
andre-senna merged 10 commits intomasterfrom Apr 9, 2026
Merged
[#212] Integration of new CHAIN operator in tokens-based query#1055andre-senna merged 10 commits intomasterfrom
andre-senna merged 10 commits intomasterfrom
Conversation
added 10 commits
March 6, 2026 09:58
… get these values with get()
ccgsnet
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP towards #212 Still missing integration with MeTTa queries
After this PR, it's possible to include CHAIN operators in token based queries like these:
The syntax of the tokens is like this:
Where
<handle>,<tail>and<head>specify which link from<query>'s query answers should be considered to build the paths and which target indexes should be considered as tail and head of the link in the path.<handle>can be an uint, meaning one of the handles in query_answer.handles or a string meaning the name of a variable in query_answer.mapping.<tail>and<head>are uints indexing the given link targets.So, for instance,
"CHAIN", "0", "1", "2",is saying that for each query answer of<query>the operator will consider the 0'th handle in query_answer.handle (i.e. the first handle) as the link which will build the paths and the targets 1 and 2 will be used as tail and head respectively.In the first example, the operator will take links like
(Similarity h1 h2),(Similarity h2 h3),(Similarity h3 h4)to build paths like:h1 -> h2 -> h3 -> h4(i.e. (h1, h2), (h2, h3), (h3, h4)).