You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by aitozi <gj...@gmail.com> on 2018/03/05 09:42:03 UTC

cep code

Hi,

i am reading flink-cep source code based on release-1.3.2 . I cant
understand here , can anyone help me on this in NFACompiler?

private List<Tuple2&lt;IterativeCondition&lt;T>, String>>
getCurrentNotCondition() {
			List<Tuple2&lt;IterativeCondition&lt;T>, String>> notConditions = new
ArrayList<>();

			Pattern<T, ? extends T> previousPattern = currentPattern;
			while (previousPattern.getPrevious() != null && (
			
previousPattern.getPrevious().getQuantifier().hasProperty(Quantifier.QuantifierProperty.OPTIONAL)
||
				previousPattern.getPrevious().getQuantifier().getConsumingStrategy() ==
Quantifier.ConsumingStrategy.NOT_FOLLOW)) {

				previousPattern = previousPattern.getPrevious();

				if (previousPattern.getQuantifier().getConsumingStrategy() ==
Quantifier.ConsumingStrategy.NOT_FOLLOW) {
					final IterativeCondition<T> notCondition = (IterativeCondition<T>)
previousPattern.getCondition();
					notConditions.add(Tuple2.of(notCondition, previousPattern.getName()));
				}
			}
			return notConditions;
		}

it choose the pattern "hasProperty(Quantifier.QuantifierProperty.OPTIONAL)"
or "Quantifier.ConsumingStrategy.NOT_FOLLOW" but it just add it to
notConditions when it is "Quantifier.ConsumingStrategy.NOT_FOLLOW" is there
something wrong 




--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/

Re: cep code

Posted by aitozi <gj...@gmail.com>.
Then what is STOP state in NFA, i haven't seen this state in event pattern
match paper ? Does each Not pattern will be transformed to stop state?



--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/

Re: cep code

Posted by Dawid Wysakowicz <wy...@gmail.com>.
Hi,

It is a very low level detail of the CEP library, that should be transparent for the end-user.

However, just to clarify it a bit, it is expected. The reason behind this function is to create an optional path that bypasses all optional states. NOT_FOLLOW is treated as part of optional path, but in contrast to OPTIONAL its condition should be taken into account into the combined condition. Hope it helps.

Regards,
Dawid

> On 5 Mar 2018, at 10:42, aitozi <gj...@gmail.com> wrote:
> 
> Hi,
> 
> i am reading flink-cep source code based on release-1.3.2 . I cant
> understand here , can anyone help me on this in NFACompiler?
> 
> private List<Tuple2&lt;IterativeCondition&lt;T>, String>>
> getCurrentNotCondition() {
> 			List<Tuple2&lt;IterativeCondition&lt;T>, String>> notConditions = new
> ArrayList<>();
> 
> 			Pattern<T, ? extends T> previousPattern = currentPattern;
> 			while (previousPattern.getPrevious() != null && (
> 
> previousPattern.getPrevious().getQuantifier().hasProperty(Quantifier.QuantifierProperty.OPTIONAL)
> ||
> 				previousPattern.getPrevious().getQuantifier().getConsumingStrategy() ==
> Quantifier.ConsumingStrategy.NOT_FOLLOW)) {
> 
> 				previousPattern = previousPattern.getPrevious();
> 
> 				if (previousPattern.getQuantifier().getConsumingStrategy() ==
> Quantifier.ConsumingStrategy.NOT_FOLLOW) {
> 					final IterativeCondition<T> notCondition = (IterativeCondition<T>)
> previousPattern.getCondition();
> 					notConditions.add(Tuple2.of(notCondition, previousPattern.getName()));
> 				}
> 			}
> 			return notConditions;
> 		}
> 
> it choose the pattern "hasProperty(Quantifier.QuantifierProperty.OPTIONAL)"
> or "Quantifier.ConsumingStrategy.NOT_FOLLOW" but it just add it to
> notConditions when it is "Quantifier.ConsumingStrategy.NOT_FOLLOW" is there
> something wrong
> 
> 
> 
> 
> --
> Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/