org.locationtech.geowave.core.store.api.DataStore.query()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(210)

本文整理了Java中org.locationtech.geowave.core.store.api.DataStore.query()方法的一些代码示例,展示了DataStore.query()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataStore.query()方法的具体详情如下:
包路径:org.locationtech.geowave.core.store.api.DataStore
类名称:DataStore
方法名:query

DataStore.query介绍

[英]Returns all data in this data store that matches the query parameter. All data that matches the query will be returned as an instance of the native data type. The Iterator must be closed when it is no longer needed - this wraps the underlying scanner implementation and closes underlying resources.
[中]返回此数据存储中与查询参数匹配的所有数据。与查询匹配的所有数据都将作为本机数据类型的实例返回。当不再需要迭代器时,必须关闭迭代器-这将包装底层扫描程序实现并关闭底层资源。

代码示例

代码示例来源:origin: locationtech/geowave

@Override
 protected long runQuery(
   final GeotoolsFeatureDataAdapter adapter,
   final String typeName,
   final String indexName,
   final DataStore dataStore,
   final boolean debug,
   DataStorePluginOptions pluginOptions) {
  long count = 0;
  try (final CloseableIterator<Object> it =
    dataStore.query(
      QueryBuilder.newBuilder().addTypeName(typeName).indexName(indexName).build())) {
   while (it.hasNext()) {
    if (debug) {
     System.out.println(it.next());
    } else {
     it.next();
    }
    count++;
   }
  }
  return count;
 }
}

代码示例来源:origin: locationtech/geowave

private static void executeCQLQuery() throws IOException, CQLException {
 System.out.println("Executing query, expecting to match two points...");
 final VectorQueryBuilder bldr = VectorQueryBuilder.newBuilder();
 try (final CloseableIterator<SimpleFeature> iterator =
   dataStore.query(
     bldr.indexName(index.getName()).addTypeName(ADAPTER.getTypeName()).constraints(
       bldr.constraintsFactory().cqlConstraints(
         "BBOX(geometry,-77.6167,38.6833,-76.6,38.9200) and locationName like 'W%'")).build())) {
  while (iterator.hasNext()) {
   System.out.println("Query match: " + iterator.next().getID());
  }
 }
}

代码示例来源:origin: locationtech/geowave

@Override
 protected long runQuery(
   final GeotoolsFeatureDataAdapter adapter,
   final String typeName,
   final String indexName,
   final DataStore dataStore,
   final boolean debug,
   DataStorePluginOptions pluginOptions) {
  getFilter();

  long count = 0;
  try (final CloseableIterator<Object> it =
    dataStore.query(
      QueryBuilder.newBuilder().addTypeName(typeName).indexName(indexName).build())) {
   while (it.hasNext()) {
    final Object o = it.next();
    if (o instanceof SimpleFeature) {
     if (filter.evaluate(o)) {
      if (debug) {
       System.out.println(o);
      }
      count++;
     }
    }
   }
  }
  return count;
 }
}

代码示例来源:origin: locationtech/geowave

protected long delete(
  final GeotoolsFeatureDataAdapter adapter,
  final String typeName,
  final String indexName,
  final DataStore dataStore,
  final boolean debug) {
 long missed = 0;
 final VectorQueryBuilder bldr = VectorQueryBuilder.newBuilder();
 final Query<SimpleFeature> query =
   bldr.addTypeName(typeName).indexName(indexName).constraints(
     bldr.constraintsFactory().cqlConstraints(cqlStr)).build();
 final boolean success = dataStore.delete(query);
 if (debug) {
  LOGGER.debug("CQL Delete " + (success ? "Success" : "Failure"));
 }
 // Verify delete by running the CQL query
 if (debug) {
  try (final CloseableIterator<SimpleFeature> it = dataStore.query(query)) {
   while (it.hasNext()) {
    it.next();
    missed++;
   }
  }
 }
 return missed;
}

代码示例来源:origin: locationtech/geowave

outputStoreOptions.createDataStore().query(
  QueryBuilder.newBuilder().addTypeName(
    rasterResizeOptions.getOutputCoverageName()).indexName(index.getName()).build());

代码示例来源:origin: locationtech/geowave

String typeName = dataAdapter.getTypeName();
try (CloseableIterator<?> it =
  store.query(QueryBuilder.newBuilder().addTypeName(typeName).limit(1).build())) {
 if (!it.hasNext()) {
  if (adapterStore == null) {

代码示例来源:origin: locationtech/geowave

dataStore.query(
  bldr.addTypeName(typeName).indexName("SPATIAL_IDX").addAuthorization(
    "root").constraints(

代码示例来源:origin: locationtech/geowave

private CloseableIterator<GridCoverage> queryForTiles(
  final RasterDataAdapter adapter,
  final QueryConstraints query,
  final double[] targetResolutionPerDimension) {
 final AdapterToIndexMapping adapterIndexMapping =
   geowaveAdapterIndexMappingStore.getIndicesForAdapter(getAdapterId(adapter.getTypeName()));
 final Index[] indices = adapterIndexMapping.getIndices(geowaveIndexStore);
 // just work on the first spatial only index that contains this adapter
 // ID
 // TODO consider the best strategy for handling temporal queries here
 for (final Index rasterIndex : indices) {
  if (SpatialDimensionalityTypeProvider.isSpatial(rasterIndex)) {
   return (CloseableIterator) geowaveDataStore.query(
     QueryBuilder.newBuilder().setAuthorizations(
       authorizationSPI.getAuthorizations()).addTypeName(
         adapter.getTypeName()).constraints(query).addHint(
           DataStoreUtils.TARGET_RESOLUTION_PER_DIMENSION_FOR_HIERARCHICAL_INDEX,
           targetResolutionPerDimension).build());
  }
 }
 return new Wrapper(Collections.emptyIterator());
}

代码示例来源:origin: locationtech/geowave

dataStore.query(
  bldr.addTypeName(typeName).indexName("SPATIAL_IDX").addAuthorization(
    "root").constraints(

代码示例来源:origin: locationtech/geowave

dataStore.query(
  bldr.constraints(
    bldr.constraintsFactory().spatialTemporalConstraints().spatialConstraints(

代码示例来源:origin: locationtech/geowave

dataStore.query(bldr.constraints(bldr.constraintsFactory().cqlConstraints(cql)).build())) {

代码示例来源:origin: locationtech/geowave

pixelSize);
 bldr = bldr.addHint(DataStoreUtils.MAX_RESOLUTION_SUBSAMPLING_PER_DIMENSION, spans);
 return components.getDataStore().query(bldr.build());
} catch (final TransformException e) {
 throw new IllegalArgumentException("Unable to compute generalization distance", e);

代码示例来源:origin: locationtech/geowave

dataStore.query(
    bldr.constraints(
      bldr.constraintsFactory().spatialTemporalConstraints().addTimeRange(
bldr = VectorQueryBuilder.newBuilder();
final CloseableIterator<SimpleFeature> iterator2 =
  dataStore.query(
    bldr.addTypeName(adapter.getTypeName()).indexName(index.getName()).constraints(
      bldr.constraintsFactory().spatialTemporalConstraints().addTimeRange(

代码示例来源:origin: locationtech/geowave

dataStore.query(bldr.constraints(stBldr.build()).build())) {
while (iterator.hasNext()) {
 final SimpleFeature simpleFeature = iterator.next();

代码示例来源:origin: locationtech/geowave

dataStore.query(
   bldr.constraints(bldr.constraintsFactory().cqlConstraints(cqlStr)).build())) {
while (it.hasNext()) {

代码示例来源:origin: locationtech/geowave

@Override
public CloseableIterator<SimpleFeature> query(final Index index, final BasicQuery query) {
 VectorQueryBuilder bldr =
   VectorQueryBuilder.newBuilder().addTypeName(
     components.getAdapter().getTypeName()).indexName(index.getName()).setAuthorizations(
       transaction.composeAuthorizations()).constraints(
         OptimalCQLQuery.createOptimalQuery(
           filter,
           components.getAdapter(),
           index,
           query));
 if (limit != null) {
  bldr = bldr.limit(limit);
 }
 if (subsetRequested()) {
  bldr = bldr.subsetFields(components.getAdapter().getTypeName(), getSubset());
 }
 return components.getDataStore().query(bldr.build());
}

代码示例来源:origin: locationtech/geowave

dataStore.query(
  bldr.constraints(
    bldr.constraintsFactory().spatialTemporalConstraints().spatialConstraints(

代码示例来源:origin: locationtech/geowave

try (final CloseableIterator<SimpleFeature> it = dataStore.query(bldr.build())) {
 int iteration = 0;
 while (it.hasNext()) {

代码示例来源:origin: locationtech/geowave

public CloseableIterator<SimpleFeature> getData(
  final Geometry jtsBounds,
  final TemporalConstraintsSet timeBounds,
  final Filter filter,
  final Integer limit) {
 if (filter instanceof FidFilterImpl) {
  final Set<String> fids = ((FidFilterImpl) filter).getIDs();
  final byte[][] ids = new byte[fids.size()][];
  int i = 0;
  for (final String fid : fids) {
   ids[i++] = StringUtils.stringToBinary(fid);
  }
  final Index[] writeIndices = components.getAdapterIndices();
  final String queryIndexName =
    ((writeIndices != null) && (writeIndices.length > 0)) ? writeIndices[0].getName() : null;
  VectorQueryBuilder bldr =
    VectorQueryBuilder.newBuilder().addTypeName(
      components.getAdapter().getTypeName()).indexName(queryIndexName).setAuthorizations(
        transaction.composeAuthorizations());
  if (limit != null) {
   bldr = bldr.limit(limit);
  }
  if (subsetRequested()) {
   bldr = bldr.subsetFields(components.getAdapter().getTypeName(), getSubset());
  }
  return components.getDataStore().query(
    bldr.constraints(bldr.constraintsFactory().dataIds(ids)).build());
 }
 return issueQuery(jtsBounds, timeBounds, new BaseIssuer(filter, limit));
}

相关文章