Hi Tareq,
and specifically, here:
So, to implement star-node, all you need to do is to change line 257 to say "if (is_glob and tc)" and set is_glob to false when matching star nodes.
The inverted match is here:
I don't think you need the inverted match in what you are doing.
Re: ordered vs unordered: this is already handled automatically. If your data is in an ordered link, then the comparison to the pattern will always be ordered. If the data and pattern are unordered links, then all possible permutations will be explored. One of those permutations will put everything "unknown" next to each-other, where the star node can pick them up.
There's even a unit test, somewhere, checking that globnode works with unorderded links. so it should work automatically ...
So you do not need to write any extra code to handle the "match everything left over". Unless you mean... Hmm. Unless you mean this:
(ListLink ; notice this is an ordered link!
(ConceptNode "a")
(ConceptNode "b")
(StarNode "var")
(ConceptNode "p")
(ConceptNode "q")
(StarNode "var")
(ConceptNode "y")
(ConceptNode "z"))
and you want everything dumped into one big bag. Because right now, the way pattern matching is defined, the above will match only if the stuff in the first location is exactly identical to the stuff in the second location.
If you want everything i a big bag, it would be better to use two vars, and consolidate them into one, after the matching is done.
--linas