<jupyter_start><jupyter_text>The next specification generates an error.  Reason: It did NOT start from the most recent fact (=valley fact) involved in the query.  We started from "task", while we should have started from its successor "taskAssignment".<jupyter_code>var tasksForWorker_0 = Given<Worker>.Match((worker, facts)=>
    from task in facts.OfType<Task>()
    where (
        from succ in facts.OfType<TaskAssignment>()
        where succ.assignedToWorkerMonth.worker == worker
        where succ.task == task
        select succ
    ).Any()
    select task
);<jupyter_output><empty_output><jupyter_text>So let's do it the right way and start from the most recent fact, "taskAssignment" :<jupyter_code>var tasksForWorker_1 = Given<Worker>.Match((worker, facts)=>
    from taskAssignment in facts.OfType<TaskAssignment>()
    where taskAssignment.assignedToWorkerMonth.worker == worker
    select taskAssignment.task
);

tasksForWorker_1.Pipeline.ToDescriptiveString()<jupyter_output><empty_output><jupyter_text>But you can do it also in this way.Note that the resulting pipeline is exactly the same as the previous one:<jupyter_code>var tasksForWorker_2 = Given<Worker>.Match((worker, facts)=>
    from taskAssignment in facts.OfType<TaskAssignment>()
        where taskAssignment.assignedToWorkerMonth.worker == worker
    from task in facts.OfType<Task>()
        where taskAssignment.task == task
    select task
);

tasksForWorker_2.Pipeline.ToDescriptiveString()<jupyter_output><empty_output><jupyter_text>Let's finally create the query:<jupyter_code>var tasksForJan = await j.Query(worker_jan, tasksForWorker_1);

Jinaga.Graphviz.Renderer.RenderFacts(tasksForJan)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09309133489461359, 'fraction_numerical': 0.00351288056206089, 'mean_word_length': 5.306273062730627, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '238870', 'license': 'MIT', 'n_tokens_mistral': 509, 'n_tokens_neox': 510, 'n_words': 136, 'path': 'Documentation/Examples/DWS.NET model.ipynb', 'repo_name': 'janverhaegen/jinaga.net', 'size': '1708'}