Motivation: |
Styling and Query need a hint to understand xpath namespaces |
|
|---|---|---|
Contact: |
||
Tracker: |
||
Tagline: |
|
This page represents the current plan; for discussion please check the tracker link above.
|
The goal is to enable the following code example that uses xpath namespaces:
NamespaceSupport namespaceSupport = new NamespaceSupport();
namespaceSupport.declairPrefix("foo", "urn:cgi:xmlns:CGI:GeoSciML:2.0" );
FilterFactory2 ff = CommonFilterFactory.getFilterFactory2( null );
Filter filter = ff.greater(ff.property("foo:city/foo:size",namespaceSupport),ff.literal(300000));
FeatureCollection features = featureSource.getFeatures( filter );
|
Additionally, the interface for PropertyName should be should allow getting namespace information , especially for duplication purposes:
NamespaceSupport namespaceSupport = propertyName.getNamespaceSupport();
...
|
Query should be extended to support the PropertyName type rather than just strings, for greater control of properties returned:
Query query = new Query( typeName );
query.setFilter( filter );
query.setProperties( new PropertyName[]{
ff.property("foo:x", namespaceSupport),
ff.property("foo:y", namespaceSupport),
ff.property("foo:description/foo:label", namespaceSupport)});
|
For backward compatibility, the existing getter and setter with String[] rather than PropertyName[] with remain supported.
Assumption: In the above that description will be returned; with only one the "label" value filled in.
This is a straight up API change to roll in the work of FilterFactoryImplNamespaceAware for broader use. This issue also effects the use of Query (another place where NamespaceSupport is required in order to understand propertyName expressions).
public class FilterFactoryImplNamespaceAware extends FilterFactoryImpl {
private Hints namespaceHints;
public FilterFactoryImplNamespaceAware() {
}
public FilterFactoryImplNamespaceAware(NamespaceSupport namespaces) {
setNamepaceContext(namespaces);
}
public PropertyName property(String name) {
return new AttributeExpressionImpl(name, namespaceHints);
}
public void setNamepaceContext(NamespaceSupport namespaces) {
namespaceHints = new Hints(FeaturePropertyAccessorFactory.NAMESPACE_CONTEXT, namespaces);
}
}
|
The above code allows a NamespaceSupport instances provided along side an PropertyName. This can be used to sort out any prefix information mentioned by the PropertyName XPath expression.
Discussion:
Work has completed; the jira was marked as resolved.
Voting is open:
This section is used to make sure your proposal is complete (did you remember documentation?) and has enough paid or volunteer time lined up to be a success
|
no progress |
|
done |
|
impeded |
|
lack mandate/funds/time |
|
volunteer needed |
|---|
BEFORE:
interface FilterFactory2 extends FilterFactory {
...
PropertyName property(Name);
...
}
|
AFTER:
interface FilterFactory2 extends FilterFactory {
...
PropertyName property(Name name);
PropertyName property( String xpath, NamespaceSupport namespaceSupport );
...
}
|
BEFORE:
public class Query {
String[] properties;
...
public String[] getPropertyNames() {
return properties;
}
public void setPropertyNames(String[] propertyNames) {
properties = propertyNames;
}
...
}
|
AFTER:
public class Query {
...
PropertyName[] properties;
...
public String[] getPropertyNames() {
//convert properties to array strings
}
public void setPropertyNames(String[] propertyNames) {
//convert strings to property names
}
/** Direct access to properties array */
public List<PropertyName> getProperties() {
return properties
}
public void setProperties( List<PropertyName> properties ) {
this.properties = properties;
}
...
}
|
Pending the acceptance of Refactor OpenGIS.
BEFORE:
public interface PropertyName extends Expression {
String getPropertyName();
}
|
AFTER:
public interface PropertyName extends Expression {
String getPropertyName();
NamespaceContext getNameSpaceContext();
}
|