Package org.opengis.filter

Examples of org.opengis.filter.PropertyIsLike


        String propertyName = attResult.getPropertyName();
    Assert.assertEquals(expected, propertyName);
    }

    private void testAttribute(final String attSample) throws CQLException {
        PropertyIsLike result;
        PropertyName attResult = null;

        result = (PropertyIsLike) CompilerUtil.parseFilter(this.language, attSample + " LIKE 'abc%'");

        attResult = (PropertyName) result.getExpression();

        final String expected = attSample.replace('.', '/');

        Assert.assertEquals(expected, attResult.getPropertyName());
    }
View Full Code Here


   
    public void testLikeFilter() throws IllegalFilterException, OperationNotSupportedException, IOException{
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
        Expression testAttribute = ff.property("testString");

        PropertyIsLike lf = ff.like( ff.property("testString"), "test*", "*", ".", "!");

        StringWriter output = new StringWriter();
        DocumentWriter.writeFragment(lf,
            FilterSchema.getInstance(), output, null);
       
View Full Code Here

     * Tests the like operator.
     *
     * @throws IllegalFilterException If the constructed filter is not valid.
     */
    public void testLike() throws IllegalFilterException {
        PropertyIsLike filter = fac.like(fac.property("testString"), "abc");
        assertAttributeName(filter, "testString");
    }
View Full Code Here

    }

    public void testGetFeaturesWithIsLikeFilter() throws Exception {
        init();
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyIsLike f = ff.like(ff.property("standard_ss"), "IEEE 802.11?");
        SimpleFeatureCollection features = featureSource.getFeatures(f);
        assertEquals(11, features.size());
    }
View Full Code Here

        assertTrue( modified instanceof Literal );
    }
   
    public void testNotFilter() {
        // set GEOT-1566
        PropertyIsLike like = fac.like(fac.property("stringProperty"), "ab*");
        Not not = fac.not(like);
        DuplicatingFilterVisitor visitor = new DuplicatingFilterVisitor(fac);
        Not clone = (Not) not.accept(visitor, null);
        assertEquals(not, clone);
        assertNotSame(not, clone);
View Full Code Here

        PropertyName testAttribute = null;

        // Set up string
        testAttribute = new AttributeExpressionImpl(testSchema, "testString");

        PropertyIsLike filter = fac.like(testAttribute, "test*", "*", ".", "!");
        assertTrue(filter.evaluate(testFeature));

        // Test for false positive.
        filter = fac.like(testAttribute, "cows*", "*", ".", "!");
        assertFalse(filter.evaluate(testFeature));

        // Test we don't match if single character is missing
        filter = fac.like(testAttribute, "test*a.", "*", ".", "!");
        assertFalse(filter.evaluate(testFeature));
       
        // Test we do match if the single char is there
        filter = fac.like(testAttribute, "test*dat.", "*", ".", "!");
        assertTrue(filter.evaluate(testFeature));
    }
View Full Code Here

        return result;
    }

    @Override
    public Object visit(PropertyIsLike filter, Object extraData) {
        PropertyIsLike clone = (PropertyIsLike) super.visit(filter, extraData);
        return guardAgainstNulls(filter, clone.getExpression());
    }
View Full Code Here

    }

    public void testPropertyIsLike() throws Exception {
        StringBuilder builder = new StringBuilder(URL_LAYER_ASIA);
        SFSFilterVisitor visitor = new SFSFilterVisitor(true);
        PropertyIsLike filter = FF.like(FF.property(PROPERTY_NAME), PROPERTY_VALUE, "%", "_", "\\", true);
        visitor.visit(filter, null);
        visitor.finish(builder, false);
        assertEquals(URL_LAYER_ASIA + "?" + PROPERTY_NAME + "__like=" + PROPERTY_VALUE + "&queryable="
                + PROPERTY_NAME, URLDecoder.decode(builder.toString(),"UTF-8"));
    }
View Full Code Here

    }

    public void testPropertyIsLike() throws Exception {
        StringBuilder builder = new StringBuilder(URL);
        GeoRestFilterVisitor visitor = new GeoRestFilterVisitor(true);
        PropertyIsLike filter = FF.like(FF.property(PROPERTY_NAME), PROPERTY_VALUE);
        visitor.visit(filter, null);
        visitor.finish(builder, false);
        Assert.assertEquals(URL + "?" + PROPERTY_NAME + "__like=" + PROPERTY_VALUE + "&queryable="
                + PROPERTY_NAME, builder.toString());
    }
View Full Code Here

        }
    }
   
    public void testLikeFilter() throws Exception {
        FilterFactory2 ff = (FilterFactory2) dataStore.getFilterFactory();
        PropertyIsLike caseSensitiveLike = ff.like(ff.property(aname("stringProperty")),
                "Z*", "*", "?", "\\", true);
        PropertyIsLike caseInsensitiveLike = ff.like(ff.property(aname("stringProperty")),
                "Z*", "*", "?", "\\", false);
        PropertyIsLike caseInsensitiveLike2 = ff.like(ff.property(aname("stringProperty")),
                "z*", "*", "?", "\\", false);
        assertEquals(0, featureSource.getCount(new Query(null, caseSensitiveLike)));
        assertEquals(1, featureSource.getCount(new Query(null, caseInsensitiveLike)));
        assertEquals(1, featureSource.getCount(new Query(null, caseInsensitiveLike2)));
    }
View Full Code Here

TOP

Related Classes of org.opengis.filter.PropertyIsLike

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.