You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kie.apache.org by Mark Proctor <md...@apache.org> on 2024/12/04 13:50:40 UTC
[PROPOSAL] Sequential Logic #6182
I have opened a ticket for the Sequential Logic work I'm doing.
https://github.com/apache/incubator-kie-drools/issues/6182
I had a slight pause, but I have now resumed this work.
The sequential engine is a dedicated subsystem that integrates with Rete's
alpha network but uses a state machine rather than Rete's beta network to
drive the sequence matching. The current temporal operators (before, after,
etc.) all require beta joins, which are not as efficient as a state machine
and are not as flexible for complex sequences with loops.
When a sequence is matched, it enters the beta network for additional
relational joins or rule firing. Future versions will optimise the network
to avoid entering the beta network and fire immediately.
Under the hood is a dedicated state machine that moves through states when
signals are received from the SignalProcessors; the state machine is
optimised for integrations for the sources it interacts with. Those signals
are provided by logic gates once they become satisfied. The logic gates
matched data received from the event stream, which itself is from the alpha
network. The "feel" of the system is similar to how regular expression
matching works.
Because it only wants to attempt to match data for the current active
sequence or subsequence, it uses a flat list of current patterns to match
against. Bitmasks are used to get efficient routing from the input of data,
to the pattern matching to the appropriate logic gates and their parent
sequence.
The branch can be found here:
https://github.com/mdproctor/drools/tree/sequentiallogic
It's early days, however a lot of the unit tests are in place to show how
it works, but it's currently still very low level. For those interested, a
lot of the unit tests can be found here:
https://github.com/mdproctor/drools/tree/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing
A sequence has 1...n steps. Currently, it supports LogicCircuits, Actions,
Aggregators and Subsequences.
https://github.com/mdproctor/drools/tree/sequentiallogic/drools-base/src/main/java/org/drools/base/reteoo/sequencing/steps
This test shows how to construct the logic gates, which are used within a
LogicCircuit:
https://github.com/mdproctor/drools/blob/sequentiallogic/drools-base/src/main/java/org/drools/base/reteoo/sequencing/signalprocessors/Gates.java
https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerLogicGateTest.java
A LogicGate is a type of SignalProcessor:
https://github.com/mdproctor/drools/blob/sequentiallogic/drools-base/src/main/java/org/drools/base/reteoo/sequencing/signalprocessors/LogicGate.java
Loops can occur on individual SignalProcesses or on Subsequences. Where
it's on a LogicGate, it tests the number of times the individual LogicGate
is matched.
https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerSignalProcessorCounterTest.java
Here is the conditional loop for SubSequence:
https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerSequenceLoopTest.java
Timers are supported as well on signal processors and subsequences. The
timer can be used to add delays or do timeouts.
https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerSignalProcessorTimerTest.java
https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerSequenceTimerTest.java
Lastly, you can do aggregations over subsequences:
https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerAggregatorTest.java
The next steps are to improve the unit tests and start to try and expose
this in the DRL language itself so end users can start to use it.
Regards
Mark
Mark
Re: [PROPOSAL] Sequential Logic #6182
Posted by Alex Porcelli <al...@porcelli.me>.
Thank you for an in-depth explanation of this proposal, Mark!
It has been about 10 years since I first heard about sequencing for
Drools, glad that it is finally in the works!
For those of us that are not that familiar with the topic, could you
help us understand better how this could be used? Maybe a simple
example or use case?
@Gabriele, agree with you that we need a mechanism that we can fast
track innovation, but at the same time without affecting the
stability. But, as mentioned before, requires its own discussion
thread.
On Fri, Dec 6, 2024 at 6:17 AM Gabriele Cardosi
<ga...@gmail.com> wrote:
>
> HI Alex,
> yes, I know it is sort-of hijacking.
> But, at the same time, the vote for this proposal could be influenced also
> by that.
> Let's continue on the Discussion thread 👍
>
> Il giorno ven 6 dic 2024 alle ore 11:42 Alex Porcelli <al...@porcelli.me> ha
> scritto:
>
> > Gabriele,
> >
> > You have an interesting point, however I don't think it's appropriate
> > to hijack this proposal thread to discuss how to deal with
> > innovation/experimentations/new features.
> >
> > Let's open a new Discussion thread, where I'd love to share some
> > thoughts and explore the challenges and options on how to deal with
> > such complicated topic.
> >
> > On Fri, Dec 6, 2024 at 3:33 AM Gabriele Cardosi
> > <ga...@gmail.com> wrote:
> > >
> > > HI Mark,
> > > of course I can't have an opinion on such low-level details of the rule
> > > engine.
> > > But, in general terms, this proposal seems related to a topic we slightly
> > > touched in the past, i.e. if it would not be a good idea to create a sort
> > > of "experimental" "new feature" or whatever branch for such new things,
> > to
> > > be used also for other new stuff.
> > > To better reinforce the concept, I strongly believe that we must keep
> > > creating new features and experimenting new approaches, but at the same
> > > time we have to balance the impact on the principal branch, that should
> > be
> > > kept "stable".
> > > Reason for that is that currently there is a lot of "abandoned" code in
> > our
> > > repositories, sort of POC or attempt that IINW no-one actually used and
> > > no-one actually maintains (except if some test gets broken for some
> > > unrelated modifications).
> > > Again, I can't tell how the code you are writing fits in the general
> > > picture, but since you opened a "PROPOSAL", it seems that it is not just
> > a
> > > simple reorganization or clean-up.
> > > With that "new-feature" branch, curious or interested users could start
> > > actually testing such a new code and, later on, we could have a better
> > > opinion if the feature is mature enough (and used enough) to be merged
> > (and
> > > maintained) in the main branch.
> > >
> > > I hope to have been clear.
> > >
> > > WDYT ?
> > >
> > >
> > >
> > > Il giorno mer 4 dic 2024 alle ore 14:51 Mark Proctor <
> > mdproctor@apache.org>
> > > ha scritto:
> > >
> > > > I have opened a ticket for the Sequential Logic work I'm doing.
> > > > https://github.com/apache/incubator-kie-drools/issues/6182
> > > >
> > > > I had a slight pause, but I have now resumed this work.
> > > >
> > > > The sequential engine is a dedicated subsystem that integrates with
> > Rete's
> > > > alpha network but uses a state machine rather than Rete's beta network
> > to
> > > > drive the sequence matching. The current temporal operators (before,
> > after,
> > > > etc.) all require beta joins, which are not as efficient as a state
> > machine
> > > > and are not as flexible for complex sequences with loops.
> > > >
> > > > When a sequence is matched, it enters the beta network for additional
> > > > relational joins or rule firing. Future versions will optimise the
> > network
> > > > to avoid entering the beta network and fire immediately.
> > > >
> > > > Under the hood is a dedicated state machine that moves through states
> > when
> > > > signals are received from the SignalProcessors; the state machine is
> > > > optimised for integrations for the sources it interacts with. Those
> > signals
> > > > are provided by logic gates once they become satisfied. The logic gates
> > > > matched data received from the event stream, which itself is from the
> > alpha
> > > > network. The "feel" of the system is similar to how regular expression
> > > > matching works.
> > > >
> > > > Because it only wants to attempt to match data for the current active
> > > > sequence or subsequence, it uses a flat list of current patterns to
> > match
> > > > against. Bitmasks are used to get efficient routing from the input of
> > data,
> > > > to the pattern matching to the appropriate logic gates and their parent
> > > > sequence.
> > > >
> > > > The branch can be found here:
> > > > https://github.com/mdproctor/drools/tree/sequentiallogic
> > > >
> > > > It's early days, however a lot of the unit tests are in place to show
> > how
> > > > it works, but it's currently still very low level. For those
> > interested, a
> > > > lot of the unit tests can be found here:
> > > >
> > > >
> > https://github.com/mdproctor/drools/tree/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing
> > > >
> > > >
> > > > A sequence has 1...n steps. Currently, it supports LogicCircuits,
> > Actions,
> > > > Aggregators and Subsequences.
> > > >
> > > >
> > > >
> > https://github.com/mdproctor/drools/tree/sequentiallogic/drools-base/src/main/java/org/drools/base/reteoo/sequencing/steps
> > > >
> > > >
> > > > This test shows how to construct the logic gates, which are used
> > within a
> > > > LogicCircuit:
> > > >
> > > >
> > > >
> > https://github.com/mdproctor/drools/blob/sequentiallogic/drools-base/src/main/java/org/drools/base/reteoo/sequencing/signalprocessors/Gates.java
> > > >
> > > >
> > > >
> > https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerLogicGateTest.java
> > > >
> > > >
> > > > A LogicGate is a type of SignalProcessor:
> > > >
> > > >
> > > >
> > https://github.com/mdproctor/drools/blob/sequentiallogic/drools-base/src/main/java/org/drools/base/reteoo/sequencing/signalprocessors/LogicGate.java
> > > >
> > > >
> > > > Loops can occur on individual SignalProcesses or on Subsequences. Where
> > > > it's on a LogicGate, it tests the number of times the individual
> > LogicGate
> > > > is matched.
> > > >
> > > >
> > > >
> > https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerSignalProcessorCounterTest.java
> > > >
> > > >
> > > > Here is the conditional loop for SubSequence:
> > > >
> > > >
> > > >
> > https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerSequenceLoopTest.java
> > > >
> > > >
> > > > Timers are supported as well on signal processors and subsequences. The
> > > > timer can be used to add delays or do timeouts.
> > > >
> > > >
> > > >
> > https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerSignalProcessorTimerTest.java
> > > >
> > > >
> > > >
> > https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerSequenceTimerTest.java
> > > >
> > > >
> > > > Lastly, you can do aggregations over subsequences:
> > > >
> > > >
> > > >
> > https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerAggregatorTest.java
> > > >
> > > >
> > > > The next steps are to improve the unit tests and start to try and
> > expose
> > > > this in the DRL language itself so end users can start to use it.
> > > >
> > > >
> > > > Regards
> > > >
> > > >
> > > > Mark
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Mark
> > > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@kie.apache.org
> > For additional commands, e-mail: dev-help@kie.apache.org
> >
> >
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@kie.apache.org
For additional commands, e-mail: dev-help@kie.apache.org
Re: [PROPOSAL] Sequential Logic #6182
Posted by Gabriele Cardosi <ga...@gmail.com>.
HI Alex,
yes, I know it is sort-of hijacking.
But, at the same time, the vote for this proposal could be influenced also
by that.
Let's continue on the Discussion thread 👍
Il giorno ven 6 dic 2024 alle ore 11:42 Alex Porcelli <al...@porcelli.me> ha
scritto:
> Gabriele,
>
> You have an interesting point, however I don't think it's appropriate
> to hijack this proposal thread to discuss how to deal with
> innovation/experimentations/new features.
>
> Let's open a new Discussion thread, where I'd love to share some
> thoughts and explore the challenges and options on how to deal with
> such complicated topic.
>
> On Fri, Dec 6, 2024 at 3:33 AM Gabriele Cardosi
> <ga...@gmail.com> wrote:
> >
> > HI Mark,
> > of course I can't have an opinion on such low-level details of the rule
> > engine.
> > But, in general terms, this proposal seems related to a topic we slightly
> > touched in the past, i.e. if it would not be a good idea to create a sort
> > of "experimental" "new feature" or whatever branch for such new things,
> to
> > be used also for other new stuff.
> > To better reinforce the concept, I strongly believe that we must keep
> > creating new features and experimenting new approaches, but at the same
> > time we have to balance the impact on the principal branch, that should
> be
> > kept "stable".
> > Reason for that is that currently there is a lot of "abandoned" code in
> our
> > repositories, sort of POC or attempt that IINW no-one actually used and
> > no-one actually maintains (except if some test gets broken for some
> > unrelated modifications).
> > Again, I can't tell how the code you are writing fits in the general
> > picture, but since you opened a "PROPOSAL", it seems that it is not just
> a
> > simple reorganization or clean-up.
> > With that "new-feature" branch, curious or interested users could start
> > actually testing such a new code and, later on, we could have a better
> > opinion if the feature is mature enough (and used enough) to be merged
> (and
> > maintained) in the main branch.
> >
> > I hope to have been clear.
> >
> > WDYT ?
> >
> >
> >
> > Il giorno mer 4 dic 2024 alle ore 14:51 Mark Proctor <
> mdproctor@apache.org>
> > ha scritto:
> >
> > > I have opened a ticket for the Sequential Logic work I'm doing.
> > > https://github.com/apache/incubator-kie-drools/issues/6182
> > >
> > > I had a slight pause, but I have now resumed this work.
> > >
> > > The sequential engine is a dedicated subsystem that integrates with
> Rete's
> > > alpha network but uses a state machine rather than Rete's beta network
> to
> > > drive the sequence matching. The current temporal operators (before,
> after,
> > > etc.) all require beta joins, which are not as efficient as a state
> machine
> > > and are not as flexible for complex sequences with loops.
> > >
> > > When a sequence is matched, it enters the beta network for additional
> > > relational joins or rule firing. Future versions will optimise the
> network
> > > to avoid entering the beta network and fire immediately.
> > >
> > > Under the hood is a dedicated state machine that moves through states
> when
> > > signals are received from the SignalProcessors; the state machine is
> > > optimised for integrations for the sources it interacts with. Those
> signals
> > > are provided by logic gates once they become satisfied. The logic gates
> > > matched data received from the event stream, which itself is from the
> alpha
> > > network. The "feel" of the system is similar to how regular expression
> > > matching works.
> > >
> > > Because it only wants to attempt to match data for the current active
> > > sequence or subsequence, it uses a flat list of current patterns to
> match
> > > against. Bitmasks are used to get efficient routing from the input of
> data,
> > > to the pattern matching to the appropriate logic gates and their parent
> > > sequence.
> > >
> > > The branch can be found here:
> > > https://github.com/mdproctor/drools/tree/sequentiallogic
> > >
> > > It's early days, however a lot of the unit tests are in place to show
> how
> > > it works, but it's currently still very low level. For those
> interested, a
> > > lot of the unit tests can be found here:
> > >
> > >
> https://github.com/mdproctor/drools/tree/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing
> > >
> > >
> > > A sequence has 1...n steps. Currently, it supports LogicCircuits,
> Actions,
> > > Aggregators and Subsequences.
> > >
> > >
> > >
> https://github.com/mdproctor/drools/tree/sequentiallogic/drools-base/src/main/java/org/drools/base/reteoo/sequencing/steps
> > >
> > >
> > > This test shows how to construct the logic gates, which are used
> within a
> > > LogicCircuit:
> > >
> > >
> > >
> https://github.com/mdproctor/drools/blob/sequentiallogic/drools-base/src/main/java/org/drools/base/reteoo/sequencing/signalprocessors/Gates.java
> > >
> > >
> > >
> https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerLogicGateTest.java
> > >
> > >
> > > A LogicGate is a type of SignalProcessor:
> > >
> > >
> > >
> https://github.com/mdproctor/drools/blob/sequentiallogic/drools-base/src/main/java/org/drools/base/reteoo/sequencing/signalprocessors/LogicGate.java
> > >
> > >
> > > Loops can occur on individual SignalProcesses or on Subsequences. Where
> > > it's on a LogicGate, it tests the number of times the individual
> LogicGate
> > > is matched.
> > >
> > >
> > >
> https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerSignalProcessorCounterTest.java
> > >
> > >
> > > Here is the conditional loop for SubSequence:
> > >
> > >
> > >
> https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerSequenceLoopTest.java
> > >
> > >
> > > Timers are supported as well on signal processors and subsequences. The
> > > timer can be used to add delays or do timeouts.
> > >
> > >
> > >
> https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerSignalProcessorTimerTest.java
> > >
> > >
> > >
> https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerSequenceTimerTest.java
> > >
> > >
> > > Lastly, you can do aggregations over subsequences:
> > >
> > >
> > >
> https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerAggregatorTest.java
> > >
> > >
> > > The next steps are to improve the unit tests and start to try and
> expose
> > > this in the DRL language itself so end users can start to use it.
> > >
> > >
> > > Regards
> > >
> > >
> > > Mark
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Mark
> > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@kie.apache.org
> For additional commands, e-mail: dev-help@kie.apache.org
>
>
Re: [PROPOSAL] Sequential Logic #6182
Posted by Alex Porcelli <al...@porcelli.me>.
Gabriele,
You have an interesting point, however I don't think it's appropriate
to hijack this proposal thread to discuss how to deal with
innovation/experimentations/new features.
Let's open a new Discussion thread, where I'd love to share some
thoughts and explore the challenges and options on how to deal with
such complicated topic.
On Fri, Dec 6, 2024 at 3:33 AM Gabriele Cardosi
<ga...@gmail.com> wrote:
>
> HI Mark,
> of course I can't have an opinion on such low-level details of the rule
> engine.
> But, in general terms, this proposal seems related to a topic we slightly
> touched in the past, i.e. if it would not be a good idea to create a sort
> of "experimental" "new feature" or whatever branch for such new things, to
> be used also for other new stuff.
> To better reinforce the concept, I strongly believe that we must keep
> creating new features and experimenting new approaches, but at the same
> time we have to balance the impact on the principal branch, that should be
> kept "stable".
> Reason for that is that currently there is a lot of "abandoned" code in our
> repositories, sort of POC or attempt that IINW no-one actually used and
> no-one actually maintains (except if some test gets broken for some
> unrelated modifications).
> Again, I can't tell how the code you are writing fits in the general
> picture, but since you opened a "PROPOSAL", it seems that it is not just a
> simple reorganization or clean-up.
> With that "new-feature" branch, curious or interested users could start
> actually testing such a new code and, later on, we could have a better
> opinion if the feature is mature enough (and used enough) to be merged (and
> maintained) in the main branch.
>
> I hope to have been clear.
>
> WDYT ?
>
>
>
> Il giorno mer 4 dic 2024 alle ore 14:51 Mark Proctor <md...@apache.org>
> ha scritto:
>
> > I have opened a ticket for the Sequential Logic work I'm doing.
> > https://github.com/apache/incubator-kie-drools/issues/6182
> >
> > I had a slight pause, but I have now resumed this work.
> >
> > The sequential engine is a dedicated subsystem that integrates with Rete's
> > alpha network but uses a state machine rather than Rete's beta network to
> > drive the sequence matching. The current temporal operators (before, after,
> > etc.) all require beta joins, which are not as efficient as a state machine
> > and are not as flexible for complex sequences with loops.
> >
> > When a sequence is matched, it enters the beta network for additional
> > relational joins or rule firing. Future versions will optimise the network
> > to avoid entering the beta network and fire immediately.
> >
> > Under the hood is a dedicated state machine that moves through states when
> > signals are received from the SignalProcessors; the state machine is
> > optimised for integrations for the sources it interacts with. Those signals
> > are provided by logic gates once they become satisfied. The logic gates
> > matched data received from the event stream, which itself is from the alpha
> > network. The "feel" of the system is similar to how regular expression
> > matching works.
> >
> > Because it only wants to attempt to match data for the current active
> > sequence or subsequence, it uses a flat list of current patterns to match
> > against. Bitmasks are used to get efficient routing from the input of data,
> > to the pattern matching to the appropriate logic gates and their parent
> > sequence.
> >
> > The branch can be found here:
> > https://github.com/mdproctor/drools/tree/sequentiallogic
> >
> > It's early days, however a lot of the unit tests are in place to show how
> > it works, but it's currently still very low level. For those interested, a
> > lot of the unit tests can be found here:
> >
> > https://github.com/mdproctor/drools/tree/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing
> >
> >
> > A sequence has 1...n steps. Currently, it supports LogicCircuits, Actions,
> > Aggregators and Subsequences.
> >
> >
> > https://github.com/mdproctor/drools/tree/sequentiallogic/drools-base/src/main/java/org/drools/base/reteoo/sequencing/steps
> >
> >
> > This test shows how to construct the logic gates, which are used within a
> > LogicCircuit:
> >
> >
> > https://github.com/mdproctor/drools/blob/sequentiallogic/drools-base/src/main/java/org/drools/base/reteoo/sequencing/signalprocessors/Gates.java
> >
> >
> > https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerLogicGateTest.java
> >
> >
> > A LogicGate is a type of SignalProcessor:
> >
> >
> > https://github.com/mdproctor/drools/blob/sequentiallogic/drools-base/src/main/java/org/drools/base/reteoo/sequencing/signalprocessors/LogicGate.java
> >
> >
> > Loops can occur on individual SignalProcesses or on Subsequences. Where
> > it's on a LogicGate, it tests the number of times the individual LogicGate
> > is matched.
> >
> >
> > https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerSignalProcessorCounterTest.java
> >
> >
> > Here is the conditional loop for SubSequence:
> >
> >
> > https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerSequenceLoopTest.java
> >
> >
> > Timers are supported as well on signal processors and subsequences. The
> > timer can be used to add delays or do timeouts.
> >
> >
> > https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerSignalProcessorTimerTest.java
> >
> >
> > https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerSequenceTimerTest.java
> >
> >
> > Lastly, you can do aggregations over subsequences:
> >
> >
> > https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerAggregatorTest.java
> >
> >
> > The next steps are to improve the unit tests and start to try and expose
> > this in the DRL language itself so end users can start to use it.
> >
> >
> > Regards
> >
> >
> > Mark
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Mark
> >
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@kie.apache.org
For additional commands, e-mail: dev-help@kie.apache.org
Re: [PROPOSAL] Sequential Logic #6182
Posted by Gabriele Cardosi <ga...@gmail.com>.
HI Mark,
of course I can't have an opinion on such low-level details of the rule
engine.
But, in general terms, this proposal seems related to a topic we slightly
touched in the past, i.e. if it would not be a good idea to create a sort
of "experimental" "new feature" or whatever branch for such new things, to
be used also for other new stuff.
To better reinforce the concept, I strongly believe that we must keep
creating new features and experimenting new approaches, but at the same
time we have to balance the impact on the principal branch, that should be
kept "stable".
Reason for that is that currently there is a lot of "abandoned" code in our
repositories, sort of POC or attempt that IINW no-one actually used and
no-one actually maintains (except if some test gets broken for some
unrelated modifications).
Again, I can't tell how the code you are writing fits in the general
picture, but since you opened a "PROPOSAL", it seems that it is not just a
simple reorganization or clean-up.
With that "new-feature" branch, curious or interested users could start
actually testing such a new code and, later on, we could have a better
opinion if the feature is mature enough (and used enough) to be merged (and
maintained) in the main branch.
I hope to have been clear.
WDYT ?
Il giorno mer 4 dic 2024 alle ore 14:51 Mark Proctor <md...@apache.org>
ha scritto:
> I have opened a ticket for the Sequential Logic work I'm doing.
> https://github.com/apache/incubator-kie-drools/issues/6182
>
> I had a slight pause, but I have now resumed this work.
>
> The sequential engine is a dedicated subsystem that integrates with Rete's
> alpha network but uses a state machine rather than Rete's beta network to
> drive the sequence matching. The current temporal operators (before, after,
> etc.) all require beta joins, which are not as efficient as a state machine
> and are not as flexible for complex sequences with loops.
>
> When a sequence is matched, it enters the beta network for additional
> relational joins or rule firing. Future versions will optimise the network
> to avoid entering the beta network and fire immediately.
>
> Under the hood is a dedicated state machine that moves through states when
> signals are received from the SignalProcessors; the state machine is
> optimised for integrations for the sources it interacts with. Those signals
> are provided by logic gates once they become satisfied. The logic gates
> matched data received from the event stream, which itself is from the alpha
> network. The "feel" of the system is similar to how regular expression
> matching works.
>
> Because it only wants to attempt to match data for the current active
> sequence or subsequence, it uses a flat list of current patterns to match
> against. Bitmasks are used to get efficient routing from the input of data,
> to the pattern matching to the appropriate logic gates and their parent
> sequence.
>
> The branch can be found here:
> https://github.com/mdproctor/drools/tree/sequentiallogic
>
> It's early days, however a lot of the unit tests are in place to show how
> it works, but it's currently still very low level. For those interested, a
> lot of the unit tests can be found here:
>
> https://github.com/mdproctor/drools/tree/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing
>
>
> A sequence has 1...n steps. Currently, it supports LogicCircuits, Actions,
> Aggregators and Subsequences.
>
>
> https://github.com/mdproctor/drools/tree/sequentiallogic/drools-base/src/main/java/org/drools/base/reteoo/sequencing/steps
>
>
> This test shows how to construct the logic gates, which are used within a
> LogicCircuit:
>
>
> https://github.com/mdproctor/drools/blob/sequentiallogic/drools-base/src/main/java/org/drools/base/reteoo/sequencing/signalprocessors/Gates.java
>
>
> https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerLogicGateTest.java
>
>
> A LogicGate is a type of SignalProcessor:
>
>
> https://github.com/mdproctor/drools/blob/sequentiallogic/drools-base/src/main/java/org/drools/base/reteoo/sequencing/signalprocessors/LogicGate.java
>
>
> Loops can occur on individual SignalProcesses or on Subsequences. Where
> it's on a LogicGate, it tests the number of times the individual LogicGate
> is matched.
>
>
> https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerSignalProcessorCounterTest.java
>
>
> Here is the conditional loop for SubSequence:
>
>
> https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerSequenceLoopTest.java
>
>
> Timers are supported as well on signal processors and subsequences. The
> timer can be used to add delays or do timeouts.
>
>
> https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerSignalProcessorTimerTest.java
>
>
> https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerSequenceTimerTest.java
>
>
> Lastly, you can do aggregations over subsequences:
>
>
> https://github.com/mdproctor/drools/blob/sequentiallogic/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/phreak/sequencing/PhreakSequencerAggregatorTest.java
>
>
> The next steps are to improve the unit tests and start to try and expose
> this in the DRL language itself so end users can start to use it.
>
>
> Regards
>
>
> Mark
>
>
>
>
>
>
>
>
>
> Mark
>