@Test public void testComposeQueryWithTimeRange() throws ParseException { final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap = new HashMap<>(); final FeatureTimeRangeStatistics startStats = new FeatureTimeRangeStatistics("start"); statsMap.put( VectorStatisticsQueryBuilder.newBuilder().factory().timeRange().fieldName( "start").build().getId(), startStats); final FeatureTimeRangeStatistics endStats = new FeatureTimeRangeStatistics("end"); statsMap.put( VectorStatisticsQueryBuilder.newBuilder().factory().timeRange().fieldName( "end").build().getId(), endStats); final Date statsStart1 = DateUtilities.parseISO("2005-05-18T20:32:56Z"); final Date statsStart2 = DateUtilities.parseISO("2005-05-20T20:32:56Z"); final Date statsEnd1 = DateUtilities.parseISO("2005-05-21T20:32:56Z"); final Date statsEnd2 = DateUtilities.parseISO("2005-05-24T20:32:56Z"); final SimpleFeature firstRangFeature = createFeature(statsStart1, statsEnd1); startStats.entryIngested(firstRangFeature); endStats.entryIngested(firstRangFeature); final SimpleFeature secondRangFeature = createFeature(statsStart2, statsEnd2); startStats.entryIngested(secondRangFeature); endStats.entryIngested(secondRangFeature); final Date stime = DateUtilities.parseISO("2005-05-18T20:32:56Z"); final Date etime = DateUtilities.parseISO("2005-05-19T20:32:56Z"); final TemporalConstraintsSet constraintsSet = new TemporalConstraintsSet(); constraintsSet.getConstraintsForRange("start", "end").add(new TemporalRange(stime, etime)); final BasicQueryByClass query = new BasicQueryByClass( QueryIndexHelper.composeConstraints( rangeType, rangeTimeDescriptors, statsMap, factory.toGeometry( factory.createPoint(new Coordinate(27.25, 41.25)).getEnvelopeInternal()), constraintsSet)); final List<MultiDimensionalNumericData> nd = query.getIndexConstraints(SPATIAL_TEMPORAL_INDEX); assertEquals(stime.getTime(), (long) nd.get(0).getDataPerDimension()[2].getMin()); assertEquals(etime.getTime(), (long) nd.get(0).getDataPerDimension()[2].getMax()); final BasicQueryByClass query1 = new BasicQueryByClass( QueryIndexHelper.composeConstraints( rangeType, rangeTimeDescriptors, statsMap, factory.toGeometry( factory.createPoint(new Coordinate(27.25, 41.25)).getEnvelopeInternal()), null)); final List<MultiDimensionalNumericData> nd1 = query1.getIndexConstraints(SPATIAL_TEMPORAL_INDEX); assertEquals(statsStart1.getTime(), (long) nd1.get(0).getDataPerDimension()[2].getMin()); assertEquals(statsEnd2.getTime(), (long) nd1.get(0).getDataPerDimension()[2].getMax()); }
public static ConstraintsByClass composeConstraints( final SimpleFeatureType featureType, final TimeDescriptors timeDescriptors, final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap, final Geometry jtsBounds, final TemporalConstraintsSet timeBoundsSet) { final ConstraintsByClass timeConstraints = composeTimeConstraints(featureType, timeDescriptors, statsMap, timeBoundsSet); final GeoConstraintsWrapper geoConstraints = composeGeometricConstraints(featureType, jtsBounds); return timeConstraints.merge(geoConstraints.getConstraints()); }
QueryIndexHelper { public static ConstraintsByClass composeConstraints( final SimpleFeatureType featureType, final TimeDescriptors timeDescriptors, final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap, final Geometry jtsBounds, final TemporalConstraintsSet timeBoundsSet) { final ConstraintsByClass timeConstraints = composeTimeConstraints(featureType, timeDescriptors, statsMap, timeBoundsSet); final GeoConstraintsWrapper geoConstraints = composeGeometricConstraints(featureType, jtsBounds); return timeConstraints.merge(geoConstraints.getConstraints()); } }
QueryIndexHelper { public static ConstraintsByClass composeConstraints( final SimpleFeatureType featureType, final TimeDescriptors timeDescriptors, final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap, final Geometry jtsBounds, final TemporalConstraintsSet timeBoundsSet) { final ConstraintsByClass timeConstraints = composeTimeConstraints(featureType, timeDescriptors, statsMap, timeBoundsSet); final GeoConstraintsWrapper geoConstraints = composeGeometricConstraints(featureType, jtsBounds); return timeConstraints.merge(geoConstraints.getConstraints()); }  }
QueryIndexHelper { public static ConstraintsByClass composeConstraints( final SimpleFeatureType featureType, final TimeDescriptors timeDescriptors, final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap, final Geometry jtsBounds, final TemporalConstraintsSet timeBoundsSet) { final ConstraintsByClass timeConstraints = composeTimeConstraints(featureType, timeDescriptors, statsMap, timeBoundsSet); final GeoConstraintsWrapper geoConstraints = composeGeometricConstraints(featureType, jtsBounds); return timeConstraints.merge(geoConstraints.getConstraints()); }  static TemporalConstraintsSet clipIndexedTemporalConstraints(
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap,
      final TimeDescriptors timeDescriptors,
      final TemporalConstraintsSet constraintsSet); static Geometry clipIndexedBBOXConstraints(
      final SimpleFeatureType featureType,
      final Geometry bbox,
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap); static ConstraintSet getTimeConstraintsFromIndex(
      final TimeDescriptors timeDescriptors,
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> stats); static ConstraintSet getBBOXIndexConstraintsFromIndex(
      final SimpleFeatureType featureType,
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap); static ConstraintsByClass composeTimeConstraints(
      final SimpleFeatureType featureType,
      final TimeDescriptors timeDescriptors,
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap,
      final TemporalConstraintsSet timeBoundsSet); static ConstraintsByClass composeTimeBoundedConstraints(
      final SimpleFeatureType featureType,
      final TimeDescriptors timeDescriptors,
      final TemporalConstraintsSet timeBoundsSet); static GeoConstraintsWrapper composeGeometricConstraints(
      final SimpleFeatureType featureType,
      final Geometry jtsBounds); static ConstraintsByClass composeConstraints(
      final SimpleFeatureType featureType,
      final TimeDescriptors timeDescriptors,
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap,
      final Geometry jtsBounds,
      final TemporalConstraintsSet timeBoundsSet); }
QueryIndexHelper { public static ConstraintsByClass composeConstraints( final SimpleFeatureType featureType, final TimeDescriptors timeDescriptors, final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap, final Geometry jtsBounds, final TemporalConstraintsSet timeBoundsSet) { final ConstraintsByClass timeConstraints = composeTimeConstraints(featureType, timeDescriptors, statsMap, timeBoundsSet); final GeoConstraintsWrapper geoConstraints = composeGeometricConstraints(featureType, jtsBounds); return timeConstraints.merge(geoConstraints.getConstraints()); }  static TemporalConstraintsSet clipIndexedTemporalConstraints(
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap,
      final TimeDescriptors timeDescriptors,
      final TemporalConstraintsSet constraintsSet); static Geometry clipIndexedBBOXConstraints(
      final SimpleFeatureType featureType,
      final Geometry bbox,
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap); static ConstraintSet getTimeConstraintsFromIndex(
      final TimeDescriptors timeDescriptors,
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> stats); static ConstraintSet getBBOXIndexConstraintsFromIndex(
      final SimpleFeatureType featureType,
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap); static ConstraintsByClass composeTimeConstraints(
      final SimpleFeatureType featureType,
      final TimeDescriptors timeDescriptors,
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap,
      final TemporalConstraintsSet timeBoundsSet); static ConstraintsByClass composeTimeBoundedConstraints(
      final SimpleFeatureType featureType,
      final TimeDescriptors timeDescriptors,
      final TemporalConstraintsSet timeBoundsSet); static GeoConstraintsWrapper composeGeometricConstraints(
      final SimpleFeatureType featureType,
      final Geometry jtsBounds); static ConstraintsByClass composeConstraints(
      final SimpleFeatureType featureType,
      final TimeDescriptors timeDescriptors,
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap,
      final Geometry jtsBounds,
      final TemporalConstraintsSet timeBoundsSet);  }