Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/query/FeatureSubset.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/query/FeatureSubset.java?rev=1831430&r1=1831428&r2=1831430&view=diff ============================================================================== --- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/query/FeatureSubset.java [UTF-8] (original) +++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/query/FeatureSubset.java [UTF-8] Fri May 11 16:10:59 2018 @@ -16,20 +16,15 @@ */ package org.apache.sis.internal.storage.query; -import java.util.List; import java.util.stream.Stream; import org.opengis.geometry.Envelope; -import org.apache.sis.internal.feature.FeatureUtilities; import org.apache.sis.internal.storage.AbstractFeatureSet; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.FeatureSet; // Branch-dependent imports -import org.opengis.feature.Feature; -import org.opengis.feature.FeatureType; -import org.opengis.filter.Filter; -import org.opengis.filter.sort.SortBy; -import org.opengis.filter.expression.Expression; +import org.apache.sis.feature.AbstractFeature; +import org.apache.sis.feature.DefaultFeatureType; /** @@ -59,7 +54,7 @@ final class FeatureSubset extends Abstra * The type of features in this set. May or may not be the same as {@link #source}. * This is computed when first needed. */ - private FeatureType resultType; + private DefaultFeatureType resultType; /** * Creates a new set of features by filtering the given set using the given query. @@ -82,7 +77,7 @@ final class FeatureSubset extends Abstra * Returns a description of properties that are common to all features in this dataset. */ @Override - public synchronized FeatureType getType() throws DataStoreException { + public synchronized DefaultFeatureType getType() throws DataStoreException { if (resultType == null) { resultType = query.expectedType(source.getType()); } @@ -93,22 +88,8 @@ final class FeatureSubset extends Abstra * Returns a stream of all features contained in this dataset. */ @Override - public Stream<Feature> features(final boolean parallel) throws DataStoreException { - Stream<Feature> stream = source.features(parallel); - /* - * Apply filter. - */ - final Filter filter = query.getFilter(); - if (!Filter.INCLUDE.equals(filter)) { - stream = stream.filter(filter::evaluate); - } - /* - * Apply sorting. - */ - final SortBy[] sortBy = query.getSortBy(); - if (sortBy.length > 0) { - stream = stream.sorted(new SortByComparator(sortBy)); - } + public Stream<AbstractFeature> features(final boolean parallel) throws DataStoreException { + Stream<AbstractFeature> stream = source.features(parallel); /* * Apply offset. */ @@ -123,25 +104,6 @@ final class FeatureSubset extends Abstra if (limit >= 0) { stream = stream.limit(limit); } - /* - * Transform feature instances. - */ - final List<SimpleQuery.Column> columns = query.getColumns(); - if (columns != null) { - final Expression[] expressions = new Expression[columns.size()]; - for (int i=0; i<expressions.length; i++) { - expressions[i] = columns.get(i).expression; - } - final FeatureType type = getType(); - final String[] names = FeatureUtilities.getNames(type.getProperties(false)); - stream = stream.map(t -> { - final Feature f = type.newInstance(); - for (int i=0; i < expressions.length; i++) { - f.setPropertyValue(names[i], expressions[i].evaluate(t)); - } - return f; - }); - } return stream; } }
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/query/SimpleQuery.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/query/SimpleQuery.java?rev=1831430&r1=1831428&r2=1831430&view=diff ============================================================================== --- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/query/SimpleQuery.java [UTF-8] (original) +++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/query/SimpleQuery.java [UTF-8] Fri May 11 16:10:59 2018 @@ -16,29 +16,12 @@ */ package org.apache.sis.internal.storage.query; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; -import org.opengis.util.GenericName; -import org.apache.sis.feature.builder.FeatureTypeBuilder; -import org.apache.sis.internal.feature.FeatureExpression; -import org.apache.sis.internal.util.UnmodifiableArrayList; import org.apache.sis.storage.FeatureSet; import org.apache.sis.storage.Query; import org.apache.sis.util.ArgumentChecks; -import org.apache.sis.util.Classes; -import org.apache.sis.util.Debug; -import org.apache.sis.util.iso.Names; -import org.apache.sis.util.resources.Errors; // Branch-dependent imports -import org.opengis.filter.Filter; -import org.opengis.filter.sort.SortBy; -import org.opengis.filter.expression.Expression; -import org.opengis.feature.FeatureType; -import org.opengis.feature.PropertyType; -import org.opengis.feature.AttributeType; -import org.opengis.feature.FeatureAssociationRole; +import org.apache.sis.feature.DefaultFeatureType; /** @@ -59,22 +42,6 @@ public class SimpleQuery extends Query { private static final long UNLIMITED = -1; /** - * The columns to retrieve, or {@code null} if all columns shall be included in the query. - * - * @see #getColumns() - * @see #setColumns(Column...) - */ - private Column[] columns; - - /** - * The filter for trimming feature instances. - * - * @see #getFilter() - * @see #setFilter(Filter) - */ - private Filter filter; - - /** * The number of records to skip from the beginning. * * @see #getOffset() @@ -93,72 +60,13 @@ public class SimpleQuery extends Query { private long limit; /** - * The expressions to use for sorting the feature instances. - * - * @see #getSortBy() - * @see #setSortBy(SortBy...) - */ - private SortBy[] sortBy; - - /** * Creates a new query retrieving no column and applying no filter. */ public SimpleQuery() { - filter = Filter.INCLUDE; - sortBy = SortBy.UNSORTED; limit = UNLIMITED; } /** - * Sets the columns to retrieve, or {@code null} if all columns shall be included in the query. - * A query column may use a simple or complex expression and an alias to create a new type of - * property in the returned features. - * This is equivalent to the column names in the {@code SELECT} clause of a SQL statement. - * - * @param columns columns to retrieve, or null to retrieve all properties. - */ - @SuppressWarnings("AssignmentToCollectionOrArrayFieldFromParameter") - public void setColumns(Column... columns) { - columns = columns.clone(); - for (int i=0; i<columns.length; i++) { - ArgumentChecks.ensureNonNullElement("columns", i, columns[i]); - } - this.columns = columns; - } - - /** - * Returns the columns to retrieve, or {@code null} if all columns shall be included in the query. - * This is the columns specified in the last call to {@link #setColumns(Column...)}. - * - * @return columns to retrieve, or null to retrieve all feature properties. - */ - public List<Column> getColumns() { - return UnmodifiableArrayList.wrap(columns); - } - - /** - * Sets a filter for trimming feature instances. - * Features that do not pass the filter are discarded. - * Discarded features are not counted for the {@linkplain #setLimit(long) query limit}. - * - * @param filter the filter, or {@link Filter#INCLUDE} if none. - */ - public void setFilter(final Filter filter) { - ArgumentChecks.ensureNonNull("filter", filter); - this.filter = filter; - } - - /** - * Returns the filter for trimming feature instances. - * This is the value specified in the last call to {@link #setFilter(Filter)}. - * - * @return the filter, or {@link Filter#INCLUDE} if none. - */ - public Filter getFilter() { - return filter; - } - - /** * Sets the number of records to skip from the beginning. * Offset and limit are often combined to obtain paging. * The offset can not be negative. @@ -210,156 +118,6 @@ public class SimpleQuery extends Query { } /** - * Sets the expressions to use for sorting the feature instances. - * {@code SortBy} objects are used to order the {@link org.opengis.feature.Feature} instances - * returned by the {@link org.apache.sis.storage.FeatureSet}. {@code SortBy} clauses are applied - * in declaration order, like SQL. - * - * @param sortBy expressions to use for sorting the feature instances. - */ - @SuppressWarnings("AssignmentToCollectionOrArrayFieldFromParameter") - public void setSortBy(SortBy... sortBy) { - if (sortBy == null || sortBy.length == 0) { - sortBy = SortBy.UNSORTED; - } else { - sortBy = sortBy.clone(); - for (int i=0; i < sortBy.length; i++) { - ArgumentChecks.ensureNonNullElement("sortBy", i, sortBy[i]); - } - } - this.sortBy = sortBy; - } - - /** - * Returns the expressions to use for sorting the feature instances. - * They are the values specified in the last call to {@link #setSortBy(SortBy...)}. - * - * @return expressions to use for sorting the feature instances, or an empty array if none. - */ - public SortBy[] getSortBy() { - return (sortBy.length == 0) ? SortBy.UNSORTED : sortBy.clone(); - } - - /** - * A property or expression to be retrieved by a {@code Query}, together with the name to assign to it. - * Columns can be given to the {@link SimpleQuery#setColumns(Column...)} method. - */ - public static class Column { - /** - * The literal, property name or more complex expression to be retrieved by a {@code Query}. - */ - public final Expression expression; - - /** - * The name to assign to the expression result, or {@code null} if unspecified. - */ - public final GenericName alias; - - /** - * Creates a new column with the given expression and no name. - * - * @param expression the literal, property name or expression to be retrieved by a {@code Query}. - */ - public Column(final Expression expression) { - ArgumentChecks.ensureNonNull("expression", expression); - this.expression = expression; - this.alias = null; - } - - /** - * Creates a new column with the given expression and the given name. - * - * @param expression the literal, property name or expression to be retrieved by a {@code Query}. - * @param alias the name to assign to the expression result, or {@code null} if unspecified. - */ - public Column(final Expression expression, final GenericName alias) { - ArgumentChecks.ensureNonNull("expression", expression); - this.expression = expression; - this.alias = alias; - } - - /** - * Creates a new column with the given expression and the given name. - * This constructor creates a {@link org.opengis.util.LocalName} from the given string. - * - * @param expression the literal, property name or expression to be retrieved by a {@code Query}. - * @param alias the name to assign to the expression result, or {@code null} if unspecified. - */ - public Column(final Expression expression, final String alias) { - ArgumentChecks.ensureNonNull("expression", expression); - this.expression = expression; - this.alias = (alias != null) ? Names.createLocalName(null, null, alias) : null; - } - - /** - * Returns the expected property type for this column. - * - * @see SimpleQuery#expectedType(FeatureType) - */ - final PropertyType expectedType(final FeatureType type) { - PropertyType resultType; - if (expression instanceof FeatureExpression) { - resultType = ((FeatureExpression) expression).expectedType(type); - } else { - // TODO: remove this hack if we can get more type-safe Expression. - resultType = expression.evaluate(type, PropertyType.class); - } - if (alias != null && !alias.equals(resultType.getName())) { - // Rename the result type. - resultType = new FeatureTypeBuilder().addProperty(resultType).setName(alias).build(); - if (!(resultType instanceof AttributeType<?>) && !(resultType instanceof FeatureAssociationRole)) { - throw new IllegalArgumentException(Errors.format(Errors.Keys.IllegalPropertyValueClass_3, - alias, AttributeType.class, Classes.getStandardType(Classes.getClass(resultType)))); - } - } - return resultType; - } - - /** - * Returns a hash code value for this column. - * - * @return a hash code value. - */ - @Override - public int hashCode() { - return 37 * expression.hashCode() + Objects.hashCode(alias); - } - - /** - * Compares this column with the given object for equality. - * - * @param obj the object to compare with this column. - * @return whether the two objects are equal. - */ - @Override - public boolean equals(final Object obj) { - if (obj == this) { - return true; - } - if (obj != null && getClass() == obj.getClass()) { - final Column other = (Column) obj; - return expression.equals(other.expression) && Objects.equals(alias, other.alias); - } - return false; - } - - /** - * Returns a string representation of this column for debugging purpose. - * - * @return a string representation of this column. - */ - @Debug - @Override - public String toString() { - final StringBuilder b = new StringBuilder(getClass().getSimpleName()).append('['); - if (alias != null) { - b.append('"').append(alias).append('"'); - } - return b.append(']').toString(); - } - } - - /** * Applies this query on the given feature set. The default implementation executes the query using the default * {@link java.util.stream.Stream} methods. Queries executed by this method may not benefit from accelerations * provided for example by databases. This method should be used only as a fallback when the query can not be @@ -379,15 +137,8 @@ public class SimpleQuery extends Query { /** * Returns the expected property type for this query executed on features of the given type. */ - final FeatureType expectedType(final FeatureType source) { - if (columns == null) { - return source; // All columns included: result is of the same type. - } - final FeatureTypeBuilder ftb = new FeatureTypeBuilder().setName(source.getName()); - for (final Column col : columns) { - ftb.addProperty(col.expectedType(source)); - } - return ftb.build(); + final DefaultFeatureType expectedType(final DefaultFeatureType source) { + return source; // More developped code in JDK8 branch. } /** @@ -397,8 +148,7 @@ public class SimpleQuery extends Query { */ @Override public int hashCode() { - return 97 * Arrays.hashCode(columns) + 31 * filter.hashCode() - + 7 * Arrays.hashCode(sortBy) + Long.hashCode(limit ^ skip); + return Long.hashCode(limit ^ skip); } /** @@ -415,10 +165,7 @@ public class SimpleQuery extends Query { if (obj != null && getClass() == obj.getClass()) { final SimpleQuery other = (SimpleQuery) obj; return skip == other.skip && - limit == other.limit && - filter.equals(other.filter) && - Arrays.equals(columns, other.columns) && - Arrays.equals(sortBy, other.sortBy); + limit == other.limit; } return true; } Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataSet.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataSet.java?rev=1831430&r1=1831429&r2=1831430&view=diff ============================================================================== --- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataSet.java [UTF-8] (original) +++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataSet.java [UTF-8] Fri May 11 16:10:59 2018 @@ -67,7 +67,7 @@ public interface DataSet extends Resourc * If this resource uses many different CRS with none of them covering all data, then the envelope should use a * global system (typically a {@linkplain org.apache.sis.referencing.crs.DefaultGeocentricCRS geographic CRS}). * - * @return the spatio-temporal resource extent. Should not be {@code null}. + * @return the spatio-temporal resource extent. Should not be {@code null} (but may happen if too costly to compute). * @throws DataStoreException if an error occurred while reading or computing the envelope. */ Envelope getEnvelope() throws DataStoreException; Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSet.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSet.java?rev=1831430&r1=1831429&r2=1831430&view=diff ============================================================================== --- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSet.java [UTF-8] (original) +++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSet.java [UTF-8] Fri May 11 16:10:59 2018 @@ -17,6 +17,7 @@ package org.apache.sis.storage; import java.util.stream.Stream; +import org.apache.sis.util.ArgumentChecks; // Branch-dependent imports import org.apache.sis.feature.AbstractFeature; @@ -71,7 +72,7 @@ public interface FeatureSet extends Data DefaultFeatureType getType() throws DataStoreException; /** - * Requests a subset of features and feature properties from this resource. + * Requests a subset of features and/or feature properties from this resource. * The filtering can be applied in two domains: * * <ul> @@ -101,6 +102,7 @@ public interface FeatureSet extends Data * @throws DataStoreException if another error occurred while processing the query. */ default FeatureSet subset(Query query) throws UnsupportedQueryException, DataStoreException { + ArgumentChecks.ensureNonNull("query", query); throw new UnsupportedQueryException(); } Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/Query.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/Query.java?rev=1831430&r1=1831429&r2=1831430&view=diff ============================================================================== --- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/Query.java [UTF-8] (original) +++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/Query.java [UTF-8] Fri May 11 16:10:59 2018 @@ -31,24 +31,36 @@ package org.apache.sis.storage; * <code>{@linkplain java.util.function.Predicate}<Feature></code> * while the second domain is equivalent to using * <code>{@linkplain java.util.function.UnaryOperator}<Feature></code>. - * It is technically possible to use {@code Query} for performing more generic feature transformations, + * + * <div class="note"><b>Note:</b> + * it is technically possible to use {@code Query} for performing more generic feature transformations, * for example inserting new properties computed from other properties, but such {@code Query} usages * should be rare since transformations (or more generic processing) are the topic of another package. * Queries are rather descriptive objects used by {@link FeatureSet} to optimize search operations - * as much as possible on the resource, using for example caches and indexes. + * as much as possible on the resource, using for example caches and indexes.</div> * - * <p>Compared to the SQL language, {@code Query} contains the information in the {@code SELECT} and + * Compared to the SQL language, {@code Query} contains the information in the {@code SELECT} and * {@code WHERE} clauses of a SQL statement. A {@code Query} typically contains filtering capabilities - * and (sometime) simple attribute transformations. Well known query languages include SQL and CQL.</p> + * and (sometime) simple attribute transformations. Well known query languages include SQL and CQL. * * @author Johann Sorel (Geomatys) - * @version 0.8 + * @version 1.0 * * @see FeatureSet#subset(Query) * * @since 0.8 * @module */ -public interface Query { +public abstract class Query { + /* + * Current version does not yet contain any field. But some fields may be added in the future. + * For example some methods from org.apache.sis.internal.storage.query.SimpleQuery may move here. + * We use an abstract class instead than an interface for that reason. + */ + /** + * Creates a new, initially empty, query. + */ + protected Query() { + } } Modified: sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/query/SimpleQueryTest.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/query/SimpleQueryTest.java?rev=1831430&r1=1831428&r2=1831430&view=diff ============================================================================== --- sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/query/SimpleQueryTest.java [UTF-8] (original) +++ sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/query/SimpleQueryTest.java [UTF-8] Fri May 11 16:10:59 2018 @@ -20,24 +20,17 @@ import java.util.List; import java.util.Arrays; import java.util.stream.Collectors; import org.apache.sis.feature.builder.FeatureTypeBuilder; -import org.apache.sis.filter.DefaultFilterFactory; import org.apache.sis.internal.storage.MemoryFeatureSet; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.FeatureSet; -import org.apache.sis.test.TestUtilities; import org.apache.sis.test.TestCase; import org.junit.Test; import static org.junit.Assert.*; // Branch-dependent imports -import org.opengis.feature.Feature; -import org.opengis.feature.FeatureType; -import org.opengis.feature.PropertyType; -import org.opengis.feature.AttributeType; -import org.opengis.filter.Filter; -import org.opengis.filter.MatchAction; -import org.opengis.filter.sort.SortOrder; +import org.apache.sis.feature.AbstractFeature; +import org.apache.sis.feature.DefaultFeatureType; /** @@ -52,7 +45,7 @@ public final strictfp class SimpleQueryT /** * An arbitrary amount of features, all of the same type. */ - private final Feature[] features; + private final AbstractFeature[] features; /** * The {@link #features} array wrapped in a in-memory feature set. @@ -72,8 +65,8 @@ public final strictfp class SimpleQueryT ftb.setName("Test"); ftb.addAttribute(Integer.class).setName("value1"); ftb.addAttribute(Integer.class).setName("value2"); - final FeatureType type = ftb.build(); - features = new Feature[] { + final DefaultFeatureType type = ftb.build(); + features = new AbstractFeature[] { feature(type, 3, 1), feature(type, 2, 2), feature(type, 2, 1), @@ -84,8 +77,8 @@ public final strictfp class SimpleQueryT query = new SimpleQuery(); } - private static Feature feature(final FeatureType type, final int value1, final int value2) { - final Feature f = type.newInstance(); + private static AbstractFeature feature(final DefaultFeatureType type, final int value1, final int value2) { + final AbstractFeature f = type.newInstance(); f.setPropertyValue("value1", value1); f.setPropertyValue("value2", value2); return f; @@ -99,11 +92,11 @@ public final strictfp class SimpleQueryT */ private void verifyQueryResult(final int... indices) throws DataStoreException { final FeatureSet fs = query.execute(featureSet); - final List<Feature> result = fs.features(false).collect(Collectors.toList()); + final List<AbstractFeature> result = fs.features(false).collect(Collectors.toList()); assertEquals("size", indices.length, result.size()); for (int i=0; i<indices.length; i++) { - final Feature expected = features[indices[i]]; - final Feature actual = result.get(i); + final AbstractFeature expected = features[indices[i]]; + final AbstractFeature actual = result.get(i); if (!expected.equals(actual)) { fail(String.format("Unexpected feature at index %d%n" + "Expected:%n%s%n" @@ -133,65 +126,4 @@ public final strictfp class SimpleQueryT query.setOffset(2); verifyQueryResult(2, 3, 4); } - - /** - * Verifies the effect of {@link SimpleQuery#setSortBy(SortBy...)}. - * - * @throws DataStoreException if an error occurred while executing the query. - */ - @Test - public void testSortBy() throws DataStoreException { - final DefaultFilterFactory factory = new DefaultFilterFactory(); - query.setSortBy(factory.sort("value1", SortOrder.ASCENDING), - factory.sort("value2", SortOrder.DESCENDING)); - verifyQueryResult(3, 1, 2, 0, 4); - } - - /** - * Verifies the effect of {@link SimpleQuery#setFilter(Filter)}. - * - * @throws DataStoreException if an error occurred while executing the query. - */ - @Test - public void testFilter() throws DataStoreException { - final DefaultFilterFactory factory = new DefaultFilterFactory(); - query.setFilter(factory.equal(factory.property("value1"), factory.literal(2), true, MatchAction.ALL)); - verifyQueryResult(1, 2); - } - - /** - * Verifies the effect of {@link SimpleQuery#setColumns(SimpleQuery.Column...)}. - * - * @throws DataStoreException if an error occurred while executing the query. - */ - @Test - public void testColumns() throws DataStoreException { - final DefaultFilterFactory factory = new DefaultFilterFactory(); - query.setColumns(new SimpleQuery.Column(factory.property("value1"), (String) null), - new SimpleQuery.Column(factory.property("value1"), "renamed1"), - new SimpleQuery.Column(factory.literal("a literal"), "computed")); - query.setLimit(1); - - final FeatureSet fs = query.execute(featureSet); - final Feature result = TestUtilities.getSingleton(fs.features(false).collect(Collectors.toList())); - - // Check result type. - final FeatureType resultType = result.getType(); - assertEquals("Test", resultType.getName().toString()); - assertEquals(3, resultType.getProperties(true).size()); - final PropertyType pt1 = resultType.getProperty("value1"); - final PropertyType pt2 = resultType.getProperty("renamed1"); - final PropertyType pt3 = resultType.getProperty("computed"); - assertTrue(pt1 instanceof AttributeType); - assertTrue(pt2 instanceof AttributeType); - assertTrue(pt3 instanceof AttributeType); - assertEquals(Integer.class, ((AttributeType) pt1).getValueClass()); - assertEquals(Integer.class, ((AttributeType) pt2).getValueClass()); - assertEquals(String.class, ((AttributeType) pt3).getValueClass()); - - // Check feature. - assertEquals(3, result.getPropertyValue("value1")); - assertEquals(3, result.getPropertyValue("renamed1")); - assertEquals("a literal", result.getPropertyValue("computed")); - } } Modified: sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java?rev=1831430&r1=1831429&r2=1831430&view=diff ============================================================================== --- sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java [UTF-8] (original) +++ sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java [UTF-8] Fri May 11 16:10:59 2018 @@ -25,7 +25,7 @@ import org.junit.BeforeClass; * All tests from the {@code sis-storage} module, in approximative dependency order. * * @author Martin Desruisseaux (Geomatys) - * @version 0.8 + * @version 1.0 * @since 0.3 * @module */ @@ -42,6 +42,7 @@ import org.junit.BeforeClass; org.apache.sis.storage.FeatureNamingTest.class, org.apache.sis.storage.ProbeResultTest.class, org.apache.sis.storage.StorageConnectorTest.class, + org.apache.sis.internal.storage.query.SimpleQueryTest.class, org.apache.sis.internal.storage.xml.MimeTypeDetectorTest.class, org.apache.sis.internal.storage.xml.StoreProviderTest.class, org.apache.sis.internal.storage.xml.StoreTest.class, Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/GroupAsPolylineOperation.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/GroupAsPolylineOperation.java?rev=1831430&r1=1831429&r2=1831430&view=diff ============================================================================== --- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/GroupAsPolylineOperation.java [UTF-8] (original) +++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/GroupAsPolylineOperation.java [UTF-8] Fri May 11 16:10:59 2018 @@ -187,7 +187,7 @@ final class GroupAsPolylineOperation ext } @Override public Object next() { - return ((AbstractFeature) it.next()).getPropertyValue("sis:geometry"); + return ((AbstractFeature) it.next()).getPropertyValue(AttributeConvention.GEOMETRY); } }); geometry = getType().getValueClass().cast(geom); Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Reader.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Reader.java?rev=1831430&r1=1831429&r2=1831430&view=diff ============================================================================== --- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Reader.java [UTF-8] (original) +++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Reader.java [UTF-8] Fri May 11 16:10:59 2018 @@ -30,6 +30,7 @@ import javax.xml.bind.JAXBException; import org.apache.sis.storage.gps.Fix; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.DataStoreContentException; +import org.apache.sis.internal.feature.AttributeConvention; import org.apache.sis.internal.storage.xml.stream.StaxStreamReader; import org.apache.sis.util.collection.BackingStoreException; import org.apache.sis.util.resources.Errors; @@ -55,7 +56,7 @@ import org.apache.sis.feature.AbstractFe * * @author Johann Sorel (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.8 + * @version 1.0 * @since 0.8 * @module */ @@ -409,8 +410,8 @@ parse: while (reader.hasNext()) { } final Types types = ((Store) owner).types; final AbstractFeature feature = types.wayPoint.newInstance(); - feature.setPropertyValue("sis:identifier", index); - feature.setPropertyValue("sis:geometry", types.geometries.createPoint(parseDouble(lon), parseDouble(lat))); + feature.setPropertyValue(AttributeConvention.IDENTIFIER, index); + feature.setPropertyValue(AttributeConvention.GEOMETRY, types.geometries.createPoint(parseDouble(lon), parseDouble(lat))); List<Link> links = null; while (true) { /* @@ -474,7 +475,7 @@ parse: while (reader.hasNext()) { private AbstractFeature parseRoute(final int index) throws Exception { assert reader.isStartElement() && Tags.ROUTES.equals(reader.getLocalName()); final AbstractFeature feature = ((Store) owner).types.route.newInstance(); - feature.setPropertyValue("sis:identifier", index); + feature.setPropertyValue(AttributeConvention.IDENTIFIER, index); List<AbstractFeature> wayPoints = null; List<Link> links = null; while (true) { @@ -530,7 +531,7 @@ parse: while (reader.hasNext()) { private AbstractFeature parseTrackSegment(final int index) throws Exception { assert reader.isStartElement() && Tags.TRACK_SEGMENTS.equals(reader.getLocalName()); final AbstractFeature feature = ((Store) owner).types.trackSegment.newInstance(); - feature.setPropertyValue("sis:identifier", index); + feature.setPropertyValue(AttributeConvention.IDENTIFIER, index); List<AbstractFeature> wayPoints = null; while (true) { /* @@ -573,7 +574,7 @@ parse: while (reader.hasNext()) { private AbstractFeature parseTrack(final int index) throws Exception { assert reader.isStartElement() && Tags.TRACKS.equals(reader.getLocalName()); final AbstractFeature feature = ((Store) owner).types.track.newInstance(); - feature.setPropertyValue("sis:identifier", index); + feature.setPropertyValue(AttributeConvention.IDENTIFIER, index); List<AbstractFeature> segments = null; List<Link> links = null; while (true) { Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Writer.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Writer.java?rev=1831430&r1=1831429&r2=1831430&view=diff ============================================================================== --- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Writer.java [UTF-8] (original) +++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Writer.java [UTF-8] Fri May 11 16:10:59 2018 @@ -24,6 +24,7 @@ import org.apache.sis.storage.gps.Fix; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.IllegalFeatureTypeException; import org.apache.sis.internal.storage.xml.stream.StaxStreamWriter; +import org.apache.sis.internal.feature.AttributeConvention; import org.apache.sis.internal.feature.Geometries; import org.apache.sis.util.Version; @@ -191,7 +192,7 @@ final class Writer extends StaxStreamWri */ private void writeWayPoint(final AbstractFeature feature, final String tagName) throws XMLStreamException, JAXBException { if (feature != null) { - final double[] pt = Geometries.getCoordinate(feature.getPropertyValue("sis:geometry")); + final double[] pt = Geometries.getCoordinate(feature.getPropertyValue(AttributeConvention.GEOMETRY)); if (pt != null && pt.length >= 2) { writer.writeStartElement(tagName); writer.writeAttribute(Attributes.LATITUDE, Double.toString(pt[1]));
