Package org.opengis.feature.type

Examples of org.opengis.feature.type.Name


        assertSame(Expression.NIL, attMapping.getSourceExpression());
        assertSame(Expression.NIL, attMapping.getIdentifierExpression());
        Map clientProperties = attMapping.getClientProperties();
        assertEquals(2, clientProperties.size());

        Name clientPropName = name(XLINK.NAMESPACE, "title");
        assertTrue("client property " + clientPropName + " not found", clientProperties
                .containsKey(clientPropName));
        clientPropName = name(XLINK.NAMESPACE, "href");
        assertTrue("client property " + clientPropName + " not found", clientProperties
                .containsKey(clientPropName));
View Full Code Here


    }

    @Test
    public void testDataStore() throws Exception {
        DataAccess<FeatureType, Feature> mappingDataStore;
        final Name typeName = new NameImpl(AWNS, "SiteSinglePhenomTimeSeries");
        {
            final Map dsParams = new HashMap();

            String configLocation = schemaBase + "TimeSeriesTest_properties.xml";
            final URL url = getClass().getResource(configLocation);
            // configLocation =
            // "file:/home/gabriel/svn/geoserver/trunk/configuration/community-schema-timeseries2/TimeSeriesTest_properties.xml";
            // URL url = new URL(configLocation);

            dsParams.put("dbtype", "app-schema");
            dsParams.put("url", url.toExternalForm());

            mappingDataStore = DataAccessFinder.getDataStore(dsParams);
        }
        assertNotNull(mappingDataStore);
        FeatureSource<FeatureType, Feature> fSource;
        {
            FeatureType fType = mappingDataStore.getSchema(typeName);
            assertNotNull(fType);
            fSource = mappingDataStore.getFeatureSource(typeName);
        }
        FeatureCollection features;
        // make a getFeatures request with a nested properties filter.
        //
        // was 96, but now 3 as mapped features are grouped by id
        final int EXPECTED_MAPPED_FEATURE_COUNT = 3;
        // 96 data rows from property file
        final int EXPECTED_SIMPLE_FEATURE_COUNT = 96;
        {
            features = fSource.getFeatures();

            int resultCount = getCount(features);
            String msg = "be sure difference in result count is not due to different dataset.";
            assertEquals(msg, EXPECTED_MAPPED_FEATURE_COUNT, resultCount);
        }

        Feature feature;
        int count = 0;

        FilterFactory ffac;
        {
            NamespaceSupport namespaces = new NamespaceSupport();
            namespaces.declarePrefix("aw", AWNS);
            namespaces.declarePrefix("om", OMNS);
            namespaces.declarePrefix("swe", SWENS);
            namespaces.declarePrefix("gml", GMLNS);
            namespaces.declarePrefix("sa", SANS);
            namespaces.declarePrefix("cv", CVNS);
            // TODO: use commonfactoryfinder or the mechanism choosed
            // to pass namespace context to filter factory
            ffac = new FilterFactoryImplNamespaceAware(namespaces);
        }

        final String phenomNamePath = "aw:relatedObservation/aw:PhenomenonTimeSeries/om:observedProperty/swe:Phenomenon/gml:name";
        FeatureIterator it = features.features();
        for (; it.hasNext();) {
            feature = (Feature) it.next();
            count++;
            {
                PropertyName gmlName = ffac.property("gml:name");
                PropertyName phenomName = ffac.property(phenomNamePath);

                Object nameVal = gmlName.evaluate(feature, String.class);
                assertNotNull("gml:name evaluated to null", nameVal);

                Object phenomNameVal = phenomName.evaluate(feature, String.class);
                assertNotNull(phenomNamePath + " evaluated to null", phenomNameVal);
            }
            {
                PropertyName sampledFeatureName = ffac.property("sa:sampledFeature");
                Attribute sampledFeatureVal = (Attribute) sampledFeatureName.evaluate(feature);
                assertNotNull("sa:sampledFeature evaluated to null", sampledFeatureVal);
                assertEquals(0, ((Collection) sampledFeatureVal.getValue()).size());
                Map attributes = (Map) sampledFeatureVal.getUserData().get(Attributes.class);
                assertNotNull(attributes);
                Name xlinkTitle = name(XLINK.NAMESPACE, "title");
                assertTrue(attributes.containsKey(xlinkTitle));
                assertNotNull(attributes.get(xlinkTitle));

                Name xlinkHref = name(XLINK.NAMESPACE, "href");
                assertTrue(attributes.containsKey(xlinkHref));
                assertNotNull(attributes.get(xlinkHref));
            }

            {
View Full Code Here

        AppSchemaFeatureTypeRegistry parsedTypes = new AppSchemaFeatureTypeRegistry();
       
        try {
            parsedTypes.addSchemas(schemaIndex);
   
            Name typeName = Types.typeName(NS_URI, "simpleFeatureType");
            AttributeType type = parsedTypes.getAttributeType(typeName);
            Assert.assertNotNull(type);
            Assert.assertTrue(type.getClass().getName(), type instanceof ComplexType);
            Assert.assertTrue(type.getUserData().get(XSDTypeDefinition.class) instanceof XSDComplexTypeDefinition);
   
            ComplexType ft = (ComplexType) type;
            String local = ft.getName().getLocalPart();
            String uri = ft.getName().getNamespaceURI();
            Assert.assertEquals("simpleFeatureType", local);
            Assert.assertEquals(NS_URI, uri);
   
            List<PropertyDescriptor> attributes = Arrays.asList(((ComplexFeatureTypeImpl) ft)
                    .getTypeDescriptors().toArray(new PropertyDescriptor[0]));
            Assert.assertEquals(8, attributes.size());
            AttributeDescriptor descriptor;
   
            descriptor = (AttributeDescriptor) attributes.get(5);
            Name name = Types.typeName(NS_URI, "the_geom");
            typeName = Types.typeName(GML.NAMESPACE, "GeometryPropertyType");
           
            // I do not think this is true anymore, as abstract geometry type
            // is an AttributeTypeImpl
            // assertTrue(descriptor.getType() instanceof GeometryType);
View Full Code Here

       
        AppSchemaFeatureTypeRegistry typeRegistry = new AppSchemaFeatureTypeRegistry();
        try {
            typeRegistry.addSchemas(schemaIndex);
           
            Name typeName = Types.typeName(NS_URI, "wq_plus_Type");
            AttributeType type = (AttributeType) typeRegistry.getAttributeType(typeName);
            Assert.assertTrue(type instanceof FeatureType);
            Assert.assertFalse(type instanceof SimpleFeatureType);
            Assert.assertEquals(typeName, type.getName());
            Assert.assertTrue(type.getUserData().get(XSDTypeDefinition.class) instanceof XSDComplexTypeDefinition);
   
            FeatureType wq_plus_Type = (FeatureType) type;
   
            // I do not think types have default geometries any more.
            // assertNotNull(wq_plus_Type.getDefaultGeometry());
            Assert.assertNotNull(wq_plus_Type.getSuper());
            typeName = Types.typeName(GML.NAMESPACE, GML.AbstractFeatureType.getLocalPart());
            Assert.assertEquals(typeName, wq_plus_Type.getSuper().getName());
            Assert.assertNotNull(wq_plus_Type.getDescriptors());
            Assert.assertEquals(8, ((ComplexFeatureTypeImpl) wq_plus_Type).getTypeDescriptors().size());
   
            Name name = Types.typeName(NS_URI, "wq_plus");
            AttributeDescriptor wqPlusDescriptor = typeRegistry.getDescriptor(name, null);
            Assert.assertNotNull(wqPlusDescriptor);
            Assert.assertEquals(name, wqPlusDescriptor.getName());
            Assert.assertSame(wq_plus_Type, wqPlusDescriptor.getType());
            Assert.assertTrue(wqPlusDescriptor.getUserData().get(XSDElementDeclaration.class) instanceof XSDElementDeclaration);
View Full Code Here

        AppSchemaFeatureTypeRegistry registry = new AppSchemaFeatureTypeRegistry();
        try {
            registry.addSchemas(schemaIndex);
   
            Name tcl = Types.typeName(NS_URI, "TypedCategoryListType");
            AttributeType typedCategoryListType = registry.getAttributeType(tcl);
            Assert.assertNotNull(typedCategoryListType);
            Assert.assertTrue(typedCategoryListType instanceof ComplexType);
   
            AttributeType superType = typedCategoryListType.getSuper();
            Assert.assertNotNull(superType);
            Name superName = superType.getName();
            Assert.assertEquals(XS.STRING.getNamespaceURI(), superName.getNamespaceURI());
            Assert.assertEquals(XS.STRING.getLocalPart(), superName.getLocalPart());
   
            Assert.assertNotNull(typedCategoryListType.getUserData().get(XSDTypeDefinition.class));
        }
        finally {
            registry.disposeSchemaIndexes();
View Full Code Here

     * @return
     * @throws Exception
     */
    public static FeatureTypeMapping createMappingsGroupByStation(MemoryDataStore simpleStore)
            throws Exception {
        Name sourceTypeName = WATERSAMPLE_TYPENAME;
        final FeatureSource<SimpleFeatureType, SimpleFeature> wsSource = simpleStore
                .getFeatureSource(sourceTypeName);

        FeatureType targetType = createComplexWaterQualityType();
        FeatureTypeFactory tf = new UniqueNameFeatureTypeFactoryImpl();
View Full Code Here

        AppSchemaFeatureTypeRegistry typeRegistry = new AppSchemaFeatureTypeRegistry();
        try {
            typeRegistry.addSchemas(schemaIndex);
   
            Name typeName = Types.typeName(GSMLNS, "MappedFeatureType");
            ComplexType mf = (ComplexType) typeRegistry.getAttributeType(typeName);
            assertNotNull(mf);
            assertTrue(mf instanceof FeatureType);
   
            typeName = Types.typeName("http://www.opengis.net/sampling/1.0", "SamplingFeatureType");
View Full Code Here

    }

    @Test
    public void testDataStore() throws Exception {
        try {
            final Name typeName = Types.typeName(GSMLNS, "MappedFeature");
            FeatureType boreholeType = mappingDataStore.getSchema(typeName);
            assertNotNull(boreholeType);

            FeatureSource fSource = (FeatureSource) mappingDataStore.getFeatureSource(typeName);
View Full Code Here

     *
     * @throws Exception
     */
    @Test
    public void testFeatureSourceHonoursQueryNamespace() throws Exception {
        final Name typeName = Types.typeName(GSMLNS, "MappedFeature");
        FeatureSource<FeatureType, Feature> source = mappingDataStore.getFeatureSource(typeName);
        DefaultQuery query = new DefaultQuery();
        query.setNamespace(new URI(typeName.getNamespaceURI()));
        query.setTypeName(typeName.getLocalPart());
        FeatureCollection<FeatureType, Feature> features = source.getFeatures(query);
        assertNotNull(features);
        assertEquals(2, size(features));
    }
View Full Code Here

                null);
        assertSame(driver, access.getDriver());

        // Checking proper coverage name
        final List<Name> names = access.getNames(null);
        final Name coverageName = names.get(0);
        assertEquals(1, names.size());
        assertEquals(TEST_NAME, coverageName);

        final CoverageSource source = access.access(TEST_NAME, null, AccessType.READ_ONLY, null,
                null);
View Full Code Here

TOP

Related Classes of org.opengis.feature.type.Name

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.