public ITerminalNode <T> BuildTerminalNode <T>(BuilderContext context, IRuleFact <T> fact)
            where T : class
        {
//            if (context.AlphaSource != null)
//                BuildJoinNode(context);

            var factIndexMap = context.CreateIndexMap(fact);

//            var terminalNode = new TerminalNode<T>(context.BetaSource, factIndexMap);

//            return terminalNode;

            throw new NotImplementedException();
        }
        public ITerminalNode <T> BuildTerminalNode <T>(BuilderContext context, FactDeclaration <T> factDeclaration)
            where T : class
        {
            using (_logger.BeginScope($"{nameof(BuildTerminalNode)}<{typeof(T).Name}>"))
            {
                if (context.AlphaSource != null)
                {
                    BuildJoinNode <T>(context);
                }

                var factIndexMap = context.CreateIndexMap(factDeclaration);

                var betaSource = context.BetaSource as ITupleSource <T>;

                _logger.LogDebug($"Creating terminal node: {typeof(T).Name}");

                return(new TerminalNode <T>(betaSource, factIndexMap));
            }
        }