[#212] Implementation of CHAIN operator in pattern matching query#1049
Merged
andre-senna merged 18 commits intomasterfrom Mar 5, 2026
Merged
[#212] Implementation of CHAIN operator in pattern matching query#1049andre-senna merged 18 commits intomasterfrom
andre-senna merged 18 commits intomasterfrom
Conversation
added 15 commits
February 13, 2026 09:58
eddiebrissow
reviewed
Mar 5, 2026
eddiebrissow
reviewed
Mar 5, 2026
eddiebrissow
approved these changes
Mar 5, 2026
ccgsnet
approved these changes
Mar 5, 2026
added 2 commits
March 5, 2026 14:24
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 the integration of the operator with the query parse. I.e. for now, it's not possible to use the query client or MeTTa to put CHAIN operators in query. This PR covers only the implementation of the QueryElement.
The idea of this operator is to allow the caller to search for a chain of links connecting a SOURCE to a TARGET. This is another operator to be used in a query (like AND, OR etc). Whenever a CHAIN operator appears in a query tree (together with a SOURCE and a TARGET parameters) the operator will use its input to search for paths connecting SOURCE and TARGET.
Paths are passed through to the next query element in the query tree in QueryAnswers with N handles meaning a path of size N where source is the first handle and target is the last one.
Depending on an optional parameter, incomplete paths (connected only to either the source or the target) are also forwarded.
Paths are searched in a combinatorial fashion but STI is used to direct the search through the search space in a way that paths with the largest STI are searched and reported earlier.
In this version, the input links are supposed to be ternary. Something like
(Similarty $v1 $v2). Actually, the first target (Similarituyin this example) is totally disregarded.