org.deegree.feature.persistence.query.Query类的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(83)

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

Query介绍

[英]Encapsulates the parameter of a query to a FeatureStore.
[中]将查询的参数封装到FeatureStore。

代码示例

代码示例来源:origin: deegree/deegree3

static Query createQuery( QName ftName, Filter filter, int scale, int maxFeatures, double resolution,
             SortProperty[] sort ) {
  TypeName[] typeNames = new TypeName[] { new TypeName( ftName, null ) };
  return new Query( typeNames, filter, sort, scale, maxFeatures, resolution );
}

代码示例来源:origin: deegree/deegree3

private org.deegree.protocol.wfs.query.Query toWFSQuery( Query query ) {
  TypeName[] typeNames = query.getTypeNames();
  String featureVersion = null;
  ICRS srsName = null;
  PropertyName[] projectionClauses = null;
  SortProperty[] sortBy = query.getSortProperties();
  Filter filter = query.getFilter();
  return new FilterQuery( null, typeNames, featureVersion, srsName, projectionClauses, sortBy, filter );
}

代码示例来源:origin: deegree/deegree3

Envelope env = queries[0].getPrefilterBBoxEnvelope();
if ( getSchema().getBlobMapping() != null && queries[0].getFilter() == null
   && queries[0].getSortProperties().length == 0 ) {
  wmsStyleQuery = true;
  for ( int i = 1; i < queries.length; i++ ) {
    Envelope queryBBox = queries[i].getPrefilterBBoxEnvelope();
    if ( queryBBox != env && queries[i].getFilter() != null && queries[i].getSortProperties() != null ) {
      wmsStyleQuery = false;
      break;

代码示例来源:origin: deegree/deegree3

if ( query.getTypeNames() == null || query.getTypeNames().length > 1 ) {
  String msg = "Join queries between multiple feature types are currently not supported.";
  throw new UnsupportedOperationException( msg );
if ( query.getTypeNames().length == 1 ) {
  QName ftName = query.getTypeNames()[0].getFeatureTypeName();
  FeatureType ft = schema.getFeatureType( ftName );
  if ( ft == null ) {
  if ( query.getPrefilterBBoxEnvelope() != null && ftEnv != null && storageCRS != null ) {
    Envelope prefilterBox = query.getPrefilterBBoxEnvelope();
    if ( prefilterBox.getCoordinateSystem() != null
       && !prefilterBox.getCoordinateSystem().equals( storageCRS ) ) {
  if ( query.getFilter() != null ) {
    fc = fc.getMembers( query.getFilter(), evaluator );
  if ( query.getFilter() == null || !( query.getFilter() instanceof IdFilter ) ) {
    String msg = "Invalid query. If no type names are specified, it must contain an IdFilter.";
    throw new FilterEvaluationException( msg );
  for ( ResourceId id : ( (IdFilter) query.getFilter() ).getSelectedIds() ) {
    GMLObject object = idToObject.get( id.getRid() );
    if ( object != null && object instanceof Feature ) {
SortProperty[] sortCrit = query.getSortProperties();
if ( sortCrit.length > 0 ) {
  fc = Features.sortFc( fc, sortCrit );

代码示例来源:origin: deegree/deegree3

Envelope bbox = q.getPrefilterBBoxEnvelope();
if ( bbox == null ) {
  bbox = calcEnvelope( ftName );
Object scaleHint = q.getHint( HINT_SCALE );
int scale = -1;
if ( scaleHint != null ) {
if ( q.getMaxFeatures() > 0 && connProvider.getDialect() instanceof PostGISDialect ) {
  sql += " limit " + q.getMaxFeatures();
if ( q.getFilter() != null ) {
  set = new FilteredFeatureInputStream( set, q.getFilter() );

代码示例来源:origin: deegree/deegree3

private short[] getQueriedFeatureTypeIds( Query[] queries ) {
  short[] ftId = new short[queries.length];
  for ( int i = 0; i < ftId.length; i++ ) {
    Query query = queries[i];
    if ( query.getTypeNames() == null || query.getTypeNames().length > 1 ) {
      String msg = "Join queries between multiple feature types are currently not supported.";
      throw new UnsupportedOperationException( msg );
    }
    ftId[i] = getFtId( query.getTypeNames()[0].getFeatureTypeName() );
  }
  return ftId;
}

代码示例来源:origin: deegree/deegree3

FeatureBuilder builder = new FeatureBuilderBlob( this, blobMapping );
  List<String> columns = builder.getInitialSelectList();
  if ( query.getPrefilterBBox() != null ) {
    OperatorFilter bboxFilter = new OperatorFilter( query.getPrefilterBBox() );
    wb = getWhereBuilderBlob( bboxFilter, conn );
    LOG.debug( "WHERE clause: " + wb.getWhere() );
if ( query.getSortProperties().length > 0 ) {
  LOG.debug( "Applying in-memory post-sorting." );
  result = new MemoryFeatureInputStream( Features.sortFc( result.toCollection(), query.getSortProperties() ) );

代码示例来源:origin: deegree/deegree3

AbstractWhereBuilder wb = getWhereBuilder( ft, filter, query.getSortProperties(), conn );

代码示例来源:origin: deegree/deegree3

if ( query.getTypeNames() == null || query.getTypeNames().length > 1 ) {
  String msg = "Only queries with exactly one or zero type name(s) are supported.";
  throw new UnsupportedOperationException( msg );
if ( query.getFilter() instanceof IdFilter ) {
  idFilterNums = new HashSet<Integer>();
  IdFilter f = (IdFilter) query.getFilter();
  List<ResourceId> ids = f.getSelectedIds();
  for ( ResourceId id : ids ) {
if ( query.getTypeNames().length == 0 && !( query.getFilter() instanceof IdFilter ) || idFilterNums != null
   && idFilterNums.isEmpty() ) {
  return new MemoryFeatureInputStream( new GenericFeatureCollection() );
if ( query.getTypeNames().length > 0 ) {
  QName featureType = query.getTypeNames()[0].getFeatureTypeName();
  if ( featureType != null && !featureType.equals( ft.getName() ) ) {
Filter filter = query.getFilter();
Pair<Filter, Envelope> filterPair = splitOffBBoxConstraint( filter );
Envelope bbox = getTransformedEnvelope( query.getPrefilterBBoxEnvelope() );
                                   query.getSortProperties() );
HashSet<Integer> recNums = new HashSet<Integer>( unzipPair( recNumsAndPos ).first );
if ( idFilterNums != null ) {
  p = new Pair<Filter, SortProperty[]>( filterPair.first, query.getSortProperties() );

代码示例来源:origin: deegree/deegree3

protected boolean localReferencesPossible( QueryAnalyzer analyzer, int traverseXLinkDepth ) {
  if ( traverseXLinkDepth == 0 && analyzer.getQueries().size() == 1 ) {
    List<Query> queries = analyzer.getQueries().values().iterator().next();
    if ( queries.size() == 1 ) {
      Query query = queries.get( 0 );
      if ( query.getTypeNames().length == 1 ) {
        TypeName typeName = query.getTypeNames()[0];
        FeatureStore fs = analyzer.getQueries().keySet().iterator().next();
        FeatureType ft = fs.getSchema().getFeatureType( typeName.getFeatureTypeName() );
        for ( PropertyType pt : ft.getPropertyDeclarations() ) {
          if ( pt instanceof FeaturePropertyType ) {
            FeaturePropertyType fpt = (FeaturePropertyType) pt;
            FeatureType targetFt = fpt.getValueFt();
            if ( targetFt == null || fs.getSchema().isSubType( targetFt, ft ) ) {
              return true;
            }
          }
        }
        LOG.debug( "Forward references can be ruled out." );
        return false;
      }
    }
  }
  return true;
}

代码示例来源:origin: deegree/deegree3

conn = getConnection();
wb = getWhereBuilder( ft, filter, query.getSortProperties(), conn );
String ftTableAlias = wb.getAliasManager().getRootTableAlias();
LOG.debug( "WHERE clause: " + wb.getWhere() );

代码示例来源:origin: deegree/deegree3

@Override
public FeatureInputStream query( Query query )
            throws FeatureStoreException, FilterEvaluationException {
  if ( query.getTypeNames() == null || query.getTypeNames().length > 1 ) {
    String msg = "Join queries between multiple feature types are not by SQLFeatureStore (yet).";
    throw new UnsupportedOperationException( msg );
  }
  FeatureInputStream result = null;
  Filter filter = query.getFilter();
  if ( query.getTypeNames().length == 1 && ( filter == null || filter instanceof OperatorFilter ) ) {
    QName ftName = query.getTypeNames()[0].getFeatureTypeName();
    FeatureType ft = getSchema().getFeatureType( ftName );
    if ( ft == null ) {
      String msg = "Feature store is not configured to serve feature type '" + ftName + "'.";
      throw new FeatureStoreException( msg );
    }
    result = queryByOperatorFilter( query, ftName, (OperatorFilter) filter );
  } else {
    // must be an id filter based query
    if ( query.getFilter() == null || !( query.getFilter() instanceof IdFilter ) ) {
      String msg = "Invalid query. If no type names are specified, it must contain an IdFilter.";
      throw new FilterEvaluationException( msg );
    }
    result = queryByIdFilter( query.getTypeNames(), (IdFilter) filter, query.getSortProperties() );
  }
  return result;
}

代码示例来源:origin: deegree/deegree3

throws FeatureStoreException {
final List<String> updatedFids = new ArrayList<String>();
final Query query = new Query( ftName, filter, -1, -1, -1 );
final StringBuilder sql = new StringBuilder( "UPDATE " );
sql.append( blobMapping.getTable() );

代码示例来源:origin: deegree/deegree3

if ( query.getTypeNames().length == 0 ) {
  for ( FeatureStore fs : service.getStores() ) {
    List<Query> fsQueries = fsToQueries.get( fs );
  FeatureStore fs = service.getStore( query.getTypeNames()[0].getFeatureTypeName() );
  List<Query> fsQueries = fsToQueries.get( fs );
  if ( fsQueries == null ) {

代码示例来源:origin: deegree/deegree3

@Override
public int queryHits( Query query )
            throws FeatureStoreException, FilterEvaluationException {
  if ( query.getTypeNames() == null || query.getTypeNames().length > 1 ) {
    String msg = "Join queries between multiple feature types are not supported by the SQLFeatureStore implementation (yet).";
    throw new UnsupportedOperationException( msg );
  }
  Filter filter = query.getFilter();
  int hits = 0;
  if ( query.getTypeNames().length == 1 && ( filter == null || filter instanceof OperatorFilter ) ) {
    QName ftName = query.getTypeNames()[0].getFeatureTypeName();
    FeatureType ft = getSchema().getFeatureType( ftName );
    if ( ft == null ) {
      String msg = "Feature type '" + ftName + "' is not served by this feature store.";
      throw new FeatureStoreException( msg );
    }
    hits = queryHitsByOperatorFilter( query, ftName, (OperatorFilter) filter );
  } else {
    // must be an id filter based query
    if ( query.getFilter() == null || !( query.getFilter() instanceof IdFilter ) ) {
      String msg = "Invalid query. If no type names are specified, it must contain an IdFilter.";
      throw new FilterEvaluationException( msg );
    }
    // should be no problem iterating over the features (id queries usually request only a few ids)
    hits = queryByIdFilter( query.getTypeNames(), (IdFilter) filter, query.getSortProperties() ).count();
  }
  return hits;
}

代码示例来源:origin: deegree/deegree3

private IdFilter getIdFilter( QName ftName, OperatorFilter filter )
            throws FeatureStoreException {
  Set<String> ids = new HashSet<String>();
  Query query = new Query( ftName, filter, -1, -1, -1 );
  FeatureInputStream rs = null;
  try {
    rs = fs.query( query );
    for ( Feature feature : rs ) {
      ids.add( feature.getId() );
    }
  } catch ( FilterEvaluationException e ) {
    throw new FeatureStoreException( e );
  } finally {
    if ( rs != null ) {
      rs.close();
    }
  }
  return new IdFilter( ids );
}

代码示例来源:origin: deegree/deegree3

Query query = new Query( new TypeName[] { new TypeName( ftName, null ) }, filter, null, null, null );

代码示例来源:origin: deegree/deegree3

queries.add( new Query( new TypeName[] { tn }, f, null, null, null ) );

代码示例来源:origin: deegree/deegree3

Query q = new Query( this.rootFT, Filters.addBBoxConstraint( tileEnv, null, null, false ), -1, -1, -1 );
FeatureInputStream frs = null;
long sT = currentTimeMillis();

代码示例来源:origin: deegree/deegree3

return new Query( typeNames, filter, ( (AdHocQuery) wfsQuery ).getFeatureVersion(),
         ( (AdHocQuery) wfsQuery ).getSrsName(), sortProps );

相关文章