internal NpletProducerNode(Context context, NpletQueryNode target, NpletFactory factory, IEnumerable<NpletTree> dependencies) { TargetQuery = target; _factory = factory; Dependencies = (from nplet in dependencies select context.CreateQueryNode(nplet)).ToArray(); _dependencyReaders = (from dependency in Dependencies select context.CreateReader(dependency)).ToArray(); }
/// <inheritdoc/> internal override IEnumerable<NpletProducerNode> CreateProducers(NpletQueryNode query, Context context) { //creates query which will match to implication targeting the query var implicationQuery = NpletTree.From(Edge.Then, Edge.TempVariable(), Edge.To(query.Query)); //fetches those implications from database var implications = context.Fetch(implicationQuery); var producers = new List<NpletProducerNode>(); foreach (var implication in implications) { var condition = implication.GetEdge(0).TargetAsNplet; var producer = new NpletProducerNode(context, query, null, new[] { condition }); producers.Add(producer); } return producers; }
/// <inheritdoc/> internal override IEnumerable<NpletProducerNode> CreateProducers(NpletQueryNode query, Context context) { throw new NotImplementedException(); }
internal abstract IEnumerable<NpletProducerNode> CreateProducers(NpletQueryNode query, Context context);