I think you want these:
http://docs.geoserver.org/latest/en/user/data/app-schema/polymorphism.html#null-or-missing-value
http://docs.geoserver.org/latest/en/user/data/app-schema/polymorphism.html#recode-function

But I don't know if they will help without feature chaining. Rini?

On 05/10/10 16:04, Andrea Aime wrote:
> Hi,
> in my target schema I have this attribute:
>
> <xs:element name="positionAccuracyVector"
> type="csn:PositionAccuracyVectorType" minOccurs="0"/>
>
> <xs:complexType name="PositionAccuracyVectorType">
>               <xs:sequence>
>                       <xs:element name="x" type="xs:integer">
>                       </xs:element>
>                       <xs:element name="y" type="xs:integer">
>                       </xs:element>
>               </xs:sequence>
>       </xs:complexType>
>
> As you can see the attribute is optional, but the x/y inside of it are not.
> I made the following mappings (no feature chaining):
>
>                               <AttributeMapping>
>                                       <targetAttribute>
>                          csndc:positionAccuracyVector/x
>                        </targetAttribute>
>                                       <sourceExpression>
>                                               <OCQL>position_accuracy_x</OCQL>
>                                       </sourceExpression>
>                               </AttributeMapping>
>                               <AttributeMapping>
>                                       <targetAttribute>
>                          csndc:positionAccuracyVector/y
>                        </targetAttribute>
>                                       <sourceExpression>
>                                               <OCQL>position_accuracy_y</OCQL>
>                                       </sourceExpression>
>                               </AttributeMapping>
>
>
> But the database contains also nulls for the two attributes. I hoped the
> app-schema store was smart enough to see all the attributes were null
> and decide not to create the positionAccuracy attribute, but unfortunately
> that did not work and I get the following exception:
>
> org.geotools.feature.IllegalAttributeException:http://www.w3.org/2001/XMLSchema:integer
> not nillable:null value:null
>       at org.geotools.feature.type.Types.validate(Types.java:112)
>       at org.geotools.feature.type.Types.validate(Types.java:80)
>       at org.geotools.feature.AttributeImpl.<init>(AttributeImpl.java:51)
>       at 
> org.geotools.feature.AppSchemaFeatureFactoryImpl.createAttribute(AppSchemaFeatureFactoryImpl.java:63)
>       at 
> org.geotools.feature.AttributeBuilder.create(AttributeBuilder.java:583)
>       at org.geotools.feature.AttributeBuilder.add(AttributeBuilder.java:495)
>       at org.geotools.data.complex.filter.XPath.setValue(XPath.java:769)
>
> Looking at the docs and the AppSchemaDataAccess.xsd grammar I see no
> way to tell
> the app schema store whether a attribute is actually present or not.
>
> Am I missing some feature, is this a bug or... what? :-)
> Maybe feature chaining can be used to solve this riddle, but I'm
> trying to avoid it like a plague,
> I cannot have n queries made for each feature returned.
> I guess this might be yet another candidate for xslt-ing...
>
> Cheers
> Andrea
>
> -----------------------------------------------------
> Ing. Andrea Aime
> Senior Software Engineer
>
> GeoSolutions S.A.S.
> Via Poggio alle Viti 1187
> 55054  Massarosa (LU)
> Italy
>
> phone: +39 0584962313
> fax:     +39 0584962313
>
> http://www.geo-solutions.it
> http://geo-solutions.blogspot.com/
> http://www.linkedin.com/in/andreaaime
> http://twitter.com/geowolf
>
> -----------------------------------------------------
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2&  L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> Geotools-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>


-- 
Ben Caradoc-Davies <[email protected]>
Software Engineering Team Leader
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to