Name Pattern Matching

I have a rough understanding of regular expressions and an even rougher understanding of soundex, so I am aware that there are some powerful tools for matching strings out there.
My specific problem is that we are looking to build a name matching service which would map a given name (plain old string) against the official version of that name stored in a database.
So, if "Vectra" was entered, it would match against "Vauxhall Vectra GT". Similarly if "Vauxhall Vektra" was entered, it would also match against "Vauxhall Vectra GT".
My first thoughts are about storing the "true" name and adding the "also known as" instances to the DB with a pointer to the "true" name as the relationships are discovered. This should map consistent instances once they have been matched and referenced.
But are there any solid tools out there for doing that initial step of matching, either definitively or by rank, a given string to a database full of candidate strings? It would probably need to be able to ignore things like PLC,LTD, etc. Configurable rules would also be a bonus.
This might be a "buy" solution where the costs of such a system are appropriate to the level of utility we'll be getting out of it.
Failing that, we'll look at building a simple system in-house, so any war stories on such a project would be very much appreciated.
Many thanks,
Mark

Thanks for that. My eyes have gone funny looking at at, but I think I can see what it is doing.
I've been looking at things like "Lucene" which are full text search engines so do not really meet my needs.
To begin with, out matching process will involve a fair degree of human intervention to ensure that we get what we need. The techy side of it should just, in the first instance, pump out a list of proposed matches. I think the decomposition approach works for this (get me the rows that are like or sound like [word1] and then the matches that are like or sound like [word2]).
I think I'll look into Oracle's capabilities in this and see what I come up with. My preference is full java (or at least black box) solution with a minimal reliance on database features as possible.
I'll post here with an update as and when.
Mark

Similar Messages

  • JAXR.UDDI.027: Multiple Schemes matching name pattern

    What does that error mean?
    I'm trying to browse a UDDI repository using JAXR and I when I execute this line:
    ClassificationScheme scheme = bqm.findClassificationSchemeByName(null, "naics");
    I get the error identified in the subject.
    I think the problem is in the UDDI repository because when I execute the same code on http://uddi.ibm.com/testregistry/inquiryapi the error does not occur.
    My problem is, I don't even know what the error means in order to fix the repository. Can someone point me towards an explanation?

    Studying Monson-Haefel J2EE Webservices, I encountered the same issue multiple times with the IBM test UDDI. The message is accurate: there are multiple schemes with the exact same name in the IBM test UDDI. You can verify this with the following code:
               * ClassificationScheme uddi_types = queryMngr
               * .findClassificationSchemeByName(null, "uddi-org:types"); gives
               * Exception: JAXR.UDDI.027: Multiple Schemes matching name pattern
              Collection schemeCollection = queryClassificationSchemesByName(
                        queryMngr, "uddi-org:types");
              printSchemeCollection(schemeCollection);
              ClassificationScheme uddi_types = (ClassificationScheme) schemeCollection
                        .iterator().next();
         private static Collection queryClassificationSchemesByName(
                   BusinessQueryManager queryMngr, String schemeName)
                   throws JAXRException {
              Collection schemeCollection = new HashSet();
              schemeCollection.add(schemeName);
              BulkResponse bulkResponse = queryMngr.findClassificationSchemes(null,
                        schemeCollection, null, null);
              return bulkResponse.getCollection();
         private static void printSchemeCollection(Collection schemCollection)
                   throws JAXRException {
              Iterator schemaIterator = schemCollection.iterator();
              while (schemaIterator.hasNext()) {
                   ClassificationScheme scheme = (ClassificationScheme) schemaIterator
                             .next();
                   System.out.println(scheme.getName().getValue() + ", Key: "
                             + scheme.getKey().getId());
         }My latest result using these functions for the name uddi-org:types is
    uddi-org:types, Key: UUID:C1ACF26D-9672-4404-9D70-39B756E62AB4
    uddi-org:types, Key: UUID:3AE29440-DF6B-11D5-9094-0004AC49CC1E
    uddi-org:types, Key: UUID:1C091CC0-A439-11D8-83B1-000629DC0A53

  • How can I read a template and differentiate if it is a pattern matching template or a geometric matching template?

    Hey all,
    I would like to know how can I read a template´s information to know if it is a pattern macthing or a geometric matching template? 
    In my code, users provide templates and the algorithm must match them using pattern matching or geometric matching depending on the template.
    At the moment I am doing it by including a P or a G in the name of the file, but I would like to avoid this and read the information from the file.
    Any ideas?
    Thanks in advance,
    Esteban
    Solved!
    Go to Solution.

    Hey Esteban,
    you can use the VI "IMAQ Is Vision Info Present 2 VI" to reice the information:
    IMAQ Is Vision Info Present 2 VI - NI Vision 2011 for LabVIEW Help - National Instruments
    http://zone.ni.com/reference/en-XX/help/370281P-01/imaqvision/imaq_is_vision_info_present_2/
    Take a look at the attached VI
    Stephan
    Attachments:
    Determine Pattern type.zip ‏13 KB

  • Regular Expressions (Pattern/Matcher) --- Help

    Hi,
    I have an regex i.e. Pattern.compile("([0-9])D([0-9])'?(?:([0-9]+)\")?([NSEW])").{code}
    It has to exactly match the input e.g *45D15'34"N*
    I need to retrieve the values based on grouping.
    Group1 = 45 (degree value)
    Group2 = 15 (minutes value)
    Group3 = 34 (seconds value) ----> this is a non-capturing group
    Group4 = N (directions)
    The regex works fine for most of longitude/latitude value but I get a StackOverFlow for some. There is a known bug on this http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5050507
    According to the bug report, they have said that are many different regex that can trigger the stack overflow....even though the length of my input is not as long as the one posted on the bug report.
    I was wondering if anyone could suggest a different way of writing the regex above to avoid the stack over flow.
    Thank you in advance                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi,
    I missed the '+' in my original regex Pattern.compile("([0-9]+)D([0-9]+)'?(?:([0-9]+)\")?([NSEW])"){code}.
    I have also tried {code} Pattern.compile("(\\d+)D(\\d+)'?(?:(\\d+)\")?([NSEW])");And, the other 2 expressions as suggested by you.
    The problem happens when Durham Lat=”35D52’N” Lon=”78D47’W value is selected from a Jtree(the values are parsed from a xml file to the tree - the xml file has a bout 800 longitude/latitude elements for different cities in the US). It does not happen for other values and If I increment the degree or min by, then the expression works. I am not sure how else i could re-write this exp.
    Below is the snippet of the xml file:
    <State name="NORTH CAROLINA">
                <City name="Asheville AP"     Lat="35D26'N"     Lon="82D32'W"/>
                <City name="Charlotte AP"     Lat="35D13'N"     Lon="80D56'W"/>
                <City name="Durham"     Lat="35D52'N"     Lon="78D47'W"/>
                <City name="Elizabeth City AP"     Lat="36D16'N"     Lon="76D11'W"/>
                <City name="Fayetteville, Pope AFB" Lat="35D10'N"     Lon="79D01'W"/>
                <City name="Goldsboro,Seymour-Johnson"     Lat="35D20'N"     Lon="77D58'W"/>
                <City name="Greensboro AP (S)"     Lat="36D05'N"     Lon="79D57'W"/>
                <City name="Greenville"     Lat="35D37'N"     Lon="77D25'W"/>
                <City name="Henderson"     Lat="36D22'N"     Lon="78D25'W"/>
                <City name="Hickory"     Lat="35D45'N"     Lon="81D23'W"/>
                <City name="Jacksonville"     Lat="34D50'N"     Lon="77D37'W"/>
                <City name="Lumberton"     Lat="34D37'N"     Lon="79D04'W"/>
                <City name="New Bern AP"     Lat="35D05'N"     Lon="77D03'W"/>
                <City name="Raleigh/Durham AP (S)"     Lat="35D52'N"     Lon="78D47'W"/>
                <City name="Rocky Mount"     Lat="35D58'N"     Lon="77D48'W"/>
                <City name="Wilmington AP"     Lat="34D16'N"     Lon="77D55'W"/>
                <City name="Winston-Salem AP"     Lat="36D08'N"     Lon="80D13'W"/>
            </State>
    public final class GeoLine {
        /* Enum for the possible directions of longitude and latitude*/
        public enum Direction {
            N, S, E, W;
            public boolean isLongitude() {
                return (this == E || this == W);
            public boolean isLatitude() {
                return (this == N || this == S);
            public Direction getCanonicalDirection() {
                if (this == S) {
                    return Direction.N;
                } else if (this == W) {
                    return Direction.E;
                } else {
                    return this;
        private final int degree;
        private final int minute;
        private final int second;
        private final Direction dir;
        /* Recognizes longitude and latitude values that has degrees, minutes and seconds i.e. "45D15'34"N
        * or "45D1534"N. The single-quotes for the minutes is optional. And, for the moment we do not support seconds
        * validation although ilog library returns the longitude/latitude with second when NEs and Sub-networks are
        * dragged and dropped on the map.*/
    private static final Pattern PATTERN = Pattern.compile("([0-9]+)D([0-9]+)'?(?:([0-9]+)\")?([NSEW])");
        public GeoLine(int degree, int minute, Direction dir) {
            this(degree, minute, 0, dir);
        public GeoLine(int degree, int minute, int second, Direction dir) {
            Log.logInfo(getClass().getSimpleName(), "PAU degree: " + degree + " minute: " + minute + " second: " + second + " direction: " +  dir);
            verifyLongitudeLatitude(degree, dir);
            verifyMinute(degree, minute, dir);   
            this.degree = degree;
            this.minute = minute;
            this.second = second;
            if (this.degree == 0 && this.minute == 0 && this.second == 0) {
                this.dir = dir.getCanonicalDirection();
            } else {
                this.dir = dir;
        public Direction getDirection() {
            return dir;
        public int getMinute() {
            return minute;
        public int getDegree() {
            return degree;
        public int getSecond() {
            return second;
        public static GeoLine parseLine(String location) {
            * Matcher class will throw java.lang.NullPointerException if a null location
            *  is passed, null location validation is not needed.
            Matcher m = PATTERN.matcher(location);
            if(m.matches()) {
                int deg;
                int min;
                int second;
                Direction direction;
                deg = Integer.parseInt(m.group(1));
                min = Integer.parseInt(m.group(2));
                if (m.group(3) == null) {
                    second = 0;
                } else {
                    second = Integer.parseInt(m.group(3));
                direction = Direction.valueOf(m.group(4));
                return new GeoLine(deg, min, second, direction);
            } else {
                throw new IllegalArgumentException("Invalid location value. Expected format XXDXX'XX\"[NSEW] " + location);
        private void verifyMinute(int deg, int min, Direction direction) {
            /* This validation is to make sure that minute does not exceed 0 if maximum value for latitude == 90
            * or longitude == 180 is specified */
            int maxDeg = direction.isLatitude() ? 90 : 180;
            if(min < 0 || min > 59) {
               throw new NumberFormatException("Minutes is out of range. Value should be less than 60: " + min);
            if (deg == maxDeg && min > 0) {
                throw new NumberFormatException("Degree value " + deg + "D" + direction + " cannot have minute exceeding 0: " + min);
        private void verifyLongitudeLatitude(int valDeg, Direction valDir) {
               int max = valDir.isLatitude() ? 90 : 180;
               if(valDeg < 0 || valDeg > max) {
                    throw new NumberFormatException("Degree " + valDeg + valDir + " is invalid");
        public final boolean isLongitude() {
            return dir.isLongitude();
        public final boolean isLatitude() {
            return dir.isLatitude();
        @Override
        public final String toString(){
            if(minute < 10){
                return degree + "D0" + minute + dir;
            } else {
                return degree + "D" + minute + dir;
        @Override
        public boolean equals(Object obj) {
            if (obj instanceof GeoLine) {
                GeoLine other = (GeoLine) obj;          
                    return (this.degree == other.degree && this.minute == other.minute && this.second == other.second && this.dir == other.dir);
            return false;
        @Override
        public int hashCode() {
            int result = 17;
            result = result * 37 + degree;
            result = result * 37 + minute;
            result = result * 37 + second;
            result = result * 37 + dir.hashCode();
            return result;
    }Thank you again.

  • How to implement pattern matching in RFC input paramenter?

    Dear Friend.......
    I have a requirment for implement a pattern match for name field of vendor in one of RFC.........
    For ex..........
    Name field:-  A* -> give all list of name  starting with a.
    how can we implement this?
    Any way............Suggest me
    Regards
    Ricky

    Hi,
    I am not using any ABAP program for calling this RFC,I am using Webdynpro for this one.
    so how it possible to implemnet same things at there.
    Regards
    ricky

  • Latin 1 supplement for Pattern matching

    Hi All,
    I am trying to pattern match a string with the following pattern:
    "\\p{InLatin1Supplement}+"(want to allow only characters in Latin 1 Supplement charset)
    However I get java.util.regex.PatternSyntaxException: Unknown character family {Latin1Supplement}Please suggest what should be the proper string for the pattern.
    Thank you !!

    Hm, have your checked Blocks-3.txt, as it says in the javadocs?
    "Unicode blocks and categories are written with the \p and \P constructs as in Perl. \p{prop} matches if the input has the property prop, while \P{prop} does not match if the input has that property. Blocks are specified with the prefix In, as in InMongolian. Categories may be specified with the optional prefix Is: Both \p{L} and \p{IsL} denote the category of Unicode letters. Blocks and categories can be used both inside and outside of a character class.
    The supported blocks and categories are those of The Unicode Standard, Version 3.0. The block names are those defined in Chapter 14 and in the file Blocks-3.txt of the Unicode Character Database except that the spaces are removed; "Basic Latin", for example, becomes "BasicLatin". The category names are those defined in table 4-5 of the Standard (p. 88), both normative and informative."
    Other than that, I don't know, sorry.

  • SQL pattern matching

    Hi experts,
    I have a requirement for which I need to write a SQL. On our orders search screen there are 2 prompts.
    1) Dealer name (Table.column - DLR_NAM)
    2) State name (Table.column - STATE_NAM)
    When user wants to find the orders placed by all dealers whose name starts with 'A' and state name with 'B', then our query is something like this
    SELECT ORDER_ID, ORDER_ITEM, ORDER_QTY, ORDER_VALU
    FROM ORDERS
    WHERE DLR_NAM LIKE 'A%'
    AND STATE_NAM LIKE 'B%'; -- A and B entered by user in the respective prompt text box
    But there are countries like Greece for which states doesn't exists. In that case STATE_NAME is NULL and the above query becomes something like the below and doesn't return right results
    SELECT ORDER_ID, ORDER_ITEM, ORDER_QTY, ORDER_VALU
    FROM ORDERS
    WHERE DLR_NAM LIKE 'A%'
    AND STATE_NAM LIKE '%'; -- Pattern matching goes wrong due to this AND clause.
    Please suggest how to fix this. It appears simple and my brain is not working after non-stop working for several days.

    You are saying that the user types something in both variables.
    And then this query:
    SELECT ORDER_ID, ORDER_ITEM, ORDER_QTY, ORDER_VALU
    FROM ORDERS
    WHERE DLR_NAM LIKE :bind_dealer || '%'
    AND ( (:bind_state IS NULL) OR (:bind_state IS NOT NULL AND STATE_NAM LIKE :bind_state || '%') );returns rows with STATE_NAM null.
    That does not make sense. If the users types in both variables, then the bindvariable :bind_state is not null, and then STATE_NAM has to begin with the value of :bind_state.
    The only thing I can think of is if you are binding wrong? What is your application coded in? C#? Java? ASP? .NET? How do you prepare your SQL query from your user inputs?
    You will have to post a test case. Create table, insert some test data, run the sql and show it returns the wrong result. I cannot think of any problem without knowing more details :-)

  • Pattern Matching functions in DP Macro

    Folks,
    Can anyone tell me if there are any pattern matching functions in DP Macros? Here is the requirement:
    If the time bucket is a quarter, then hide some rows. If the time bucket is  a month or something finer, then show the same row. Assume that all the time buckets in the data view will be the same (no telescoping buckets profile)
    So, suppose that I use BUCKET_DESCRIPTION and get the name of the bucket. If it is Q.* (using pattern matching lingo here), then I would like to set the row attributes accordingly. If it is M.* then set the row attributes to visible.
    Can you please throw some light on this? Would you do it some other way?
    Thanks,
    Satish

    Hi,
    You may try with the macro function BUCKET_DAYS(). This will find number of days in a given bucket.
    Then you can write condition, If bucket days is more than 1 and less than 7, then it is weekly.
    If bucket days is more than 7, then it is monthly.
    Please see if it is helpful for you.
    Regards,
    Manimaran M.

  • Pattern matching and homesite 5.5?

    Hello,
    Is it possible to use pattern matching to change a whole
    series of instances
    similar to the one below?
    <a name="track-records"><h2>Assignment Track
    Records</h2></a>
    to
    <a name="track-records"></a>
    <h2>Assignment Track Records</h2>
    I need to be able to transfer the text between the <h2>
    and </h2> tags
    to the next line...
    Can I use $1, $2 etc?
    Cheers
    Geoff

    <a name="track-records"><h2>Assignment Track
    Records</h2></a>
    becomes
    <a name="track-records"><h2>Assignment Track
    Records</h2></a>
    I assume you want to do this for a number of different h2
    elements?
    i have had success with backreferencing bracketed expressions
    as follows:
    find: <a name="track-records"><h2>(pattern for
    your h2 text)</h2></a>
    replace with:
    <a name="track-records">
    <h2>\1</h2></a>
    the carriage return is manually entered, and \1
    backreferences the result of the pattern matched by first bracketed
    expression. similarly use \2 and \3 for second and third bracketed
    patterns.
    i could not tell you how to match a line break / carriage
    return - the help only tells you how to match everythin but a line
    break or carriage return - something like #chr(10)##chr(13)# but
    don't quote me on that...
    owen

  • Pattern matching help

    Hi!
    I'm new to pattern matching and need a little code to get me started. I currently have it where the user enters a name and it compares that name to a string pulled from a file using String.indexOf(). If it does not match, it pulls the next name string from the file and trys again until it finds a match or reaches the end of the file.
    For example, if I enter "hn smith" it will match to "john smith" in the string pulled from the file.
    This works ok, but it would be a lot nicer if the user could enter in
    jo.n smith or jo* smith
    where it can match parts of the phrase instead of the exact phrase. I have done a slight bit of this in perl, but I am having a harder time in java.
    I would appreciate any help. Thank you!

    that's good when you know it, but when you are
    starting out it is nice to have an example to work
    with, one that is explained well, unlike many of the
    sites I have visited.http://java.sun.com/docs/books/tutorial/extra/regex/index.html
    The very first result from Google is a tutorial that explains regular expressions.

  • The featest pattern match

    Now I met a difficult question.Firstly,we have a criterion table as below:Combination Name     Service     UnitLength     UnitHeight     LoadStatus     Bill No ......(until unbounded fields). Some data like this
    Combination Name |     Service |     UnitLength | UnitHeight | LoadStatus |     Bill No ......
    COM1 | CSC | 40 | 96 |
    COM2 | CSC | 40 | 96 | F |
    COM3 | CSC | 40 | 96 | F | SEA-SCS
    If there is an object has the attribute UnitLength equal 40 and UnitHeight equal 96 the correct combination COM1 is selected;otherwise, if
    it has the attribute UnitLength equal 40  and UnitHeight equal 96 and LoadStatus equal F then the appropriate combination COM2 is selected; then if the object has UnitLength equal 40  and UnitHeight equal 96 and LoadStatus equal F  and many other conditions ,the featest  pattern match will be the completely match combination.But when there is no completely match combination,we may get a combination  closer match the object.For example,an object has the following attributes UnitLength equal 40 and UnitHeight equal 96 and LoadStatus equal F Bill No equal SEA-SCS* ,the best result will be COM3.
    How can we find a pl/sql procedure resolve this question?
    Thanks very much! Look forward to your answer!
    About the combination structure(Combinaton.xsd) as below:
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="true">
         <xs:element name="()" type="CombinationType" xdb:defaultTable="COMBINATION"/>
         <xs:complexType name="CombinationType" xdb:SQLType="Combination_T">
              <xs:sequence>
                   <xs:element name="FilterNam" type="FilterNamType" xdb:SQLName="FilterNam"/>
                   <xs:element name="Priority" type="PriorityType" xdb:SQLName="Priority"/>
                   <xs:element name="FilterType" type="FilterType" minOccurs="0" xdb:SQLName="TYPE"/>
                   <xs:element name="Service" type="ServiceType" xdb:SQLName="Service"/>
                   <xs:element name="Operator" type="OperatorType" xdb:SQLName="Operator"/>
                   <xs:element name="OperTim" type="OperTimType" xdb:SQLName="OperTim"/>
                   <xs:element name="FilterItems" type="FilterItemsType" xdb:SQLName="FilterItems"/>
                   <xs:element name="PlanMatrix" type="PlanMatrixType" xdb:SQLName="PlanMatrix"/>
                   <xs:element name="Discription" type="DiscriptionType" xdb:SQLName="Discription"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="FilterItemsType" xdb:SQLType="FilterItems_T">
              <xs:sequence>
                   <xs:element name="FilterItem" type="FilterItemType" maxOccurs="unbounded" xdb:SQLName="FilterItem" xdb:SQLCollType="FilterItem_V"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="FilterItemType" xdb:SQLType="FilterItem_T">
              <xs:sequence>
                   <xs:element name="Charateristic" type="CharateristicType" xdb:SQLName="Charateristic"/>
                   <xs:element name="Oper" type="OperType" xdb:SQLName="Oper"/>
                   <xs:element name="Value" type="ValueType" xdb:SQLName="Value"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="PlanMatrixType" xdb:SQLType="PlanMatrix_T">
              <xs:sequence>
                   <xs:element name="PlanMatrixElement" type="PlanMatrixElementType" maxOccurs="3" xdb:SQLName="PlanMatrixElement" xdb:SQLCollType="PlanMatrixElement_V"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="PlanMatrixElementType" xdb:SQLType="PlanMatrixElementTypem_T">
              <xs:sequence>
                   <xs:element name="Interval" type="IntervalType" xdb:SQLName="Interval"/>
                   <xs:element name="DaysBfETD" type="DaysBfETDType" xdb:SQLName="DaysBfETD"/>
                   <xs:element name="Resevevation" type="ResevevationType" xdb:SQLName="Resevevation"/>
                   <xs:element name="Algorithm" type="AlgorithmType" xdb:SQLName="Algorithm"/>
                   <xs:element name="HDP" type="HDPType" xdb:SQLName="HDP"/>
              </xs:sequence>
         </xs:complexType>
         <xs:simpleType name="FilterNamType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="1"/>
                   <xs:maxLength value="30"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="OperatorType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="1"/>
                   <xs:maxLength value="10"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="ServiceType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="1"/>
                   <xs:maxLength value="20"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="FilterType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="1"/>
                   <xs:maxLength value="4"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="PriorityType">
              <xs:restriction base="xs:integer"/>
         </xs:simpleType>
         <xs:simpleType name="OperTimType">
              <xs:restriction base="xs:date"/>
         </xs:simpleType>
         <xs:simpleType name="CharateristicType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="1"/>
                   <xs:maxLength value="35"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="OperType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="1"/>
                   <xs:maxLength value="10"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="ValueType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="1"/>
                   <xs:maxLength value="35"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="DiscriptionType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="1"/>
                   <xs:maxLength value="35"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="IntervalType">
              <xs:restriction base="xs:integer"/>
         </xs:simpleType>
         <xs:simpleType name="DaysBfETDType">
              <xs:restriction base="xs:integer"/>
         </xs:simpleType>
         <xs:simpleType name="ResevevationType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="1"/>
                   <xs:maxLength value="35"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="AlgorithmType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="1"/>
                   <xs:maxLength value="35"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="HDPType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="0"/>
                   <xs:maxLength value="35"/>
              </xs:restriction>
         </xs:simpleType>
    </xs:schema>
    And the data(Combination.xml) like that:
    <Combination
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://localhost/xml_test//Combination.xsd">
    <FilterNam>40/8.6/F/BILL</FilterNam>
    <Priority>5</Priority>
    <Service>KR-SHIPPING-LINE</Service>
    <Operator>ZHANGRUI</Operator>
    <OperTim>2010-06-09</OperTim>
    <FilterItems>
    <FilterItem>
    <Charateristic>UnitLegth</Charateristic>
    <Oper>=</Oper>
    <Value>40</Value>
    </FilterItem>
    <FilterItem>
    <Charateristic>UnitHeigh</Charateristic>
    <Oper>=</Oper>
    <Value>8.6</Value>
    </FilterItem>
    <FilterItem>
    <Charateristic>LoadStatus</Charateristic>
    <Oper>=</Oper>
    <Value>F</Value>
    </FilterItem>
    <FilterItem>
    <Charateristic>BillNo</Charateristic>
    <Oper>=</Oper>
    <Value>SEA-BILLING-NO.1</Value>
    </FilterItem>
    </FilterItems>
    <PlanMatrix>
    <PlanMatrixElement>
    <Interval>1</Interval>
    <DaysBfETD>3</DaysBfETD>
    <Resevevation>1 BAY</Resevevation>
    <Algorithm>MIX VESSEL</Algorithm>
    </PlanMatrixElement>
    </PlanMatrix>
    </Combination>
    Edited by: user10904897 on 2010-6-9 下午8:23
    Edited by: user10904897 on 2010-6-9 下午8:57

    my best would be to do something like the following since i don't have oracle and can't simulate it right now:
    select a.*,
           case when unitlength = 40 and unitheight = 96 and loadstatus ='F' and billno = 'SEA-SCS' then 'COM3'
                  when unitlength = 40 and unitheight = 96 and loadstatus ='F' and billno != 'SEA-SCS' then 'COM2'
                  when unitlength = 40 and unitheight = 96 and loadstatus != 'F' then 'COM1'
                  else 'print what ever you want'
           end
    from <table_name>
    where <any_conditions_you_want_if_any>
    ;

  • File events: exclusive pattern match

    Is there a way for a file monitor to do an inverse match ie "all files except those with <pattern> in the name" ?
    For example the file mask could be !<pattern>  like with some of the common unix utilities.
    If not perhaps it might make a useful feature enhancement.
    Cheers

    Upgrade to 1.4.2 and then this will work.
    import java.util.regex.*;
    class Test
         public static void main(String[] args)
              for(int i = 0; i<args.length;i++)
                   System.out.println(args[i]+" "+Pattern.matches("\\d\\d\\d\\-\\d\\d\\d\\d", args));
              System.exit(0);
    Otherwise convert the string to a char[] and test that you have 8 characters, ch[3] is '-' and the rest are between '0' and '9'.
    tokenizing the string on '-' and trying to make integers will allow some invalid phone number to pass. You will have to at least confirm that the numbers aren't negative and have the right number of digits.

  • Retain Pattern Match Attribute for Next Pattern Match Calculation

    When a MATCH_RECOGNIZE PATTERN match occurs, is there any way to retain the underlying event for the next pattern match?
    It's like I want to replay the underlying event (that triggered the match) into the next "batch" of events.

    Here is an approach
    1) Use a (local) cache to hold the "lastMatchedTime"
    2) Augment each input event with the "lastMatchedTime" by first (left outer join) joining with cache
    3) Run the MATCH_RECOGNIZE on the augmented stream
    4) Use a match to update the cache
    Here are the queries that I tried -
      <view id="S">
            <![CDATA[
                 RSTREAM (
                    SELECT
                           id,
                           obs,
                           epoch,
                           nvl(C.lastMatchedTime, 0) as lastMatchedTime
                    FROM
                           InputChannel[now] AS I LEFT OUTER JOIN lastMatchCache AS C
                    ON
                           C.keyValue = "key"      
            ]]>
          </view>
          <view id="v1">
            <![CDATA[                 
                      SELECT
                              T.id,
                              T.obsTotal,
                              T.elapsedTime,
                              T.firstts,
                              T.lastts
                      FROM S MATCH_RECOGNIZE (
                              PARTITION BY id
                              MEASURES
                                        id as id,
                                        sum(obs) as obsTotal,
                                        B.epoch - decode(B.lastMatchedTime, 0L, min(epoch), B.lastMatchedTime) as elapsedTime,
                                        decode(B.lastMatchedTime, 0L, min(epoch), B.lastMatchedTime) as firstts,
                                        B.epoch as lastts
                              PATTERN ( A+? B )
                              DEFINE
                                       B AS (epoch- decode(lastMatchedTime, 0L, min(epoch), lastMatchedTime)) > 20*60*1000
                      ) as T
            ]]>
          </view>
          <query id="qcache">
             <![CDATA[
                 SELECT
                       "key" as keyValue,
                       lastts as lastMatchedTime
                 FROM
                       v1
             ]]> 
          </query>
           <query id="q1">
             <![CDATA[
                 SELECT
                 FROM
                        v1
             ]]> 
          </query>
        Also, include in the config file
    <channel>
           <name>CacheChannel</name>
           <selector>qcache</selector>
       </channel> 
       <channel>
           <name>OutputChannel</name>
           <selector>q1</selector>
       </channel>The EPN that I used was
      <wlevs:event-type-repository>       
            <wlevs:event-type type-name="CacheEvent">
                <wlevs:class>com.bea.wlevs.event.example.helloworld.CacheEvent</wlevs:class>
            </wlevs:event-type>
            <wlevs:event-type type-name="InputEvent">
               <wlevs:properties>
                  <wlevs:property name="id" type="int"/>
                  <wlevs:property name="obs" type="int"/>
                  <wlevs:property name="epoch" type="bigint"/>
               </wlevs:properties>
            </wlevs:event-type>
            <wlevs:event-type type-name="OutputEvent">
               <wlevs:properties>
                  <wlevs:property name="id" type="int"/>
                  <wlevs:property name="obsTotal" type="int"/>
                  <wlevs:property name="elapsedTime" type="bigint"/>
                  <wlevs:property name="firstts" type="bigint"/>
                  <wlevs:property name="lastts" type="bigint"/>
               </wlevs:properties>
            </wlevs:event-type>
        </wlevs:event-type-repository>
        <wlevs:adapter id="InputAdapter" provider="csvgen">
             <wlevs:instance-property name="port" value="9061" />
             <wlevs:instance-property name="eventTypeName" value="InputEvent" />
             <wlevs:instance-property name="eventPropertyNames" value="id,obs,epoch" />
        </wlevs:adapter>     
        <wlevs:channel id="InputChannel" event-type="InputEvent" >
            <wlevs:listener ref="helloworldProcessor"/>
            <wlevs:source ref="InputAdapter"/>
        </wlevs:channel>
        <wlevs:caching-system id="local-caching"/>
        <wlevs:cache id="lastMatchCache" name="lastMatchCache" key-properties="keyValue" value-type="CacheEvent">
           <wlevs:caching-system ref="local-caching"/>
        </wlevs:cache>
        <!-- The default processor for OCEP 11.0.0.0 is CQL -->
        <wlevs:processor id="helloworldProcessor">
           <wlevs:listener ref="CacheChannel"/>
           <wlevs:cache-source ref="lastMatchCache" />      
        </wlevs:processor>
        <wlevs:channel id="CacheChannel" event-type="CacheEvent">
           <wlevs:listener ref="lastMatchCache"/>
        </wlevs:channel>
        <wlevs:channel id="OutputChannel" event-type="OutputEvent" advertise="true">
            <wlevs:listener>
                <bean class="com.bea.wlevs.example.helloworld.HelloWorldBean"/>
            </wlevs:listener>
            <wlevs:source ref="helloworldProcessor"/>
        </wlevs:channel>And the output that I get seems to match your requirement -
    eventType=OutputEvent object=q1  v1.id=4143, v1.obsTotal=9, v1.elapsedTime=7228000, v1.firstts=1199311210000, v1.lastts=1199318438000
    eventType=OutputEvent object=q1  v1.id=4143, v1.obsTotal=17, v1.elapsedTime=30935000, v1.firstts=1199318438000, v1.lastts=1199349373000
    eventType=OutputEvent object=q1  v1.id=4143, v1.obsTotal=7, v1.elapsedTime=41436000, v1.firstts=1199349373000, v1.lastts=1199390809000
    eventType=OutputEvent object=q1  v1.id=4143, v1.obsTotal=13, v1.elapsedTime=5904000, v1.firstts=1199390809000, v1.lastts=1199396713000Edited by: Anand Srinivasan on Sep 30, 2010 12:49 AM
    Edited by: Anand Srinivasan on Sep 30, 2010 12:50 AM

  • Pattern match problem

    I have developed one application to explore pattern match.I have used CQL:
    SELECT mkt_evt.price FROM MktEvntInchannel MATCH_RECOGNIZE (MEASURES MktEvntInchannel.price AS price PATTERN( A B*?C) DEFINE A AS MktEvntInchannel.symbol="abcd", B AS MktEvntInchannel.symbol="pqr", C AS MktEvntInchannel.symbol="wet") AS mkt_evt
    But it is not showing any output.
    MarketEvent code:
    package com.bea.wlevs.example.algotrading.event;
    import javax.xml.bind.annotation.XmlRootElement;
    @XmlRootElement(name = "MarketEvent")
    public class MarketEvent {
         private Long eventTimeStamp;
         private String symbol;
         private Double price;
         private Long volume;
         private Long latencyTimestamp;
         private String text;
         * @return the latencyTimestamp
         public Long getLatencyTimestamp() {
              return latencyTimestamp;
         * @param latencyTimestamp the latencyTimestamp to set
         public void setLatencyTimestamp(Long latencyTimestamp) {
              this.latencyTimestamp = latencyTimestamp;
         * @return the timestamp
         public Long geteventTimeStamp() {
              return eventTimeStamp;
         * @param timestamp the timestamp to set
         public void seteventTimeStamp(Long eventTimeStamp) {
              this.eventTimeStamp = eventTimeStamp;
         * @return the symbol
         public String getSymbol() {
              return symbol;
         * @param symbol the symbol to set
         public void setSymbol(String symbol) {
              this.symbol = symbol;
         * @return the price
         public Double getPrice() {
              return price;
         * @param price the price to set
         public void setPrice(Double price) {
              this.price = price;
         * @return the volume
         public Long getVolume() {
              return volume;
         * @param volume the volume to set
         public void setVolume(Long volume) {
              this.volume = volume;
         public void setString_1(String text) {
              this.text = text;
              // TODO Auto-generated method stub
         public String getString_1() {
              // TODO Auto-generated method stub
              return text;
    }

    I have pushed these below data in jms queue from where my CEP application is reading.
    <?xml version="1.0" encoding="UTF-8"?>
         <MarketEvent>
         <eventTimeStamp>201100501</eventTimeStamp>
         <symbol>abcd</symbol>
         <price>3005.02</price>
         <volume>4657892</volume>
         <latencyTimestamp>201100501</latencyTimestamp>
         </MarketEvent>
    <?xml version="1.0" encoding="UTF-8"?>
         <MarketEvent>
         <eventTimeStamp>201100501</eventTimeStamp>
         <symbol>pqr</symbol>
         <price>3005.02</price>
         <volume>4657892</volume>
         <latencyTimestamp>201100501</latencyTimestamp>
         </MarketEvent>
    <?xml version="1.0" encoding="UTF-8"?>
         <MarketEvent>
         <eventTimeStamp>201100501</eventTimeStamp>
         <symbol>wet</symbol>
         <price>3005.02</price>
         <volume>4657892</volume>
         <latencyTimestamp>201100501</latencyTimestamp>
         </MarketEvent>
    I have also wrote one converter bean:
    package com.customer;
    import com.bea.wlevs.adapters.jms.api.InboundMessageConverter;
    import com.bea.wlevs.adapters.jms.api.MessageConverterException;
    import com.bea.wlevs.adapters.jms.api.OutboundMessageConverter;
    import com.bea.wlevs.example.algotrading.event.MarketEvent;
    import javax.jms.JMSException;
    import javax.jms.Message;
    import javax.jms.Session;
    import javax.jms.TextMessage;
    import java.util.ArrayList;
    import java.util.List;
    public class MessageConverter implements InboundMessageConverter, OutboundMessageConverter {
    public List<MarketEvent> convert(Message message) throws MessageConverterException, JMSException {
    MarketEvent event = new MarketEvent();
    TextMessage textMessage = (TextMessage) message;
    event.setString_1(textMessage.getText());
    List<MarketEvent> events = new ArrayList<MarketEvent>(1);
    events.add(event);
    return events;
    public List<Message> convert(Session session, Object inputEvent) throws MessageConverterException, JMSException {
         MarketEvent event = (MarketEvent) inputEvent;
    TextMessage message = session.createTextMessage("Text message: " + event.getString_1());
    List<Message> messages = new ArrayList<Message>();
    messages.add(message);
    return messages;
    this is converting xml messages to event.
    Edited by: 856272 on Jul 1, 2011 6:09 AM

  • Pattern Match in a predicate ?

    Is it possible to pattern match in a predicate? I am modifying opensnoop as the "-f filename" option will only ever match the exact string. So if you do "-f /var/tmp/moo.txt" it will not match/fire when someone is IN /var/tmp and does a "cat moo.txt" The filename/pathnames do not match
    syscall::open:return
    /self->ok && PATHNAME == copyinstr(self->pathp)/
    etc etc etc
    What can you do in the PATHNAME command to pattern match all instances of "moo.txt". So that even if you are in /etc and do a "cat ../var/tmp/moo.txt" would be picked up?
    Thanks.

    There's no (straightforward) means of pattern-matching in a predicate. However, you do have subroutines in DTrace that can further your cause. If the name of your file is a sufficient match, i.e., you're not worried about matching against a same-name file in another likely directory:
    string basename(char *str)
    Or, you can use
    string cleanpath(char *str)
    if collapsing a directory with redundant elements is sufficient.
    Whatever you can do with those operations, logically ANDed together, is what you can do.

Maybe you are looking for

  • How do I manually register FCS3?

    Hi Folks, I've just installed FCS3, a brand new (unopened) copy I just purchased from an online retailer. When I installed and opened the program, it tried to register. When I filled out the form and clicked the "Register" button, a brief error messa

  • Cant install spore from USB backup disk on new IMACS that have no DVD drive.

    I am trying to test Spore on my father's new Imac but it will not let me install. I copied the whole DVD content on a portable USB drive and I can install it fine from there via my own MAC but from my father's new IMAC 2012 that has no DVD drive I am

  • ENTER keystroke on text input entry not always submitting

    I have run into a problem where once a user has completed the text input entry and has clicked the ENTER button to "submit" this entry, the ENTER keystroke event is not always "submitting" the input entry. Sometimes it requires hitting the ENTER key

  • Where can I get my audio driver?

    The model number is  610-1068cn,made in China,and the pre-installed system is win7  64-bit  ,  I've changed it to 32-bit.  Where can I find the audio driver ?  The type of the sound card is IDT 92HD89D3 , anyone who knows ,please mail to me, thank yo

  • Mac os x 10.4.11 tiger

    Ive just bought this mac in germany, brand new but software was already installed so everything was in German, when i got back i configered the computer settings, region, time and date to all US which is the settings i want but still there are some G