Example #1
0
        public override void PropagateRetract(IExecutionContext context, IList <Fact> facts)
        {
            var joinedSets  = JoinedSets(context, facts);
            var aggregation = new Aggregation();

            foreach (var set in joinedSets)
            {
                if (set.Facts.Count == 0)
                {
                    continue;
                }
                var matchingFacts = new List <Fact>();
                foreach (var fact in set.Facts)
                {
                    if (MatchesConditions(context, set.Tuple, fact))
                    {
                        matchingFacts.Add(fact);
                    }
                }
                if (matchingFacts.Count > 0)
                {
                    IAggregator aggregator = GetAggregator(set.Tuple);
                    var         results    = aggregator.Remove(set.Tuple, matchingFacts);
                    aggregation.Add(set.Tuple, results);
                }
            }
            PropagateAggregation(context, aggregation);
        }
Example #2
0
        public override void PropagateRetract(IExecutionContext context, Fact fact)
        {
            var tuples = MatchingTuples(context, fact);

            foreach (var tuple in tuples)
            {
                IAggregator aggregator = Aggregator(context, tuple);
                var         results    = aggregator.Remove(fact.Object);
                HandleAggregationResult(context, results, tuple);
            }
        }
Example #3
0
        public void Remove(Aggregation aggregation, Tuple tuple, IEnumerable <Fact> facts)
        {
            var results = _aggregator.Remove(tuple, facts);

            AddAggregationResult(aggregation, tuple, results);
        }