|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Filter/Expression construction kit - this class forms chains.
I can't take Filter anymore, the turning point was the fact that I needed a FeatureType to make a AttributeExpression. Simply *no*, I cannot expect customer code to have to jump through hoops so that my impmentation is easier. Late binding is required.
The answer - while not completely forcing DataStores away from Expression/Filter is to make a class that captures all the same information and can do the late binding.
On the way we thre we are not going to have the difference between Filter/Expression. Expr can make an Expression, and Expr can make a Filter.
Example:
Exprs.bbox( extent ).and( Exprs.attribute("cost").lt( 50 ) )
BTW: just so we can have everything make sense
Exprs.bbox( extent ).fids( fidSet) ==
Exprs.bbox( extent ).and( Exprs.fids( fidSet ) )
- There are convience methods that make sense -
Exprs.bbox( extent ) == geom().disjoint( Expr.literal( extent)).not()
- Or you have to do by hand -
Exprs.fid( "road.1234" ).or( Exprs.fid("road.4321) )
Wild idea time: chaining parameters
Expr.fid( "road.1234" ).param( "road.4321" )
repository.view("road").as("name", "CUSTOMER_NAME").as( "addresss", "ADDRESS" )
Still does not look right - sigh.
- Author:
- Jody Garnett
Method Summary
Expr
and(Expr expr)
Explicit Expr chain extention - required for custom Expressions.
Expr
bbox(com.vividsolutions.jts.geom.Envelope extent)
expr.and( geom().bbox().disjoint( extent ).not )
Restrict current Expr with provided bounding box
Expr
between(Expr min,
Expr max)
min <= expr <= max
Expr
eq(Expr expr)
expr == expr
Expr
eval()
Evaludate Expr (with LiteralExpr as a goal).
Expression
expression(FeatureType schema)
Lazy binding of Expr into an Expression
Expr
fid(java.util.Set fids)
expr.filter( fids )
Restruct current Expr to provided featureId(s).
Expr
fid(java.lang.String featureID)
expr.filter( fid )
Restruct current Expr to provided featureId(s).
Filter
filter(FeatureType schema)
Lazy binding of Expr into a Filter
Expr
fn(java.lang.String name)
name( expr )
Expr
fn(java.lang.String name,
Expr expr)
name( expr, expr )
Expr
fn(java.lang.String name,
Expr[] expr)
name( expr[0], expr[0], ... )
Expr
gt(Expr expr)
expr > expr
Expr
gte(Expr expr)
expr >= expr
Expr
lt(Expr expr)
expr < expr
Expr
lte(Expr expr)
expr <= expr
Expr
ne(Expr expr)
expr !
Expr
not()
!
Expr
notNull()
expr !
Expr
or(Expr expr)
Expr Disjunction
Expr
reduce(java.lang.String bind)
Reduce attributes matching "bind/x" to "x".
Expr
resolve(org.opengis.catalog.MetadataEntity metadata)
Bind all meta entries according to provided metadata.
Expr
resolve(java.lang.String bind,
Feature feature)
Bind attributes matching "bind/**" to feature.getAttribute("**).
Method Detail
eval
public Expr eval()
- Evaludate Expr (with LiteralExpr as a goal).
This method has been introduced for testing, although it will
help when implementing a testing evaluator.
Note: The returned result may still be an Expr (if the Expr
contains any unresolved metadata or Feature information).
If all metadata,geom and attribute Expr have been resolved
the result will be a LiteralExpr - that represents the value of
the Expr.
resolve
public Expr resolve(org.opengis.catalog.MetadataEntity metadata)
- Bind all meta entries according to provided metadata.
Feature
- Parameters:
metadata
-
- Returns:
- Expr with all meta( xpath ) Exprs resolved
reduce
public Expr reduce(java.lang.String bind)
- Reduce attributes matching "bind/x" to "x".
This may be used to reduce an Expr as part of an otter join, to
something simple that can be passed off to an DataStore by way
of filter( FeatureType ).
Example:
FeatureType RIVER = river.getSchema();
FeatureType HAZZARD = hazard.getSchema();
Expr joinExpr = Exprs.attribute("river/name").eq( Exprs.attribute("hazzard/river") );
FeatureReader outer = river.getFeatures().reader();
while( reader.hasNext() ){
Feature aRiver = outer.next();
Expr inner = joinExpr.resolve( "river", aRiver ).reduce( "hazzard" );
FeatureReader inner = district.getFeatures( inner.filter( HAZZARD ) );
while( inner.hasNext() ){
Feature aHazzard = inner.next();
// code here has access to both aRiver and aHazzard
}
inner.close();
}
outer.close();
resolve
public Expr resolve(java.lang.String bind,
Feature feature)
- Bind attributes matching "bind/**" to feature.getAttribute("**).
This may be used to reduce an Expr as part of an otter join, to
something simple that can be passed off to an DataStore by way
of filter( FeatureType ).
This method will also try and reduce any metadata xpath
expression matching "bind/**".
- Parameters:
bind
- feature
-
- Returns:
- Expr modified with literals in place of "bind/**" attributes.
filter
public Filter filter(FeatureType schema)
throws java.io.IOException
- Lazy binding of Expr into a Filter
- Throws:
java.io.IOException
expression
public Expression expression(FeatureType schema)
throws java.io.IOException
- Lazy binding of Expr into an Expression
- Throws:
java.io.IOException
bbox
public Expr bbox(com.vividsolutions.jts.geom.Envelope extent)
- expr.and( geom().bbox().disjoint( extent ).not )
Restrict current Expr with provided bounding box
fid
public Expr fid(java.lang.String featureID)
- expr.filter( fid )
Restruct current Expr to provided featureId(s).
fid
public Expr fid(java.util.Set fids)
- expr.filter( fids )
Restruct current Expr to provided featureId(s).
not
public Expr not()
- !expr
Invert of logical TRUTH value. Can be used to test for non contained fitler contents or
FALSE Expressions
- Returns:
- Invert of Logical TRUETH value
and
public Expr and(Expr expr)
- Explicit Expr chain extention - required for custom Expressions.
- Parameters:
expr
-
- Returns:
- Explicit chain extention.
or
public Expr or(Expr expr)
- Expr Disjunction
eq
public Expr eq(Expr expr)
- expr == expr
gt
public Expr gt(Expr expr)
- expr > expr
gte
public Expr gte(Expr expr)
- expr >= expr
lt
public Expr lt(Expr expr)
- expr < expr
lte
public Expr lte(Expr expr)
- expr <= expr
ne
public Expr ne(Expr expr)
- expr != expr
between
public Expr between(Expr min,
Expr max)
- min <= expr <= max
notNull
public Expr notNull()
- expr != null
fn
public Expr fn(java.lang.String name)
- name( expr )
fn
public Expr fn(java.lang.String name,
Expr expr)
- name( expr, expr )
fn
public Expr fn(java.lang.String name,
Expr[] expr)
- name( expr[0], expr[0], ... )
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD
Copyright © GeoTools. All Rights Reserved.