CQL - Pattern Matching Performance Question

Scenario:
Suppose I have a processor that has a MATCH RECOGNIZE of A B C D
and every minute I have 1000 events of A and B, but C and D is not always arriving.
Question:
I understand that CQL stores A and B or C somewhere in CEP,
Is there a mechanism like garbage collection in CEP that disposes the
events A and B so that the memory use of CEP will not be that great?

Do you mean like
String pattern = "(.*?)" + collocation +"(.*)";Another option is to just use indexOf(collocation) which is a simpler way of doing the same thing.

Similar Messages

  • Complex string pattern match/sort question for mapping data - Exchange Enable mailbox use case

    Hi,  Im trying to do a runbook to Enable mailbox for a user.  Our Exchange Admin uses a rule/formula to allocate the mailbox database based on users first name and this is what I am having difficulty replicating in Orchestrator to add the correct
    data in the Database property of Enable Mailbox activity.
    The Rule exchange uses, takes up to the first 3 chars of forename and based on an alphabetic sort, it will allocate to a particular mailbox db (we have a quite large Exchange Org with 20k users so hes tried to allocate about 500 users per mailboxDB).  so
    for example User Forename A-ALI = DB1, ALL-ANG = DB2, ANH-ANY=DB3,AO-BER=DB4 etc etc.
    So I was hoping someone could advise of some string comparison activities native in Orchestrator or maybe done as last resort in powershell (as I'm not great in powershell) to provide a map of the published data for forname to appropriate mailbox matrix.
    Any help on this would be much appreciated...
    Cheers

    You could use the built in Mid function [Mid(‘Return subset from this string’,1,3)] to get the first three letters of their name and honestly I would send
    this to the Run .Net Script activity using powershell myself and do a select case to get it to publish to the database the name of the database server.
    I am all for using  built in activities to do things in Orchestrator but you are going to quickly find that you need to have good powershell scripting skills to extend the tools beyond the capabilities of the built in activities.
    Vaughn

  • CQL Overlapping Pattern Matching

    Hi,
    I need to match the pattern "A" followed by "B" in a series of events but the pattern may overlap so if I have the sequence "A","A","A","B","B","B" the pattern should match 3 times. I've tried this with and without the ALL MATCHES clause but cannot get the desired behaviour. Is this possible in CQL?
    My event is
    <wlevs:event-type type-name="simpleEvent">
              <wlevs:properties>
                   <wlevs:property name="DataField" type="char" />
                   <wlevs:property name="Id" type="int" />
              </wlevs:properties>
    </wlevs:event-type>
    and my pattern matching CQL is:
    select T.Id1 as Id1, T.Id2 as Id2
    from
    EventChannel
    MATCH_RECOGNIZE (
    MEASURES A.Id as Id1, C.Id as Id2
    ALL MATCHES
    PATTERN (A B*? C)
    DEFINE A as A.DataField = 'A',
    B as B.DataField != 'B',
    C as C.DataField = 'B'
    ) as T
    Thanks
    Mike

    As per your requirement, it looks like the requirement is to match Nth occurrence of A with Nth occurrence of B(counted after at least one A has been seen), in a stream of inputs containing A's and B's in any order.
    Here the pattern matching is done in two steps as follows:
    1. An intermediate view helloWorldView is created. It has an additional field numOccur. Corresponding to every input on helloWorldInputChannel, the view has one output and the value of numOccur field in that output is the number of events seen so far, whose DataField value is the same as the DataField value of the current input. Leading B's (prior to any A) will have numOccur as 0. So effectively, for each occurrence of 'A' and 'B' we have a number representing which occurrence it is i.e. if it is the 1st occurrence or 2nd occurrence etc.
    2. One more pattern-matching query is applied on top of the output of helloWorldView. Here we start a match whenever we encounter an 'A' and end the match whenever we get a B, whose numOccur field is equal to that of A.
    The input stream helloworldInputChannel has the schema - (eid int, DataField char).
    <view id="helloWorldView">
    <![CDATA[
    select T.eid as eid, T.DataField as DataField, T.numOccur as numOccur
    from helloworldInputChannel MATCH_RECOGNIZE (
    MEASURES
    eid as eid,
    DataField as DataField,
    (case
    when((DataField = 'A') and (firstOccur.DataField = 'A')) then count(A.*) + 1
    when((DataField = 'A') and (firstOccur.DataField != 'A')) then count(A.*)
    when(DataField = 'B') then count(B.*)
    when(firstOccur.DataField = 'A') then 1
    end) as numOccur
    ALL MATCHES
    PATTERN(firstOccur ignoreB* (A | B)*)
    DEFINE
    firstOccur as prev(firstOccur.DataField) is null,
    ignoreB as (ignoreB.DataField = 'B' and (firstOccur.DataField = 'B') and (count(A.*) = 0)),
    A as A.DataField = 'A',
    B as(B.DataField = 'B' and ((firstOccur.DataField = 'A') or (count(A.*) > 0)))
    ) as T
    ]]>
    </view>
    <query id="helloworldRule">
    <![CDATA[
                select
                       T.Id1 as Id1,
                       T.Id2 as Id2
                from
                        helloWorldView MATCH_RECOGNIZE (
                            MEASURES
                                     A.eid as Id1, 
                                     C.eid as Id2
                            ALL MATCHES
                            PATTERN (A  B* C)
                            DEFINE 
                                   A as A.DataField = 'A',
                                   C as (C.DataField = 'B' and C.numOccur = A.numOccur)
                        ) as T
            ]]>
    </query>
    Hopefully this will address your requirement.
    Regards
    Unmesh

  • Use of edge detection in pattern matching algorithm?

    Hello all,
                    I work for a group at Texas A&M University researching two-phase flow in reactors.  We have been using IMAQ Vision and had a question regarding the use of edge detection in the pattern matching algorithm.  I had seen the webcast entitled “Algorithms that Learn: The Sum and Substance of Pattern Matching and OCR” (http://zone.ni.com/wv/app/doc/p/id/wv-705) and in the webcast it was mentioned that the pattern matching algorithm uses edge detection to, (as best I can tell), reduce the candidate list further and to perform subpixel location calculations.  However, I was wondering if this edge detection process is still performed if we do not use the subpixel location calculation (i.e. if we uncheck the “Subpixel Accuracy” check box)?  Also, if edge detection is performed in the pattern matching algorithm is it consistent with the method described in Chapter 13 of the Vison Concepts Manual (“Geometric Matching”)?  Finally, if edge detection is performed in a manner consistent with Chapter 13 of the manual, how does the geometric matching correlation number affect the correlation calculation that was performed in the previous steps?  Are they simply multiplied together?
    Many thanks!
      -Aaron

    Jeff,
    We are using Imaq Vision Builder 4, with the included pattern matching that can be accessed via the menus (i.e. we haven't created a custom VI or anything.)  We are using the software to locate bubbles during boiling experiments and want a deeper understanding of what is going on "behind the scenes" of the algorithm, as we may have to explain how it works later.  We have been able to determine most of what we need from the webcast I had previously mentioned, except for the use of edge detection in the pattern matching algorithm.
    At the scales involved in our experiments, subpixel accuracy is really not needed and therefore we do not use it.  If edge detection is used in the pattern matching algorithm only to determine location with subpixel accuracy, then we do not really need to know how it works because we do not use that calculation.  Inversely, of course, if edge detection is used during pattern matching even without enabling subpixel accuracy, then we would like to have a fairly good understanding of the process.
    I've read most of the section on geometric matching in the Vision Concepts Manual and wondered if the process described there for edge detection (or feature matching) was also used in the basic pattern matching algorithm?
    To summarize, if edge detection is not used in the basic pattern matching algorithm without subpixel accuracy, then that is all I need to know.  If edge detection is used for pattern matching even without using the subpixel accuracy calculation, then we would like to learn more about how exactly it is used in the pattern matching algorithm.
    We would really appreciate any help you could give us... we've been digging around on the NI website for a couple of weeks now trying to fit together all the pieces of the pattern matching puzzle.
    Many thanks!
        Aaron

  • Pattern Matching or Golden Template

    Hello all,
       I posted a question earlier on what advice can be given for hardware that could be used to acquire a fingerprint. I got a very helpful answer. Now I'm still working on this fingerprint recognition project and have been looking around into the logic to be used on matching images. I came across both the "pattern matching" and "golden template" available features on NI Vision assistant and was hoping someone could point me on the right direction so that I could obtain more insight information on how either one of these features perform their matches.
    Thank you,
    OC
    Solved!
    Go to Solution.

    Hi OC,
    Included with NI Vision is the 400+ page Vision Concepts Manual.  This explains in detail all of the functions available in NI Vision, including Pattern Matching and Golden Template Comparison.
    This document can be found in <Program Files>\National Instruments\Vision\Documentation\Concepts_Manual.pdf
    Chris Bolin
    LabVIEW Partner Program, CLA

  • How to use AND,OR,NOT condition in Pattern Matching in java

    how to use AND,OR,NOT condition in Pattern Matching in java
    Please anyone give example..

    Stop asking these stupid vague questions and do some of your own research.
    Start here:
    http://www.regular-expressions.info/
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html

  • Regular expression and pattern matching/replacing

    I have a list of key words. It has around 1000 key word now but can grow to 5000 keywords.
    My web application displays lot of texts which are stored in the database. My requirement is to scan each text for the occurance of any of the above keywords. If any keyword is present I have to replace that with some custom values, before showing it to the user.
    I was thinking of using using regular expression for replacing the keyword in the text using matcher.replaceAll method as follows:
    Pattern pattern = Pattern.compile(patternStr);
    Matcher matcher = pattern.matcher(inputStr);
    String output = matcher.replaceAll(replacementStr);
    But My pattern string will have around 5000 keywords with the 'OR' Logical Operator like- keyword1| keyword2 I keyword3 | ..........
    Will such a big pattern string adversly affect the performance? What can I do to speed up the performance? (Since my keyword list is not static i would prefer to do the replacement just before showing the text to the user)
    Any suggestions are most welcome.

    I don't think a pure regex approach would be that slow, but it would be a maintenance nightmare. I think a combined regex/table-lookup approach would be best: use a regex to identify potential keywords, then look them up in the table to confirm. For instance, to find all Java keywords you could use the regex "\\b[a-z]{2,12}+\\b" to filter out anything that can't possibility be a keyword.
    What are you going to replace the keywords with? Will it vary depending on which keyword is found? If so, you'll have to use a table--and you won't be able to use the replaceAll method, because it can't handle dynamically generated replacement values. You would have to use the lower-level appendReplacement and appendTail method instead.

  • USB SNAP + colour pattern matching ( IMAQ)

    I am new to LAbView and currently  I am working on colour pattern matching with USB snap. My problem is this program keep prompt me on the IMAQ Learn Colour Pattern. I need someone to help me solve that problem.
    Another question is 'Are colour pattern matching require us to save and load file before learn a template?'
    I am using LabView 7.1 and I would appreciate anyone who help me. Thanks
    Message Edited by Chee Hou on 09-16-2009 03:46 AM
    Attachments:
    Untitled.vi ‏189 KB

    Hello Chee Hou,
    Have you tried to run the example to do color pattern matching?
    From the example, you do need to have a template picture ready when you are using the colour pattern matching.
    You need to Learn Colour Pattern and then load the pattern to do color pattern matching.
    Hope this helps.
    James
    - Meadow -
    LabVIEW 7.0 - 2011, Vision, RT, FPGA
    TestStand 3.0 - 4.5

  • Color pattern matching is very slow

    Hi
    I tried this code creating one vi application.
    After the testing with USB webcam I have realized that the color pattern matching is very slow. How to increase the speed and to work smoothly in real time.
    Thank you

    Hello tiho,
    the color pattern matching is not as fast as 8-bit matching, but should still be fast.
    For example, I am attaching a VI for color pattern matching where you load the image, create the template and search do the matching.
    In my example I tried color pattern matching on color image of size 4288x2848 pixels and the matching is performed in ~140 ms (~7Hz). So, for a smaller image, I think the real-time processing is quite achievable (I consider real-time 20 Hz or more). The only problem is the template learning, which in my case takes around 10 seconds. But you should learn the template only once in the initialization stage.
    Best regards,
    K
    https://decibel.ni.com/content/blogs/kl3m3n
    "Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
    Attachments:
    color matching.zip ‏49 KB

  • Slowness of color pattern matching vi

    Hi,
    We're trying to implement a SLAM (simultaneous localization and mapping) algorithm in Labview based on kinect. In order to do so, the mapping robot should spot landmarks in real-time from the kinect image. We found the color pattern matching VI which does exactly what we need but the problem is that it's very slow (about 1.5 seconds for each image and total of 3 images each iteration). Is this the normal time for detecting landmarks in a kinect image? The robot can't map accurately when the iteration is so slow.
    Thanks,
    Rap Master
    Attachments:
    detect landmarks.vi ‏61 KB

    Given that the pattern matching VI is an IMAQ (Image Acquisition) VI, this question will be best served by posting in our Machine Vision forums.
    Blake C.
    Applications Engineer
    National Instruments
    www.ni.com/support

  • Pattern matching for LCD function test

    Hello,
    I am writing a VI that is taking a single picture from a camera and then compares it with a template extracted before that.
    The camera is looking at LCD display and and the purpose of the matching is to find whether there is a dead pixel or sth wrong at the display. The problem is that the comparison doesn't work as expected.
    I will illustrate this with just one examples with picture attached:
    - At step 1. the template is created. (you can see RUN 2 at the top left corner at the display) 
    - At step 2. pattern matching is performed with the same mode of the LCD but a little bit tilted(score - 972 achieved)
    - At step 3. the mode is changed (you can see RUN 3 at the top left corner at the display, everything else is the same) - but however a bigger score of 974 is achieved
    Any explanation of this and some suggestions that can improve my program !?
    Thanks a lot
    Iliya G. 
    Attachments:
    1step.JPG ‏43 KB
    2step.JPG ‏42 KB
    3step.JPG ‏38 KB

    Hi David,
    I went through this OCR examples that you mentioned but in fact I find them very annoying because in many cases the output string depends on how you draw your ROI. Please, find an example below and could you please tell me if i am doing sth wrong, but in fact i don't think so.
    When I try to read the characters separetely, everythings goes ok - it finds r,u,n and 1.
    But when I make the ROI bigger in order to contain all the characters, the output is the one at the picture. Any ideas?
    Thanks,
    Iliya 
    Attachments:
    1.JPG ‏21 KB

  • Pattern-Matcher

    hi guys.. i need help on pattern-matcher. below is a simplified portion of my problem.
    using line A, if you run it.. u will see that when u type in *&word*, the result would be Doesn't Match. i believe it is due to the *\b* notation in the Pattern.compile where it specifies the word boundary that excludes whitespaces and punctuation mark.
    I know it will work when i use line B instead. but the occurance would also be detected when i input blabla&word or *&wordblabla* or bla&wordbla (this is true but somehow it doesn't work in this simplified code)
    thus.. my question is.. how do i specify a word boundary (like what \b does) and at the same time.. allow for punctuation marks to occur in my word?
    for example.. i would like to encounter for these patterns:
    *<word>*
    *&word*
    i hope u guys can help me out. thank you in advance.
    import javax.swing.*;
    import java.util.regex.*;
    public class PatternMatcherTest
         public PatternMatcherTest()
              String regex = "&word";
              Pattern p = Pattern.compile("\\b" + regex + "\\b");   // -- line A
              //Pattern p = Pattern.compile(regex);                     // -- line B
              Matcher m = p.matcher(JOptionPane.showInputDialog(null, "Enter string: "));
              if (m.matches())
                   System.out.println("Match!");
              else
                   System.out.println("Doesn't Match");
         public static void main (String [] args)
              PatternMatcherTest pmt = new PatternMatcherTest();
    }

    I'm not sure I understand your requirements, but try this: Pattern p = Pattern.compile("(?<!\\w)" + regex + "(?!\\w)"); If that doesn't solve your problem, post some examples of inputs and the outputs that you want to get for them.
    hlfrk414 wrote:
    Have you tried making the word boundaries reluctant? If you want to see if the punctuation matches later, then change the \b to \b??
    The ?? tell the regex to choose the minimum needed to make the group happy. So the \b?? wont take punctuation unless no other groups want it.Ummmm... no.

  • How to use Labview to output the coordinates from Pattern Matching result

    I tried to add some labview commands into the vi program created by IMAQ Pattern Matching scrip to output the coordinates of a target point found in Pattern Matching because i need to do some calculations for the point coordinates and I don't want just to read the values from the IMAQ results on the monitor. Does anyone can help me? Thank you.
    Attachments:
    PatternMatching1.vi ‏84 KB

    I have posted replies to your other postings with your same question, and continue to recomend that you look at some of the LabVIEW tutorials.
    I modified the attched program such that it would index the arrays of match information returned and then unbundle the X and Y features of the match and add them to gether as an example of how to access the data programatically.
    I hope this helps.
    Regards,
    Amaury Rolin
    NI Applications Engineer
    Attachments:
    PatternMatching_mod.vi ‏88 KB

  • New language feature: lazy local pattern matching

    <p>In the upcoming release of the Open Quark Framework, CAL gets a new language       feature: lazy local pattern matching.</p> <p>The new local pattern match syntax allows one to bind one or more variables to       the fields of a data constructor or a record in a single declaration inside a       let block.</p> <p>      For example:</p> <p>      // data constructor patterns:<br />      public foo1 = let Prelude.Cons a b = ["foo"]; in a;<br />      public foo2 = let Prelude.Cons {head=a, tail=b} = ["foo"]; in a;<br />      <br />      // list cons patterns:<br />      public foo3 = let a:b = [3]; in a;<br />      <br />      // tuple patterns:<br />      public foo4 = let (a, b, c) = (b, c, 1 :: Prelude.Int); in abc;<br />      <br />      // record patterns:<br />      public foo5 = let = {a = "foo"}; in a; // non-polymorphic record pattern<br />      public foo6 = let {_ | a} = {a = "foo", b = "bar"}; in a; // polymorhpic record       pattern<br />      <br />      Whereas a case expression such as (case expr of a:b -> ...) forces the       evaluation of expr to weak-head normal form (WHNF), a similar pattern match       declaration (let a:b = expr; in ...) does not force the evaluation of expr       until one of a or b is evaluated. In this sense, we can regard this as a form       of lazy pattern matching.<br /> </p> <p>Thus,</p> <p>      let a:b = []; in 3.0;</p> <p>is okay and would not cause a pattern match failure, but the case expression</p> <p>      case [] of a:b -> 3.0;</p> <p>would cause a pattern match failure.</p> <p>This laziness is useful in situations where unpacking via a case expression may       result in an infinite loop. For example, the original definition of List.unzip3       looks like this:</p> <p>// Original implementation of List.unzip3<br />      unzip3 :: [(a, b, c)] -> ([a], <b>, [c]);<br />      public unzip3 !list =<br />          case list of<br />          [] -> ([], [], []);<br />          x : xs -><br />              let<br />                  ys =       unzip3 xs;<br />              in<br />                  case x       of<br />                  (x1,       x2, x3) -><br />                      //do       not do a "case" on the ys, since this makes unzip3 strictly evaluate the list!<br />                      (x1       : field1 ys, x2 : field2 ys, x3 : field3 ys);<br />              ;<br />          ;<br /> </p> <p>The use of the accessor functions field1, field2 and field3 here is necessary,       as the alternate implementation shown below would result in "unzip3 xs" to be       evaluated to WHNF during the evaluation of "unzip3 (x:xs)". Thus if the input       list is infinite, the function would never terminate. </p> <p>// Alternate (defective) implementation of List.unzip3<br />      unzip3 :: [(a, b, c)] -> ([a], <b>, [c]);<br />      public unzip3 !list =<br />          case list of<br />          [] -> ([], [], []);<br />          x : xs -><br />              let<br />                  ys =       unzip3 xs;<br />              in<br />                  case x       of<br />                  (x1,       x2, x3) -><br />                      case       ys of // the use of "case" here is inappropriate, as it causes "unzip3 xs" to       be evaluated to WHNF<br />                      (y1,       y2, y3) -> (x1 : y1, x2 : y2, x3 : y3);<br />                  ;<br />              ;<br />          ;<br /> </p> <p>With the new syntax, the original implementation can be expressed more nicely       without changing its semantics:</p> <p>// New implementation of List.unzip3, revised to use the local pattern match       syntax<br />      unzip3 :: [(a, b, c)] -> ([a], <b>, [c]);<br />      public unzip3 !list =<br />          case list of<br />          [] -> ([], [], []);<br />          x : xs -><br />              let<br />                  (y1,       y2, y3) = unzip3 xs; // using a tuple pattern to perform a lazy local pattern       match<br />              in<br />                  case x       of<br />                  (x1,       x2, x3) -><br />                      (x1       : y1, x2 : y2, x3 : y3);<br />              ;<br />          ;<br /> </p> <p style="text-decoration: underline">It is important to note that in places where       a case expression can be used (without having an unwanted change in the       laziness of the expression being unpacked), it should be used instead of this       local pattern match syntax.</p> <p>Things to note about the new syntax:</p> <p>      - local type declarations on the pattern-bound variables are allowed, and these       type declarations can have associated CALDoc comments. On the other hand, the       actual local pattern match declaration itself cannot have a type declaration       nor a CALDoc comment.</p> <p>      - this syntax cannot be used for top-level definitions, only local definitions       in let blocks</p> <p>      - one cannot use patterns with multiple data constructors, e.g.</p> <p>      let (Left|Right) = ...;</p> <p>      is not allowed</p> <p>      - one cannot specify a variable for the base record pattern, e.g.</p> <p>      let {r | a, b} = ...;</p> <p>      is not allowed, but this is okay:</p> <p>      let {_ | a, b} = ...;</p> <p>      - patterns without no variables are disallowed, e.g.</p> <p>      let _ = ...;<br />      let [] = ...;<br />      let () = ...;<br />      let : = ...;<br />      let {_|#1} = ...;      <br /> </p>

    If you use just / it misinterprets it and it ruins
    your " " tags for a string. I don't think so. '/' is not a special character for Java regex, nor for Java String.
    The reason i used
    literal is to try to force it to directly match,
    originally i thought that was the reason it wasn't
    working.That will be no problem because it enforces '.' to be treated as a dot, not as a regex 'any character'.
    Message was edited by:
    hiwa

  • How to accelerate the processing time of pattern match

    How to accelerate the processing time  of pattern match
      If my camera acquire an image in 50ms, but when we analyze this image with pattern match, we need about 300ms. Except using queue to seprate acquisition
    and analysis to different loops, there is another way to directly accelerate the processing time  of pattern match ? Maybe compact rio with FPGA ?
    But I saw a paper in NI web, there is no this function in c-rio ?  
    Any suggersion will be very apperciated ~
    Ricky
    Attachments:
    aa.png ‏65 KB

    Hello,
    what matching algorithm are you using? You can reduce time using the Gaussian pyramids algorithm.You can fine tune the parameters using the advanced options.
    What is your template size/image resolution?
    I suppose using a computer with better performance would also work...
    Best regards,
    K
    https://decibel.ni.com/content/blogs/kl3m3n
    "Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."

Maybe you are looking for

  • Flat File to Flat File Scenario using File Adapter

    Hi Experts,                 In my scenario, requirement is Flat File to Flat file through File Adapter in PI. At sender end, we would need to use Sender File Adapter (NFS) and receiver end we would need to use Receiver File Adapter (FTP). File would

  • Create personnel master record

    Hi all Can any mention me the steps in the creation of personnel master record. Urgent Thanks Sonali

  • Mail turning messages into attachments

    Hello. Apologies if this is covered elsewhere - I couldn't find any related discussions. Seemingly since my last update - to 10.6.2 - mail is doing something weird... Emails - particularly ones with attachments in them - are arriving in my inbox with

  • Output through trsta

    Hi Gurus, I am trying to create a condition table for output type for deliveries. But I can see the transportation plan status field in filed catalog. But when I am trying to create a condition table, the field catalog in the condition table creation

  • Wifi intermittent

    My wifi connection does not remain connected. I need to disconnect and then reconnect to reestablish wifi, sometimes every few minutes. Router SSID has been changed to broadcast and am using WPA2. Any fix available to this problem? The problem is cle