Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.7.3
-
Component/s: app-schema plugin
-
Labels:None
Description
Bug report from Ryan Clark, adding properties to gsml:MappedFeature in the app-schema tutorial config:
... Secondly, I'm trying to do something similar with the gsml:positionalAccuracy element. In this case, I want the resultant document to look like this: <gsml:positionalAccuracy> <gsml:CGI_TermValue> <gsml:value codeSpace="urn:ietf:rfc:2141">urn:ogc:def:nil:OGC:missing</gsml:value> </gsml:CGI_TermValue> </gsml:positionalAccuracy> When I add the mapping to my MappedFeature.xml to do so, I get the following error: gsml:CGI_TermValue is not a valid location path for type urn:cgi:xmlns:CGI:GeoSciML:2.0:CGI_ValuePropertyType. In my understanding of the schema, CGI_TermValue should fit here as a result of a couple of substitution groups. gsml:positionalAccuracy requires a CGI_Value. CGI_TermValue or CGI_NumericValue substitute for CGI_PrimitiveValue which substitues for CGI_Value. Here are some relevant bits from the value.xsd: ____ <xs:element xmlns:xs="http://www.w3.org/2001/XMLSchema" name="CGI_TermValue" substitutionGroup="gsml:CGI_PrimitiveValue" type="gsml:CGI_TermValueType"> <xs:element xmlns:xs="http://www.w3.org/2001/XMLSchema" abstract="true" name="CGI_PrimitiveValue" substitutionGroup="gsml:CGI_Value" type="gsml:CGI_PrimitiveValueType"> <xs:element xmlns:xs="http://www.w3.org/2001/XMLSchema" abstract="true" name="CGI_Value" type="gsml:CGI_ValueType"> <xs:complexType xmlns:xs="http://www.w3.org/2001/XMLSchema" name="CGI_ValuePropertyType"> <xs:sequence> <xs:element ref="gsml:CGI_Value"/> </xs:sequence> </xs:complexType> <xs:element name="positionalAccuracy" type="gsml:CGI_ValuePropertyType"> ____ Is it possible that the whatever is doing the parsing here is not traversing these substitution groups? Is there (perhaps more likely) something that I might not have in place that would correct this issue? Maybe my namespaces are not correct or complete in the mapping file? Not really sure... Thank you, Ryan
Ben replied:
I can reproduce this problem as you describe.
Part of the app-schema code is not walking the substitution group, probably because of the abstract base type. Thanks for the report. I will see if it can be improved.
You can force the type of the node using a targetAttributeNode mapping before the value mapping:
<AttributeMapping> <targetAttribute>gsml:positionalAccuracy</targetAttribute> <targetAttributeNode>gsml:CGI_TermValuePropertyType</targetAttributeNode> </AttributeMapping> <AttributeMapping> <targetAttribute>gsml:positionalAccuracy/gsml:CGI_TermValue/gsml:value</targetAttribute> <sourceExpression> <OCQL>'urn:ogc:def:nil:OGC:missing'</OCQL> </sourceExpression> <ClientProperty> <name>codeSpace</name> <value>'urn:ietf:rfc:2141'</value> </ClientProperty> </AttributeMapping>
Without the targetAttributeNode mapping, we get the following:
29 Jul 14:46:37 ERROR [geoserver.ows] -
java.lang.IllegalArgumentException: gsml:CGI_TermValue is not a valid location path for type urn:cgi:xmlns:CGI:GeoSciML:2.0:CGI_ValuePropertyType. gsml:CGI_TermValue ns: urn:cgi:xmlns:CGI:GeoSciML:2.0, CGI_ValuePropertyType properties: urn:cgi:xmlns:CGI:GeoSciML:2.0#CGI_Value
at org.geotools.data.complex.filter.XPath.set(XPath.java:601)
at org.geotools.data.complex.MappingFeatureIterator.setAttributeValue(MappingFeatureIterator.java:371)
at org.geotools.data.complex.MappingFeatureIterator.computeNext(MappingFeatureIterator.java:555)
at org.geotools.data.complex.MappingFeatureIterator.next(MappingFeatureIterator.java:453)
at org.geotools.data.complex.MappingFeatureIterator.next(MappingFeatureIterator.java:82)
at org.geotools.xml.Encoder.encode(Encoder.java:665)
at org.geotools.xml.Encoder.encode(Encoder.java:557)
at org.geoserver.wfs.xml.GML3OutputFormat.write(GML3OutputFormat.java:170)
at org.geoserver.wfs.WFSGetFeatureOutputFormat.write(WFSGetFeatureOutputFormat.java:137)
Issue Links
- is related to
-
GEOT-4035
app-schema does not recognise substitution groups of basic types
-