Exemple #1
0
        public override void PropagateAssert(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.Add(set.Tuple, matchingFacts);
                    aggregation.Add(set.Tuple, results);
                }
            }
            PropagateAggregation(context, aggregation);
        }
Exemple #2
0
        public void HandleReceived(ResponseMessage <JToken> received)
        {
            var receivedData = typeof(T) == typeof(JToken)
                ? new[] { received.Result.Data }
                : _graphSONReader.ToObject(received.Result.Data);

            foreach (var d in receivedData)
            {
                if (received.Result.Meta.ContainsKey(Tokens.ArgsSideEffectKey))
                {
                    if (_aggregator == null)
                    {
                        _aggregator =
                            new AggregatorFactory().GetAggregatorFor(
                                (string)received.Result.Meta[Tokens.ArgsAggregateTo]);
                    }
                    _aggregator.Add(d);
                    _isAggregatingSideEffects = true;
                }
                else
                {
                    _result.Add(d);
                }
            }
        }
Exemple #3
0
        public override void PropagateAssert(IExecutionContext context, Fact fact)
        {
            var tuples = MatchingTuples(context, fact);

            foreach (var tuple in tuples)
            {
                IAggregator aggregator = Aggregator(context, tuple);
                var         results    = aggregator.Add(fact.Object);
                HandleAggregationResult(context, results, tuple);
            }
        }
Exemple #4
0
        public override void PropagateAssert(IExecutionContext context, Tuple tuple)
        {
            IAggregator aggregator    = Aggregator(context, tuple);
            var         matchingFacts = MatchingFacts(context, tuple);

            foreach (var matchingFact in matchingFacts)
            {
                var results = aggregator.Add(matchingFact.Object);
                HandleAggregationResult(context, results, tuple);
            }
        }
Exemple #5
0
        public override void PropagateAssert(IExecutionContext context, IList <Tuple> tuples)
        {
            var joinedSets  = JoinedSets(context, tuples);
            var aggregation = new Aggregation();

            foreach (var set in joinedSets)
            {
                var factObjects = new List <object>();
                foreach (var fact in set.Facts)
                {
                    if (MatchesConditions(context, set.Tuple, fact))
                    {
                        factObjects.Add(fact.Object);
                    }
                }
                IAggregator aggregator = CreateAggregator(set.Tuple);
                var         results    = aggregator.Add(factObjects);
                aggregation.Add(set.Tuple, results);
            }
            PropagateAggregation(context, aggregation);
        }
Exemple #6
0
        public void Add(Aggregation aggregation, Tuple tuple, IEnumerable <Fact> facts)
        {
            var results = _aggregator.Add(tuple, facts);

            AddAggregationResult(aggregation, tuple, results);
        }