Patterns/regex: determine an intersection of patterns/regex

Hi.
Does anyone know how to determine the pattern/regex that reflects the intersection of 2 or more patterns?
F.ex.:
intersection of [0-9]+[a-z]+ with [1-2]*[a-c]* would be [1-2]+[a-c]+ right?
Any ideea?
Many thanks.

Wow! That was quick.
I also think that it's not so easy to do. But the hope never dies ... I thought someone already got this problem and knows the solution...
Anyway, thanks for your response.
P.S. the example was just an example to explain what i mean. I had no doubts that's right.

Similar Messages

  • Determine the Intersection points of 2 splines

    I have 2 sets of x,y points, from which I have created 2 splines. These lines intersect each other at a number of points. How can I determine these intersection points? As there are over 200 pairs of lines, each whose intersection points have to be calculated, I require a solution that executes very quickly.
    Thanks,
    Shaps

    You'll have to take a look at Solving Polynomial Equations.
    If you're not mathematically inclined, you might want to find help on this one. Otherwise, I'd start with Mathworld. It's a great site for Maths and Physics questions.
    The higher the order of your polynomial, the harder it is to solve.
    You should consider a more brute-force approach if you don't need high precision. It depends on your application, but here I cannot offer advice.
    Let's say you take the following approximations for your curves: (3rd order curves, very small chance of being perfect fit...)
    1) ax^3+bx^2+cx+d = 0
    2) a'x^3+b'x^2+c'x+d' = 0
    The curves cross each other for each x that satisfy this equation: 
    (a-a')x^3+(b-b')x^2+(c-c')x+(d-d') = 0
    Now, the analytical solution to this can be taken from Wolfram Mathworld website and is not too complicated, but to solve for a 7th order curve... good luck!
    All solutions will not necessarily fall within your data range, but if you want an approximative order for your equation, count the number of times each curve cross... and add a few orders!
    As I said, it might need a brute-force approach. Good Luck.

  • Polygon2D.Float

    I created this Polygon class. I've already tested it and it works just like java.awt.Polygon. This class
    supports floating point coordinates. It does not extend Polygon in java.awt. Enjoy
    import java.awt.*;
    import java.awt.geom.*;
    * This is a polygon that supports floating point values.  It does <b> not </b> extend java.awt.Polygon.  A polygon is comprised
    * of an array of x values and an array of it's corrisponding y values.  There is also an integer value - npoints - that determine
    * the number of points you want to be valid.  The polygon starts at xpoints[0] and ypoints[0] (if it exists) and connects a line
    * to xpoints[1] and ypoints[1] and then to xpoints[2] and ypoints[2] and so on until the index equals npoints.  The path is then
    * closed back to xpoints[0] and ypoints[0].  Lets see an example:
    * <p>
    * Polygon2D.Float p = new Polygon2D.Float( new float[] {20,20,40,40}, new float[] {20,40,40,20}, npoints);  //constructs a new new rectangle that is a polygon <br>
    * graphics.fill(p);  // fills a rectangle <br>
    * p.npoints = 3;  // the polygon now ignores the fourth coordinate <br>
    * graphics.fill(p);  // fills a triangle <br>
    * p.npoints = 2; // the polygon now ignores the last two coordinates <br>
    * graphic.fill(p); // does nothing - cannot fill a line (does update the polygon) <br>
    * graphic.draw(p); // draws a line; <br>
    * p.npoints = 5; //not allowed, but no error yet. <br>
    * try{graphic.draw(p)}catch(Exception e) {}// error - IndexOutOfBoundsException <br>
    * p.npoints = 4; <br>
    * p.xpoints[0] = 10; p.ypoints[0] = 10;  // makes it a weard looking rectangle; <br>
    * Rectangle bounds = p.getBounds(); //the bounds is <b> incorrect </b>.  It is the bounds of when p.npoints was set to 2. <br>
    * boolean contains = p.contains(30, 30); //will return false.  Should return true.  The shape is still set to when the p.npoins = 2 <br>
    * p.invalidate(); //updates the the polygon <br>
    * Rectangle bounds = p.getBounds(); //returns the correct bounds <br>
    * boolean contains = p.contains(30, 30); //returns true <br>
    * <p>
    * If the polygon dosen't draw right make sure that your coordinates and npoints are right.  The polygon does not update itself
    * by virtue of changing its coordinates directly or using the translate(float deltaX, float deltaY) method.  The polygon <b> is </b>
    * updated just before every draw (when the getPathIterator(AffineTransform at) method is called).  This has several implications.
    * All the contains, intersects, and getBounds methods go off the state the polygon was after its <b> last </b> update.  So if any of
    * these methods are called after you have manipulated the polygon and before you have redrawn it, then these specific methods return innacurate
    * results, becuase the polygon has not been updated yet.  If such a case occurs, call the invalidate() method to update the polygon forcibly.
    * The documentation for the methods of Polygon2D are coppied straight out of java.awt.Shape.
    * @author Christopher Colon
    * @version 1.0
    public abstract class Polygon2D implements Shape
        protected GeneralPath path;
        public Polygon2D()
           path = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
        /**Call this method after you are done with direct manipulation of the x and y points (including translate) and if you plan
         * to use any of the contains, intersects, or get bounds methods right after the
         * manipulation.  In effect this method 'updates' the polygon to its position and shape.  The polygon is always updated
         * just before drawing, so if you use any of the contains, intersects, or get bounds method
         * right after drawing and before manipulation, then these methods return accurate results.
         * Its in the period between manipulation and drawing that this method should be called if you
         * plan to use the other methods (excluding translate) before drawing.  */
        public abstract void invalidate();
        /**Tests if the specified coordinates are inside the boundary of the Shape.
         * @param x - the specified x coordinate
         * @param y - the specified y coordinate
         * @return true if the specified coordinates are inside the Shape boundary; false otherwise.*/
        public boolean contains(double x, double y)
            {return path.contains(x, y);}
        /**Tests if the interior of the Shape entirely contains the specified rectangular area. All coordinates that lie inside the rectangular area must lie within the Shape for the entire rectanglar area to be considered contained within the Shape.
         * This method might conservatively return false when: <br>
         * <p>
         * the intersect method returns true and <br>
         * the calculations to determine whether or not the Shape entirely contains the rectangular area are prohibitively expensive. <br>
         * <p>
         * This means that this method might return false even though the Shape contains the rectangular area.
         * The Area class can be used to perform more accurate computations of geometric intersection for any Shape
         * object if a more precise answer is required.
         * @param x - the x coordinate of the specified rectangular area
         * @param y - the y coordinate of the specified rectangular area
         * @param w - the width of the specified rectangular area
         * @param h - the height of the specified rectangular area
         * @return true if the interior of the Shape entirely contains the specified rectangular area; false otherwise or, if the Shape
         *          contains the rectangular area and the intersects method returns true and the containment calculations would be too
         *          expensive to perform.*/
        public boolean contains(double x, double y, double w, double h)
            {return path.contains(x,y,w,h);}
        /**Tests if a specified Point2D is inside the boundary of the Shape.
         * @param p - a specified Point2D
         * @return true if the specified Point2D is inside the boundary of the Shape; false otherwise.*/   
        public boolean contains(Point2D p)
            {return path.contains(p);}
        /**Tests if the interior of the Shape entirely contains the specified rectangular area. All coordinates that lie inside the rectangular area must lie within the Shape for the entire rectanglar area to be considered contained within the Shape.
         * This method might conservatively return false when: <br>
         * <p>
         * the intersect method returns true and <br>
         * the calculations to determine whether or not the Shape entirely contains the rectangular area are prohibitively expensive. <br>
         * <p>
         * This means that this method might return false even though the Shape contains the rectangular area.
         * The Area class can be used to perform more accurate computations of geometric intersection for any Shape
         * object if a more precise answer is required.
         * @param r - The specified Rectangle2D
         * @return true if the interior of the Shape entirely contains the specified rectangular area; false otherwise or, if the Shape
         *          contains the rectangular area and the intersects method returns true and the containment calculations would be too
         *          expensive to perform.*/
        public boolean contains(Rectangle2D r)
            {return path.contains(r);}
        /**Returns an integer Rectangle that completely encloses the Shape. Note that there is no guarantee that the returned Rectangle is
         * the smallest bounding box that encloses the Shape, only that the Shape lies entirely within the indicated Rectangle.
         * The returned Rectangle might also fail to completely enclose the Shape if the Shape overflows the limited range of the integer
         * data type. The getBounds2D method generally returns a tighter bounding box due to its greater flexibility in representation.
         * @return an integer Rectangle that completely encloses the Shape.*/
        public Rectangle getBounds()
            {return path.getBounds();}
        /**Returns a high precision and more accurate bounding box of the Shape than the getBounds method. Note that there is no
         * guarantee that the returned Rectangle2D is the smallest bounding box that encloses the Shape, only that the Shape lies
         * entirely within the indicated Rectangle2D. The bounding box returned by this method is usually tighter than that returned by
         * the getBounds method and never fails due to overflow problems since the return value can be an instance of the Rectangle2D that
         * uses double precision values to store the dimensions.
         * @return an instance of Rectangle2D that is a high-precision bounding box of the Shape.*/
        public Rectangle2D getBounds2D()
            {return path.getBounds2D();}
        /**Returns an iterator object that iterates along the Shape boundary and provides access to the geometry of the Shape outline.
         * If an optional AffineTransform is specified, the coordinates returned in the iteration are transformed accordingly.
         * Each call to this method returns a fresh PathIterator object that traverses the geometry of the Shape object independently
         * from any other PathIterator objects in use at the same time.
         * It is recommended, but not guaranteed, that objects implementing the Shape interface
         * isolate iterations that are in process from any changes that might occur to the original object's geometry during such iterations.
         * Before using a particular implementation of the Shape interface in more than one thread simultaneously, refer
         * to its documentation to verify that it guarantees that iterations are isolated from modifications.
         * @param at - an optional AffineTransform to be applied to the coordinates as they are returned in the iteration,
         *              or null if untransformed coordinates are desired
         * @return a new PathIterator object, which independently traverses the geometry of the Shape.*/  
        public abstract PathIterator getPathIterator(AffineTransform at);
         /**Returns an iterator object that iterates along the Shape boundary and provides access to a flattened view of the Shape
          * outline geometry. Only SEG_MOVETO, SEG_LINETO, and SEG_CLOSE point types are returned by the iterator.
          * If an optional AffineTransform is specified, the coordinates returned in the iteration are transformed accordingly.
          * The amount of subdivision of the curved segments is controlled by the flatness parameter, which specifies the maximum
          * distance that any point on the unflattened transformed curve can deviate from the returned flattened path segments.
          * Note that a limit on the accuracy of the flattened path might be silently imposed, causing very small flattening parameters
          * to be treated as larger values. This limit, if there is one, is defined by the particular implementation that is used.
          * Each call to this method returns a fresh PathIterator object that traverses the Shape object geometry independently
          * from any other PathIterator objects in use at the same time. It is recommended, but not guaranteed, that objects implementing
          * the Shape interface isolate iterations that are in process from any changes that might occur to the original object's geometry
          * during such iterations. Before using a particular implementation of this interface in more than one thread simultaneously,
          * refer to its documentation to verify that it guarantees that iterations are isolated from modifications.
          * @param at - an optional AffineTransform to be applied to the coordinates as they are returned in the iteration, or
          *              null if untransformed coordinates are desired
          * @param flatness - the maximum distance that the line segments used to approximate the curved segments are
          *                      allowed to deviate from any point on the original curve
          * @return a new PathIterator that independently traverses the Shape geometry.*/
        public abstract PathIterator getPathIterator(AffineTransform at, double flatness);
        /** Tests if the interior of the Shape intersects the interior of a specified rectangular area. The rectangular area is
         * considered to intersect the Shape if any point is contained in both the interior of the Shape and the specified rectangular area.
         * This method might conservatively return true when: <br>
         * there is a high probability that the rectangular area and the Shape intersect, but  <br>
         * the calculations to accurately determine this intersection are prohibitively expensive. <br>
         * This means that this method might return true even though the rectangular area does not intersect the Shape. <br>
         * The Area class can be used to perform more accurate computations of geometric intersection for any Shape object if a more
         * precise answer is required.
         * @param x - the x coordinate of the specified rectangular area
         * @param y - the y coordinate of the specified rectangular area
         * @param w - the width of the specified rectangular area
         * @param h - the height of the specified rectangular area
         * @return true if the interior of the Shape and the interior of the rectangular area intersect, or are
         *         both highly likely to intersect and intersection calculations would be too expensive to perform; false otherwise.*/
        public boolean intersects(double x, double y, double w, double h)
            {return path.intersects(x, y, w, h);}
        /**Tests if the interior of the Shape intersects the interior of a specified Rectangle2D.
         * This method might conservatively return true when: <br>
         * there is a high probability that the Rectangle2D and the Shape intersect, but <br>
         * the calculations to accurately determine this intersection are prohibitively expensive. <br>
         * This means that this method might return true even though the Rectangle2D does not intersect the Shape.
         * @param r - the specified Rectangle2D
         * @return true if the interior of the Shape and the interior of the specified Rectangle2D intersect, or are both
         *         highly likely to intersect and intersection calculations would be too expensive to perform; false otherwise.*/
        public boolean intersects(Rectangle2D r)
            {return path.intersects(r);}
        public static class Float extends Polygon2D implements Cloneable
            public float xpoints[];
            public float ypoints[];
            public int npoints;
            /**Creates a new empty polygon. The array of xpoints and ypoints is set to a size of 4.  So long as npoints remain 0
             * then everthing is fine.  The addPoint(float x, float y) appends the coordinates to xpoints[npoints+1] and ypoints[npoints+1]
             * and then increments npoints.*/
            public Float()
                xpoints = new float[4];
                ypoints = new float[4];
                npoints = 0;
            /**Creates a new empty polygon. The array of xpoints and ypoints is set to a size of the expectedCapacity.  So long as npoints remain 0
             * then everthing is fine.  The addPoint(float x, float y) appends the coordinates to xpoints[npoints+1] and ypoints[npoints+1]
             * and then increments npoints.
             * @throws NegativeArraySizeException If expectedCapacity < 0*/
            public Float(int expectedCapacity)
                if(expectedCapacity < 0) throw new NegativeArraySizeException("negative array size");
                xpoints = new float[expectedCapacity];
                ypoints = new float[expectedCapacity];
                npoints = 0;
            /**Creates a new polygon that represent the given specifications.*/
            public Float(float[] x, float[] y, int npoints)
                if(npoints < 0) throw new NegativeArraySizeException("negative amount of sides (npoints < 0)");
                if(npoints > x.length || npoints > y.length) throw new IndexOutOfBoundsException("more sides than points");
                if(x == null || y == null) throw new NullPointerException("null array of points");
                this.xpoints = x;
                this.ypoints = y;
                this.npoints = npoints;
                constructPath();
            /**Creates a new polygon that represent the given specifications.  The integers are coppied over as float values.*/
            public Float(int[] x, int[] y, int npoints)
                if(npoints < 0) throw new NegativeArraySizeException("negative amount of sides (npoints < 0)");
                if(npoints > x.length || npoints > y.length) throw new IndexOutOfBoundsException("more sides than points");
                if(x == null || y == null) throw new NullPointerException("null array of points");
                xpoints = new float[x.length];
                for(int index = 0; index < x.length; index++) xpoints[index] = x[index];
                ypoints = new float[y.length];
                for(int index = 0; index < y.length; index++) ypoints[index] = y[index];
                this.npoints = npoints;
                constructPath();           
           /*Updates the polygon.*/    
           private synchronized void constructPath()
                if(npoints < 0) throw new NegativeArraySizeException("negative amound of sides (nPoints < 0)");
                path.reset();
                if(xpoints.length == 0 || ypoints.length == 0) return;
                path.moveTo(xpoints[0], ypoints[0]);
                for(int index = 0; index < npoints; index++)
                    path.lineTo(xpoints[index],ypoints[index]);
                path.closePath();
            /**The addPoint(float x, float y) appends the coordinates to xpoints[npoints+1] and ypoints[npoints+1]
             * and then increments npoints.*/
            public synchronized void addPoint(float x, float y)
                if(xpoints.length == npoints)
                    float[] temp = new float[xpoints.length+1];
                    for(int index = 0; index < xpoints.length; index++) temp[index] = xpoints[index];
                    xpoints = temp;
                if(ypoints.length == npoints)
                    float[] temp = new float[ypoints.length+1];
                    for(int index = 0; index < ypoints.length; index++) temp[index] = ypoints[index];
                    ypoints = temp;
                xpoints[npoints+1] = x;
                ypoints[npoints+1] = y;
                npoints++;
            /**Rotate the polygon by the specified amount of degrees around the specified pivot point. It is entirly possible
             * that the polygon could shrink a little or grow a little, after repeated calls to this method.  This is due to
             * rounding errors (double to float).  If the polygon shrinks a little, it will expand a little the next time and vise versa. 
             * The net result is that the polygon is always within 5 (just an estimate) pixels of the intended polygon rotation. So
             * the polygon will never expand too much or shrink too much.  In general the greatest shrinkage or expansion occurs
             * when the polygon is rotated about its center.*/
            public void rotate(double deltaTheta, double pivotX, double pivotY)
                while(deltaTheta >= 360) deltaTheta -= 360;
                while(deltaTheta < 0) deltaTheta += 360;
                for(int index = 0; index < npoints; index++)
                    if(xpoints[index] == pivotX && ypoints[index] == pivotY) continue;
                    double distance = Point.distance(xpoints[index], ypoints[index], pivotX, pivotY);
                    double angle = Math.atan( -(ypoints[index] - pivotY) / (xpoints[index] - pivotX) );
                    if((xpoints[index] - pivotX) < 0) angle += Math.PI;
                    angle += Math.toRadians(deltaTheta);
                    xpoints[index] = (float) (Math.cos(angle) * distance + pivotX);
                    ypoints[index] = (float) (-Math.sin(angle) * distance + pivotY);
            /**Rotate the polygon about its center by the specified amount of degrees.  This is the equivalent of calling
             * rotate(deltaTheta, (float) getXMid(), (float) getYMid()).*/
            public void rotate(double deltaTheta)
                rotate(deltaTheta, getXMid(), getYMid());
            /**Resize the polygon by the specified factor.  A factor of 1 will not change the polygon.
             * A factor greater than 1 will make the polygon grow.  A factor between 0 and 1 will make the polygon shrink.
             * The polygon shrinks towards its center or grows away from its center.
             * @throws IllegalArgumentException if the factor is less than 0.*/
            public void resize(double factor)
                if(factor < 0) throw new IllegalArgumentException("illegal factor");
                if(factor == 1) return;
                double xMid = getXMid();
                double yMid = getYMid();
                for(int index = 0; index < npoints; index++)
                    xpoints[index] = (float) (((xpoints[index] - xMid) * factor) + xMid);
                    ypoints[index] = (float) (((ypoints[index] - yMid) * factor) + yMid);
            /**Returns the x coordinate of the mid point (center) of this polygon.*/
            public double getXMid()
                double sum = 0;
                for(int index = 0; index < npoints; index++) sum += xpoints[index];
                return sum / npoints;
            /**Returns the y coordinate of the mid point (center) of this polygon.*/
            public double getYMid()
                double sum = 0;
                for(int index = 0; index < npoints; index++) sum += ypoints[index];
                return sum / npoints;
            /**Resets this polygon to an empty polygon.*/
            public synchronized void reset()
                xpoints = new float[xpoints.length];
                ypoints = new float[ypoints.length];
                npoints = 0;
             /**Translates the polygon by the specified x and y amounts.  The polygon is not updated
              * after the transformation.*/
            public void translate(float deltaX, float deltaY)
                for(int index = 0; index < xpoints.length; index++) xpoints[index] += deltaX;
                for(int index = 0; index < ypoints.length; index++) ypoints[index] += deltaY;
            public void invalidate()
                 {constructPath();}
            public PathIterator getPathIterator(AffineTransform at)
            {   constructPath();
                return path.getPathIterator(at);}
            public PathIterator getPathIterator(AffineTransform at, double flatness)
            {   constructPath();
                return path.getPathIterator(at, flatness);}
            /**Returns a polygon with the same shape and points.*/
            public Object clone()
                return new Polygon2D.Float(xpoints, ypoints, npoints);
    }

    I assume the reason you posted your code is because you want feedback. The GeneralPath class does not allow the points to be changed (or even looked at) once an operation has been performed. If that is the problem you were facing, then I probably would recommend using the GeneralPath class as a guideline to implement your new class on. I don't see the need to wrap the "Float" class inside the Polygon2D class. The fact that Polygon2D.Float is a container of points is not very clear by the name. Lastly, it looks like everytime you add a point, you will have to call invalidate() to update the internal storage. That is somewhat inefficient, and probably more confusing than anything. For your clone method, I would recommend doing a deep copy.

  • Basic question - Problems with basic query - Mask = INSIDE

    Greetings,
    I'm doing a basic query on Oracle 10g Spatial, is to determine the intersection between two layers (one point called "Calidad1") and other polygons, called "Parishes")
    For issuing the following query based on the documentation of oracle:
    "select C1.ID, C1.SECUENCIA,
    P. COD_ENTIDAD, P. STATE
    Cod_county P., P. TOWNSHIP,
    P. COD_PARROQUIA, P. PARISH
    from CALIDAD1 c1,
    PARISHES p
    where sdo_relate (c1.geoloc, p.geoloc, 'mask = INSIDE querytype = WINDOW') = 'TRUE'
    order by C1.ID;
    When I run the query, no errors but extends too long (more than 10 minutes) and no end, I have to cancel.
    Canceling shows me the following error:
    "ORA-13268: error obtaining dimension from USER_SDO_GEOM_METADATA
    ORA-06512: at "MDSYS.MD", line 1723
    ORA-06512: at "MDSYS.MDERR", line 8
    ORA-06512: at "MDSYS.SDO_3GL", line 89 "
    This query is very basic and the data volume is small, a conclusion: I must be skipping a step or activity.
    Can you guide a little to resolve this situation and get the query that I need?
    Thanks to all

    First, try this query with the ordered hint and also note the change in the FROM clause.
    select /*+ ordered */ C1.ID, C1.SECUENCIA,
    P. COD_ENTIDAD, P. STATE
    Cod_county P., P. TOWNSHIP,
    P. COD_PARROQUIA, P. PARISH
    from PARISHES p,
    CALIDAD1 c1,
    where sdo_relate (c1.geoloc, p.geoloc, 'mask = INSIDE querytype = WINDOW') = 'TRUE'
    order by C1.ID;
    See if this is using the index as expected. If not try this:
    select /*+ ordered index(p name_of_the_spatial_index_on_the_PARISH_Table) */
    C1.ID, C1.SECUENCIA,
    P. COD_ENTIDAD, P. STATE
    Cod_county P., P. TOWNSHIP,
    P. COD_PARROQUIA, P. PARISH
    from PARISHES p,
    CALIDAD1 c1,
    where sdo_relate (c1.geoloc, p.geoloc, 'mask = INSIDE querytype = WINDOW') = 'TRUE'
    order by C1.ID;
    siva

  • MapViewer error -05523

    I have added a JDBC theme to my map with the following query:
    var baseQuery="select /*+ index(a, LIST_CENTRELINE_I) */ innera.name1, innera.name2, geom " +
    "FROM (SELECT a.PRI_NAME as name1, b.PRI_NAME as name2, sdo_geom.sdo_intersection( a.shape, b.shape, 0.1) geom " +
    "FROM list_centreline a, list_centreline b " +
    "where UPPER(a.pri_name) like UPPER(TRIM(REPLACE('"+ street1+"','%','')) ||' %') " +
    "and UPPER(b.pri_name) like UPPER(TRIM(REPLACE('"+ street2+"','%','')) ||' %') " +
    "and SDO_FILTER(a.shape, b.shape, 'mask=ANYINTERACT querytype = WINDOW') = 'TRUE' " +
    "and a.retired_on is null) innera" ;
    I am getting the values for street1 & street2 from prompt dialogs. This query determines the intersection of two streets.
    When I try to run this in my map I get the mapviewer error-05223 there is some other info as well:
    Root cause:FOIServlet:ORA-13226: interface not supported without a spatial index
    Does anyone know how to overcome this problem?
    Here is the Theme definition:
    var theme = '<themes><theme name="JDBC_THEME_INTERS" >' +
    '<jdbc_query ' +
    'datasource="wms" '+
    'jdbc_srid="28355" ' +
    'spatial_column="geom" '+
    'render_style="'+markerStyle+'">' + baseQuery +
    '</jdbc_query></theme></themes>' ;

    Try defining your dynamic theme to not have the spatial filter appended to the query. Use the parameter "asis" equal to true.
    var theme = '<themes><theme name="JDBC_THEME_INTERS" >' +
    '<jdbc_query ' +
    'datasource="wms" '+
    'jdbc_srid="28355" ' +
    'spatial_column="geom" '+
    'asis="true" ' +
    'render_style="">' + baseQuery +
    '</jdbc_query></theme></themes>' ;
    Joao

  • I need another color where two objects meet

    Hello
    Sorry, bad subject, but I cant do it better.
    So, I have two objects. One circle and one rectangle.
    The circle is on top of the rectangle. Just in one corner, so its not covering all of the rectangle.
    I would like to have another color where these two objects meet.
    Which is the easiest way to do this ?
    Thanks / E.......

    Perhaps you should consider makign 3 shapes... One for the circle, one for the rectangle, and one for the intersection. Determining the intersection might be fun, but is not an impossible task, especially if you can represent your shapes as equations (which for circles and rectangles is easy) Good luck to you.

  • Need to Improve Performance on a Spatial Boundary Crossing Calculator

    I am attempting to compare a series of geometries to calculate a number of statistics where they overlap. Essentially I have a table of 50,000 lines and another table of 1000 circles. I need to determine which lines overlap each circle, and for each intersection, I need to determine how much time and distance each line spends in each circle.
    I have a PL/SQL program that performs this operation now and it works. The problem is that it takes far too long.
    Here is a summary of how the job runs:
    1) For each LINE, determine which CIRCLES it overlaps with
    2) Each each LINE/CIRCLE pair, determine the intersection points
    3) Insert the intersection points in a temporary table
    4) Once you have all the points, pair them up as Entry/Exit points for each circle
    5) Calculate duration (time) and distance between entry and exit points
    6) Return to step 1 for next LINE
    There are multiple loops here:
    1-6 is the outer loop performed once for each of the 50,000 lines.
    2-3 is performed once for each line/circle pair (probable avg of 5 circles per line)
    4-5 is performed once again for each line/circle pair
    Even if the process only takes a couple of seconds per LINE, we are still taking more than 24 hours to process, which is not acceptable.
    This original process was written with 9i, and I am now running 10gR2, so I know there are new features that should help. For starters, I think I can use SDO_JOIN in place of the original outer loop to generate a complete list of geometry interactions in one query. Of course, I am still concerned about how long that might take.
    Even more troubling is, if that works, I still don't see how to improve the rest of the calculations. Any suggestions would be appreciated.

    No, I don't mind providing it.
    Here it is:
    -- cre_&stab._bndxing.sql
    --Procedure definition of bndxings
    def stab=&1
    CREATE OR REPLACE PROCEDURE Find_&stab._bndxings
    (theDate IN DATE, theStr IN VARCHAR2) IS
    --Select flights from table
    CURSOR FCursor IS
    SELECT new_Flight_Index,
    Acid,
    New_Act_Date,
    Dept_Aprt,
    Dep_Time,
    Arr_Aprt,
    Arr_Time,
    Acft_Type,
    Physical_Class,
    User_Class,
    Nrp,
         d_lat,
    d_lon,
    a_lat,
    a_lon,
         flight_track
    FROM jady.Flight
    WHERE new_act_date = theDate
    AND flight_track IS NOT NULL
    AND substr(acid,1,1) = theStr
    --AND acid in (select acid from name_temp)
    --AND acid = 'AAL1242'
    ORDER BY acid,new_flight_index;
    --Temp vars for storing flight info
    fi_var NUMBER;
    acid_var VARCHAR2(7);
    dep_time_var DATE;
    arr_time_var DATE;
    F_Rec FCursor%ROWTYPE;
    --Temp vars for flight
    tcnt INTEGER;
    cur_lat NUMBER;
    cur_lon NUMBER;
    last_lat NUMBER;
    last_lon NUMBER;
    --Temp vars for airspace and xing geometries
    aname VARCHAR2(20);
    bxings MDSYS.SDO_GEOMETRY;
    bxcnt INTEGER;
    --Select xings made from temp bndxing table
    CURSOR XCursor IS
    SELECT Act_Date,
    Name,
    Lon,
    Lat,
    Alt,
    Time,
    OPS
    FROM bndxing_tmp
    WHERE Flight_Index = fi_var
    AND Acid = acid_var
    ORDER BY Name,Time;
    --Temp vars for paired in/out xings
    ad date;
    ilon NUMBER;
    ilat NUMBER;
    ialt NUMBER;
    isec NUMBER;
    iops NUMBER;
    olon NUMBER;
    olat NUMBER;
    oalt NUMBER;
    osec NUMBER;
    oops NUMBER;
    gcr NUMBER;
    dist NUMBER;
    dura NUMBER;
    ops VARCHAR2(1);
    i INTEGER;
    i_aname VARCHAR2(20);
    o_aname VARCHAR2(20);
    names_match BOOLEAN;
    theSeq NUMBER;
    same_airport_no_tzdata BOOLEAN;
    -- Cursor and variables for bndxing sequencing
    CURSOR BCursor IS
    SELECT * FROM bndxing
    WHERE act_date = theDate
         AND Acid = acid_var
         AND Flight_Index = fi_var
    ORDER BY in_time
    FOR UPDATE;
    BRec BCursor%ROWTYPE;
    --Error logging variable
    strErrorMessage VARCHAR2(255);
    BEGIN --Start of Main Loop
    --Loop for each flight in table
    OPEN FCursor;
    FETCH FCursor INTO F_Rec;
    -- FOR f IN FCursor LOOP
    WHILE FCursor%FOUND LOOP
    fi_var:= F_Rec.new_Flight_Index;
    acid_var := F_Rec.acid;
    arr_time_var := F_Rec.arr_time;
    dep_time_var := F_Rec.dep_time;
    last_lat := -10000; --initializtion
    last_lon := -10000; --initializtion
    -- DEBUG STATEMENT
    /* Insert into bnd_error values (err_seq.NEXTVAL,
    sysdate,
    F_Rec.Acid,
    F_Rec.new_Flight_Index,
    'Checkpoint 1');
    --Add departing xing to temp table if in US airspace
    DECLARE
    CURSOR DepCur IS
    SELECT Name
    FROM &stab.
    WHERE SDO_RELATE(Airspace,
         MDSYS.SDO_GEOMETRY(2001,8307,
    MDSYS.SDO_POINT_TYPE(F_Rec.d_lon,F_Rec.d_lat,null),
         null, null),
    'mask=CONTAINS querytype=WINDOW') = 'TRUE';
    BEGIN -- Start of Departing Airspace Loop
    FOR c in DepCur LOOP
    INSERT INTO Bndxing_Tmp VALUES (F_Rec.new_Flight_Index,
    F_Rec.acid,
    F_Rec.New_Act_Date,
    c.name,
    2,
    F_Rec.d_lon,
    F_Rec.d_lat,
    0,
    (F_Rec.Dep_Time-F_Rec.New_Act_Date)*86400);
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
    WHEN OTHERS THEN
    strErrorMessage := SQLERRM;
    INSERT INTO bnd_error VALUES (err_seq.NEXTVAL,
    sysdate,
                             F_Rec.Acid,
                             F_Rec.new_Flight_Index,
                             'Exception from Departing Airspace loop: ' || strErrorMessage);
    COMMIT;
    END; -- End of Departing Airspace Loop
    --Add arrival xing to temp table if in US airspace
    DECLARE
    CURSOR ArrCur IS
    SELECT name
    FROM &stab.
    WHERE SDO_RELATE(Airspace,
         MDSYS.SDO_GEOMETRY(2001,8307,
    MDSYS.SDO_POINT_TYPE(F_Rec.a_lon, F_Rec.a_lat, null),
    null, null),
    'mask=CONTAINS querytype=WINDOW') = 'TRUE';
    BEGIN -- Start of Arrival Airspace Loop
    FOR c IN ArrCur LOOP
    INSERT INTO Bndxing_Tmp VALUES (F_Rec.new_Flight_Index,
    F_Rec.acid,
    F_Rec.New_Act_Date,
    c.name,
    1,
    F_Rec.a_lon,
    F_Rec.a_lat,
    0,
    (F_Rec.Arr_Time - F_Rec.New_Act_Date)*86400);
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
    WHEN OTHERS THEN
    strErrorMessage := SQLERRM;
    INSERT INTO bnd_error VALUES (err_seq.NEXTVAL,
    sysdate,
                             F_Rec.Acid,
                             F_Rec.new_Flight_Index,
                             'Exception from Arrival Airspace loop: ' || strErrorMessage);
    COMMIT;
    END; -- End of Arrival Airspace Loop
    --DEBUG STATEMENT
    /* Insert into bnd_error values (err_seq.NEXTVAL,
    sysdate,
    F_Rec.Acid,
    F_Rec.new_Flight_Index,
    'Checkpoint 4');
    --Find all intersections between the flight track and airspace boundaries and insert into temp table
    DECLARE
    --Find airspace boundaries that interact with the flight track
    CURSOR CCursor IS
    SELECT Name, Boundary
    FROM &stab.
    WHERE SDO_RELATE(boundary,F_Rec.flight_track,'mask=OVERLAPBDYDISJOINT querytype=WINDOW')='TRUE';
    BEGIN
    FOR c IN CCursor LOOP
    bxings := SDO_GEOM.SDO_INTERSECTION(c.boundary,F_Rec.flight_track,10);
    bxcnt:=bxings.sdo_ordinates.count;
    LOOP
    INSERT INTO bndxing_tmp VALUES (F_Rec.new_Flight_Index,
    F_Rec.acid,
    F_Rec.New_Act_Date,
    c.name,
    0,
    bxings.sdo_ordinates(bxcnt-3),
    bxings.sdo_ordinates(bxcnt-2),
    bxings.sdo_ordinates(bxcnt-1),
    SDO_LRS.FIND_MEASURE(F_Rec.flight_track,
    MDSYS.SDO_GEOMETRY(2001,8307,NULL,
    MDSYS.SDO_ELEM_INFO_ARRAY(1,1,1),
    MDSYS.SDO_ORDINATE_ARRAY(bxings.sdo_ordinates(bxcnt-3),
    bxings.sdo_ordinates(bxcnt-2)))));
    bxcnt := bxcnt - 4;
    EXIT WHEN (bxcnt < 1);
    END LOOP;
    END LOOP; -- end CCursor LOOP
    EXCEPTION
    WHEN OTHERS THEN
    strErrorMessage := SQLERRM;
    INSERT INTO bnd_error VALUES (err_seq.NEXTVAL,
    sysdate,
                             F_Rec.Acid,
                             F_Rec.new_Flight_Index,
                             'Exception from bndxing loop: ' || strErrorMessage);
    COMMIT;
    END;
    --DEBUG STATEMENT
    /* Insert into bnd_error values (err_seq.NEXTVAL,
    sysdate,
    F_Rec.Acid,
    F_Rec.new_Flight_Index,
    'Checkpoint 6');
    --After all xings for a flight have been collected sort Xings by name and time and grab pairwise
    theSeq :=0;
    OPEN XCursor;
    BEGIN -- Start of Stats Loop
    LOOP
         FETCH XCursor INTO ad, i_aname, ilon, ilat, ialt, isec, iops; --CHANGED CODE
    EXIT WHEN XCursor%NOTFOUND ;
    FETCH XCursor INTO ad, o_aname, olon, olat, oalt, osec, oops; --CHANGED CODE
    EXIT WHEN XCursor%NOTFOUND ;
    names_match := (i_aname = o_aname); --NEW CODE
    WHILE not names_match LOOP --NEW CODE
    i_aname := o_aname; --NEW CODE
         ilon := olon; --NEW CODE
         ilat := olat; --NEW CODE
         ialt := oalt; --NEW CODE
         isec := osec; --NEW CODE
         iops := oops; --NEW CODE
    FETCH XCursor INTO ad, o_aname, olon, olat, oalt, osec, oops; --NEW CODE
    EXIT WHEN XCursor%NOTFOUND; --NEW CODE
    names_match := (i_aname = o_aname); --NEW CODE
    END LOOP; --NEW CODE
         --Calculate stats
         BEGIN -- Start of In Values Loop
         i:=4;
         IF (iops<>2) THEN
         -- Did not depart from this airspace, calculate entry altitude into airspace.
         LOOP
         i:=i+4;
         EXIT WHEN F_Rec.flight_track.sdo_ordinates(i)>isec;
         END LOOP;
    IF ( F_Rec.flight_track.sdo_ordinates(i-1) = F_Rec.flight_track.sdo_ordinates(i-5) ) THEN
    ialt := F_Rec.flight_track.sdo_ordinates(i-1);
    ELSE
    ialt:=SDO_LRS.FIND_MEASURE(
         MDSYS.SDO_GEOMETRY(3302,8307,NULL,
         MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),
    MDSYS.SDO_ORDINATE_ARRAY(F_Rec.flight_track.sdo_ordinates(i-7),
    F_Rec.flight_track.sdo_ordinates(i-6),
    F_Rec.flight_tracK.sdo_ordinates(i-5),
    F_Rec.flight_track.sdo_ordinates(i-3),
    F_Rec.flight_track.sdo_ordinates(i-2),
    F_Rec.flight_track.sdo_ordinates(i-1))),
         MDSYS.SDO_GEOMETRY(2001,8307,NULL,
    MDSYS.SDO_ELEM_INFO_ARRAY(1,1,1),
    MDSYS.SDO_ORDINATE_ARRAY(ilon,ilat)));
    END IF;
         END IF;
         EXCEPTION
         WHEN OTHERS THEN
         strErrorMessage := SQLERRM;
         INSERT INTO bnd_error VALUES (err_seq.NEXTVAL,
         sysdate,
                                  F_Rec.Acid,
                                  F_Rec.new_Flight_Index,
                                  'Exception from In Values section: ' || strErrorMessage);
         COMMIT;
         END; -- End of In Values Loop
    BEGIN -- Start of Out Values Loop
         i:=4;
         IF (oops<>1) THEN
    -- Did not arrive in this airspace, calculate departure altitude from airspace.
    LOOP
    i:=i+4;
    EXIT WHEN F_Rec.flight_track.sdo_ordinates(i)>osec;
    END LOOP;
         --Find alt at this time
    IF ( F_Rec.flight_track.sdo_ordinates(i-1) = F_Rec.flight_track.sdo_ordinates(i-5) ) THEN
    oalt := F_Rec.flight_track.sdo_ordinates(i-1);
    ELSE
         oalt:=SDO_LRS.FIND_MEASURE(
         MDSYS.SDO_GEOMETRY(3302, 8307, NULL,
         MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),
    MDSYS.SDO_ORDINATE_ARRAY(F_Rec.flight_track.sdo_ordinates(i-7),
    F_Rec.flight_track.sdo_ordinates(i-6),
    F_Rec.flight_track.sdo_ordinates(i-5),
    F_Rec.flight_track.sdo_ordinates(i-3),
    F_Rec.flight_track.sdo_ordinates(i-2),
    F_Rec.flight_track.sdo_ordinates(i-1))),
         MDSYS.SDO_GEOMETRY(2001,8307,NULL,
    MDSYS.SDO_ELEM_INFO_ARRAY(1,1,1),
    MDSYS.SDO_ORDINATE_ARRAY(olon,olat)));
    END IF;
    END IF;
         EXCEPTION
    WHEN OTHERS THEN
    strErrorMessage := SQLERRM;
    INSERT INTO bnd_error VALUES (err_seq.NEXTVAL,
         sysdate,
                                  F_Rec.Acid,
                                  F_Rec.new_Flight_Index,
                                  'Exception from Out Values loop: ' || strErrorMessage);
    COMMIT;
    END; -- End of Out Values Loop
    BEGIN -- Start of Finish Loop
    --Find GCR, actual distance and duration in airspace
    gcr := SDO_GEOM.SDO_DISTANCE(MDSYS.SDO_GEOMETRY(2001,8307,
    MDSYS.SDO_POINT_TYPE(ilon,ilat,NULL),NULL,NULL),
    MDSYS.SDO_GEOMETRY(2001,8307,
    MDSYS.SDO_POINT_TYPE(olon,olat,NULL),NULL,NULL),
    10,'unit=naut_mile');
    --DEBUG STATEMENT
    /* Insert into bnd_error values (err_seq.NEXTVAL,
    sysdate,
    F_Rec.Acid,
    F_Rec.new_Flight_Index,
    'In Finish Loop: isec: ' ||isec||' osec: '||osec
                        ||' airspace: '||i_aname);
    dist := SDO_GEOM.SDO_LENGTH(SDO_LRS.CLIP_GEOM_SEGMENT(F_Rec.flight_track,isec,osec),10,'unit=naut_mile');
         dura := (osec - isec);
    --Set OPS Flag
    iops := iops + oops;
    IF (iops=3) THEN
    ops := 'B';
    ELSIF (iops=2) THEN
    ops := 'D';
    ELSIF (iops=1) THEN
    ops := 'A';
    ELSE
    ops := 'O';
    END IF;
         theSeq := theSeq + 1;
    --Insert into Bndxing table
    INSERT INTO Bndxing VALUES (F_Rec.Acid,
    F_Rec.new_Flight_Index,
    F_Rec.New_Act_Date,
         theSeq,
         F_Rec.Dept_Aprt,
         F_Rec.Arr_Aprt,
    i_aname,
    round(ilon,3),
    round(ilat,3),
    ialt,
    isec/86400 + ad,
    NULL, -- IN_SPEED (TBD)
    round(olon,3),
    round(olat,3),
    oalt,
    osec/86400 + ad,
    NULL, -- OUT_SPEED (TBD)
    gcr,
    dist,
    dura,
    ops, -- CHANGED CODE
    nvl(F_Rec.Acft_Type,'----'),
    NULL, -- IF_FLAG (NULL)
    nvl(F_Rec.Physical_Class,'-'),
    nvl(F_Rec.User_Class,'-'),
    F_Rec.Nrp,
    NULL, -- FFS_FLAG (NULL)
    NULL, -- ER_SG (NULL)
    NULL, -- ER_TI (NULL)
    NULL, -- ER_ZT (NULL)
    NULL, -- ER_DU (NULL)
    NULL, -- ER_SP (NULL)
    NULL -- ER_BD (NULL)
    DELETE FROM bndxing_tmp
         WHERE acid=F_Rec.Acid and flight_index=F_Rec.new_Flight_Index;
         COMMIT;
    EXCEPTION
    WHEN OTHERS THEN
    strErrorMessage := SQLERRM;
    INSERT INTO bnd_error VALUES (err_seq.NEXTVAL,
         sysdate,
         F_Rec.Acid,
         F_Rec.new_Flight_Index,
         'Exception from Finish loop: ' || strErrorMessage);
    COMMIT;
    END; -- End of Finish Loop
    END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
    strErrorMessage := SQLERRM;
    INSERT INTO bnd_error VALUES (err_seq.NEXTVAL,
    sysdate,
    F_Rec.Acid,
    F_Rec.new_Flight_Index,
    'Exception from Stats loop: ' || strErrorMessage);
    COMMIT;
    END; -- End of Stats Loop
    --Reset cursor and track geometry
    CLOSE XCursor;
    F_Rec.flight_track.sdo_ordinates.delete;
    -- delete from hist_bndxing_tmp
    -- where acid=acid_var and new_flight_index=fi_var;
    FETCH FCursor INTO F_Rec;
    END LOOP;
    --DEBUG STATEMENT
    /* INSERT INTO bnd_error VALUES (err_seq.NEXTVAL,
    sysdate,
    acid_var,
    fi_var,
    'Checkpoint 7');
    CLOSE FCursor;
    theSeq := 1;
    OPEN BCursor;
    LOOP
    FETCH BCursor INTO BRec;
    IF BCursor%NOTFOUND THEN
    EXIT;
    END IF;
    UPDATE bndxing
    SET segment = theSeq
    WHERE CURRENT OF BCursor;
    theSeq := theSeq + 1;
    END LOOP;
    CLOSE BCursor;
    EXCEPTION
    WHEN OTHERS THEN
    strErrorMessage := SQLERRM;
    Insert into bnd_error values (err_seq.NEXTVAL,
    sysdate,
                             acid_var,
                             fi_var,
                             'Exception from main: ' || strErrorMessage);
    COMMIT;
    CLOSE FCursor;
    END; -- End of Main Loop
    SHOW ERRORS;
    --exit;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

  • HFM Data Load Error in ODI

    Hi,
    I'm loading data into HFM from flat file. When the interface is executed only some of the data are getting loaded. When i checked for the errors in the log, I'm getting the following error message in log:
    'Line: 56, Error: Invalid cell for Period Apr'
    Then i found that its an invalid intersection in HFM which am trying to load.
    In FDM there is an option to validate invalid intersections during data load.
    I would like to know how to do so in ODI to overcome this kind of error i.e. is there any option in ODI to ignore this kind of error.
    Kndly help me.
    Thanks in advance

    Hi,
    I think even if the metadata exists still there might be some issues with HFM forbidden cells. There are HFM rules that determines which intersections are editable/loadable which are not. Please look at your HFM admin regarding forbidden rules. Or otherwise change the property of Custom dimensions so that it accepts data into all intersections.
    Thanks,
    Debasis

  • Bug report: Oracle schema parser/regex compiler failing valid xs:patterns

    Hello,
    The Oracle schema regex compiler does not allow valid patterns with more than a certain number of branches. An XSDException is thrown, namely 'invalid facet 'pattern' in element 'simpleType'.
    I have also tried using multiple <xs:pattern> elements, which also conforms to the official schema specification, but no luck there either.
    Here are my sample regexs which validate correctly against all branch examples in XML Spy 4.0:
    <!-- as single multi branchpattern-->
    <xs:pattern value="aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow|[A-Za-z]{1,2}[0-9]{2,4}|rgb\([0-9]{1,3}%{0,1},[0-9]{1,3}%{0,1},[0-9]{1,3}%{0,1}\)"/>
    <!-- as multiple patterns-->
    <xs:pattern value="aqua|black|blue|fuchsia|gray|green|lime|maroon"/>
    <xs:pattern value="navy|olive|purple|red|silver|teal|white|yellow"/>
    <xs:pattern value="[A-Za-z]{1,2}[0-9]{2,4}"/>
    <xs:pattern value="rgb\([0-9]{1,3}%{0,1},[0-9]{1,3}%{0,1},[0-9]{1,3}%{0,1}\)"/>
    (Note that the Oracle regex compiler will allow any one of these patterns, it is only when the compiler concatenates them as per the spec that the exception is thrown.)
    Here are the W3 specifications for patterns/schema regex, which impose no limit on pattern branches whether they are part of one or multiple xs:pattern 'value' attributes:
    (http://www.w3.org/TR/xmlschema-2/#regexs)
    [Definition:] A regular expression is composed from zero or more ·branch·es, separated by | characters.
    [Definition:] A branch consists of zero or more ·piece·s, concatenated together.
    (http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#rf-pattern)
    Schema Representation Constraint: Multiple patterns
    If multiple <pattern> element information items appear as [children] of a <simpleType>, the [value]s should be combined as if they appeared in a single ·regular expression· as separate ·branch·es.
    NOTE: It is a consequence of the schema representation constraint Multiple patterns (§4.3.4.3) and of the rules for ·restriction· that ·pattern· facets specified on the same step in a type derivation are ORed together, while ·pattern· facets specified on different steps of a type derivation are ANDed together.
    Thus, to impose two ·pattern· constraints simultaneously, schema authors may either write a single ·pattern· which expresses the intersection of the two ·pattern·s they wish to impose, or define each ·pattern· on a separate type derivation step.
    Many thanks
    Kevin Smith

    Hello,
    The Oracle schema regex compiler does not allow valid patterns with more than a certain number of branches. An XSDException is thrown, namely 'invalid facet 'pattern' in element 'simpleType'.
    I have also tried using multiple <xs:pattern> elements, which also conforms to the official schema specification, but no luck there either.
    Here are my sample regexs which validate correctly against all branch examples in XML Spy 4.0:
    <!-- as single multi branchpattern-->
    <xs:pattern value="aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow|[A-Za-z]{1,2}[0-9]{2,4}|rgb\([0-9]{1,3}%{0,1},[0-9]{1,3}%{0,1},[0-9]{1,3}%{0,1}\)"/>
    <!-- as multiple patterns-->
    <xs:pattern value="aqua|black|blue|fuchsia|gray|green|lime|maroon"/>
    <xs:pattern value="navy|olive|purple|red|silver|teal|white|yellow"/>
    <xs:pattern value="[A-Za-z]{1,2}[0-9]{2,4}"/>
    <xs:pattern value="rgb\([0-9]{1,3}%{0,1},[0-9]{1,3}%{0,1},[0-9]{1,3}%{0,1}\)"/>
    (Note that the Oracle regex compiler will allow any one of these patterns, it is only when the compiler concatenates them as per the spec that the exception is thrown.)
    Here are the W3 specifications for patterns/schema regex, which impose no limit on pattern branches whether they are part of one or multiple xs:pattern 'value' attributes:
    (http://www.w3.org/TR/xmlschema-2/#regexs)
    [Definition:] A regular expression is composed from zero or more ·branch·es, separated by | characters.
    [Definition:] A branch consists of zero or more ·piece·s, concatenated together.
    (http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#rf-pattern)
    Schema Representation Constraint: Multiple patterns
    If multiple <pattern> element information items appear as [children] of a <simpleType>, the [value]s should be combined as if they appeared in a single ·regular expression· as separate ·branch·es.
    NOTE: It is a consequence of the schema representation constraint Multiple patterns (§4.3.4.3) and of the rules for ·restriction· that ·pattern· facets specified on the same step in a type derivation are ORed together, while ·pattern· facets specified on different steps of a type derivation are ANDed together.
    Thus, to impose two ·pattern· constraints simultaneously, schema authors may either write a single ·pattern· which expresses the intersection of the two ·pattern·s they wish to impose, or define each ·pattern· on a separate type derivation step.
    Many thanks
    Kevin Smith

  • RegEx: How to find out which part of the pattern failed?

    Hi there,
    I was wondering: is there any way to find out where the pattern matching failed?
    Say I got the string "John Paul Yoko Ringo", and I want to match it against the pattern /John Paul George Ringo/.
    I would like to know something like "pattern failed at index 11", or if I had groups something like "matching group 3 failed".
    Is there any way to do this? Thanks in advance!
    Best regards,
    - Torben

    jschell wrote:
    I would like to know something like "pattern failed at index 11", or if I had groups something like "matching group 3 failed".
    Is there any way to do this? Thanks in advance!
    I wonder if that is reasonable. It means that the parse tree for the regex would need to keep mapping information.
    At a minimum it is going to require an array, not a single result, because a regex can 'fail' in many ways.
    Consider the following regex with the following input
    /(a|b)d/
    abababababx
    Where does it 'fail'?Right. If you just want the character position at which it failed, those tools might tell you that as part of a bigger picture. But by itself, without any context, that number's not necessarily meaingful. A given character can be examined many times due to backtracking. Part of the expression could succeed for part of the input, then the expression might fail for the rest, so we backtrack, and may get several more failures, then more partial successes, all at different points, then ultimately it may fail anywhere within the input.
    So just knowing where isn't enough. You need to know what steps were taken to get there. I do think these tools provide that, though I haven't looked closely.

  • Write REGEX for a string pattern

    Hi All,
    I am new to using regular expression and writing the patterns, I am looking to write a pattern for below formats and do a FIND REGEX:
    A123456-01-123456789-123   and A123456-01-123456789-ABC
    DATA: regex TYPE REF TO cl_abap_regex,
          res   TYPE        match_result_tab,
          text  TYPE        string.
    CREATE OBJECT regex
        EXPORTING pattern      = '\(.\)\1'
                  simple_regex = 'X'
    FIND ALL OCCURRENCES OF REGEX regex IN text RESULTS res.
    could you help me write the pattern to check if user has entered string in formats A123456-01-123456789-123   and A123456-01-123456789-ABC
    Thank you
    Depp

    Hi Manish,
    First of all sorry for getting back so late..was stuck with project delivery...and Thank you for your solution. Only one scenario failed i.e., I didn't mention that the value 01 in the examples, is constant in strings A123456-01-123456789-123   and A123456-01-123456789-ABC.
    which means it has to be always 01 any other value than 01 the sy-subrc should not be zero.
    I will also be thankful if you could share me the document(s) which help us write the above patterns( '^\w\d{6}-\d{2}-\d{9}-\d{3}$' ; '^\w\d{6}-\d{2}-\d{9}-\w{3}$' ).
    In the meanwhile I will also do some R&D with your reply to solve the failed scenario.
    Regards,
    Depp

  • Firefox 4 does not validate REGEX in "pattern" attribute of INPUT (type = text) when diacritic characters are includes (Chrome does).

    Using HTML5 and Firefox 4.0.1, following code :
    <form>
    <input type="text" name="my_input"
    pattern="^[A-Z]([a-zA-Zçéèâêîôûäëïöü-]{1,47}|.)" />
    </form>
    fails to validate input like "François" or "André" but "Francois" ou "André" is accepted. The problèm occurs with string including any diacritic character.
    (The REGEX validates using "Expresso" Regular Expression Editor.)

    See https://developer.mozilla.org/en/HTML/element/input
    <blockquote>pattern HTML5:
    A regular expression that the control's value is checked against. The pattern must match the <u>entire</u> value, not just some subset. Use the title attribute to describe the pattern to help the user. This attribute applies when the value of the type attribute is text, search, tel, url or email; otherwise it is ignored.</blockquote>
    <pre><nowiki>pattern="^[A-Z]([a-zA-Zçéèâêîôûäëïöü-]{1,47}|.)$"</nowiki></pre>

  • Variable in regex replace pattern

    Hi,
    I need to use a variable in a regex replace pattern - how can I do it? Specifically, I need to pass arguments to a shell script that then uses that argument in a replace pattern:
    #!/bin/bash
    #$1 now holds the argument
    sed 's/searchpattern/replace_pattern_with_variable$1/g' file1 > file2
    when I run this, the replace pattern uses $1 as a literal string "$1" and not the variable value. How can I change this?
    Thanks!
    Ingo

    Hi Ingo,
       As Vid points out, the issue is that single quotes protect strings from shell interpretation. You need to have the dollar sign, '$', visible to the shell or it won't read what follows as a variable name. Using double quotes works because the shell "reads through" those.
       However, complex regular expressions can contain lots of characters that the shell interprets. These can be quoted individually by backslashes but the use of backslashes in regular expressions is complex enough without the addition of shell interpretation. I find it easiest to keep the single quotes and only expose the part of the string that the shell needs to interpret.
       The shell doesn't have a special string concatenation character. All you have to do is to put the strings beside each other with nothing in between and the shell will concatenate them. Therefore it's possible to write your example as:
    sed 's/searchpattern/replace_pattern_with_variable'${1}'/g' file1 > file2
    That is, one closes the single quote right before the variable and then resumes it immediately afterward. The shell will put these quoted strings together with the contents of the variable just as it would with double quotes but you still enjoy the protection of single quotes around the rest of the string!
    Gary
    ~~~~
       P.S. Perl's master plan (or what passes for one) is to take
       over the world like English did. Er, as English did...
          -- Larry Wall in <[email protected]>

  • ***Need Regex for a pattern

    Hello,
    I need a pattern for the following use cases: I am using Java
    1. var so = nokia.device.load('abc','abc');
    2. var so = nokia.device.load("abc","abc");
    3. var so = nokia.device.load("abc");
    4. var so = nokia.device.load('abc');
    // 5. var so = nokia.device.load('abc'); (Line is commentted)+
    function init()
    if (window.menu) {
    // set tab-navigation mode and hide softkeys
    widget.setNavigationEnabled(false);
    var so = nokia.device.load("abc");(Line is commentted)+
    I need a regex pattern which will be give me only the function statments which are listed in bold and NOT italic format function statements as those statements are commented.
    Basically, the pattern should give me the statments which are not commented.
    Please help me, its urgent.
    Thanks,
    Mallikarjun.
    Edited by: arjun2010 on Apr 26, 2010 9:36 PM

    I'll let the fact that the requirement is very dodgy slide for a moment. It seems that a pattern might not be the solution here; why not do something like the following:
    SWEEP 1:
    - scan through the code one character at a time, looking for comment blocks and comment lines.
    - remove all comment blocks from the code (or rather, copy all parts that are not comments to a new buffer)
    now you have code cleaned of all comments
    SWEEP 2:
    - scan for 'noka.device.load' and extract those pieces of code with some clever string comparisons.
    Of course I don't know the why behind this requirement, but if I had to implement such a crude requirement I'd do it as simple as possible in stead of as clean as possible.

  • Regex Pattern help.

    Me and my friend pedrofire, that�s probably around forums somewhere, are newbies. We are trying to get a log file line and process correctly but we are found some dificculties to create the right expression pattern.
    My log have lines like:
    User 'INEXIST' with session 'ax1zjd8yEeHh' added content '769' with uri 'http://mail.yahoo.com/'.
    User 'INEXIST' with session 'ax1zjd8yEeHh' changed folder from 'E-mails' to 'Milhagem'.
    User 'INEXIST' with session 'a8jXrY_N38ja' updated all content of folder 'Bancos'.
    i need to get the following data
    USER - [INEXIST]
    SESSION - [ax1zjd8yEeHh]
    ACTION - [added] or [changed] or [updated].
    Getting the user and the session is easy, but i am having difficulties grabing the action, because i need to take just the action word without blank spaces igonring the words content or folder or all.
    I m trying this for hours, but to a newbie is a little dificult
    Any help is welcome
    Thanks
    Peter Redman

    Hi,
    How about something like:
    import java.util.regex.*;
    public class RegexpTest
       private static final Pattern p = Pattern.compile(
             "^User '([^']+)' with session '([^']+)' ([^ ]+) .*$" );
       public static void main( String[] argv )
          find( "User 'INEXIST' with session 'ax1zjd8yEeHh' added content '769' with uri 'http://mail.yahoo.com/'." );
          find( "User 'INEXIST' with session 'ax1zjd8yEeHh' changed folder from 'E-mails' to 'Milhagem'." );
          find( "User 'INEXIST' with session 'a8jXrY_N38ja' updated all content of folder 'Bancos'." );
       public static void find( String text )
          System.out.println( "Text: " + text );
          Matcher m = p.matcher( text );
          if ( ! m.matches() ) return;
          String user = m.group(1);
          String session = m.group(2);
          String action = m.group(3);
          System.out.println( "User: " + user );
          System.out.println( "Session: " + session );
          System.out.println( "Action: " + action );
       }which results in:
    Text: User 'INEXIST' with session 'ax1zjd8yEeHh' added content '769' with uri 'http://mail.yahoo.com/'.
    User: INEXIST
    Session: ax1zjd8yEeHh
    Action: added
    Text: User 'INEXIST' with session 'ax1zjd8yEeHh' changed folder from 'E-mails' to 'Milhagem'.
    User: INEXIST
    Session: ax1zjd8yEeHh
    Action: changed
    Text: User 'INEXIST' with session 'a8jXrY_N38ja' updated all content of folder 'Bancos'.
    User: INEXIST
    Session: a8jXrY_N38ja
    Action: updatedYou should probably change the Pattern to be less explicit about what it matches. i.e. changes spaces to \\s+ or something similar.
    Ol.

Maybe you are looking for

  • A Question About SDK 7.0.5 Plug-in

    Here is my question I have installed Acrobat sdk7.0.5 ,acrobat pro7.0 in windows xp pro. Now i use vs.net2008 for develop. I have a mfc project that i wanna to open and edit .pdf document. I need to add a new toolbar in app,but only use pro 7.0 typel

  • Waiting because of e

    Hello all,   I have a problem with a bpm execution. When the Receiver Determination call a simple BPM, this process stop and in transaction SWEQBROWSER show a object ZXI_PROXY .... with status  Waiting because of e.   Thanks all

  • A vital error in mobile server!

    when i choose send commond to the client,such as "sync database",there is a error occur and the mobile server stop!the error is below: my olite version is 10.3.0.1.0 # An unexpected error has been detected by HotSpot Virtual Machine: # EXCEPTION_ACCE

  • Photo sort on Iphone

    My photo events in Itunes are in alpha order. When I sync to Ipad they appear in the exact same order but on my 3Gs they are in some random order that I can't make out. How do I get them to appear in alpha order like on Itunes and Ipad? I've tried ev

  • HT201412 my apple ipad is disabled and saying connect to itunes. i tried to connect with itunes but not responding

    my apple ipad is disabled and saying connect to itunes. i tried to connect with itunes but not responding