Hi Ben,

Thanks for your response! From what I can tell, the community as a whole is
pretty new to GeodesyML. I followed your advice and definitely made
progress but I do have some followup questions.

1) Here is the request I am using, it specifies WFS version 1.1.0 and GML
version 3.2:
http://localhost:8080/geoserver/ows?service=WFS&version=1.1.0&request=GetFeature&typeName=gps_as:GeodesyML&outputFormat=gml32&maxFeatures=50
2) I created the secondary namespace as suggested and ensured that the gml
namespace matches between the namespace.xml file, the GeodesyML schema, and
my mapping file (http://www.opengis.net/gml/3.2).
3) I replaced the locally hosted .xsd reference in <schemaUri> with:
https://raw.githubusercontent.com/GeoscienceAustralia/GeodesyML/master/schemas/geodesyML.xsd
(I can't find a better source for it, the schema may still be under active
development?).

Now the new stuff. Upon some further reading into how XML schemas work (yay
wikibooks!) I discovered that my XPath expression for <targetAttribute> was
totally incorrect. I've included a mapping file snippet below, showing the
<targetTypes> block and the <typeMappings> block of my fixed mapping file.
This change stopped the generation of errors upon performing a WFS request.
Unfortunately, I still don't see the mapped features in the output.
Instead, I seem to get ONLY the gml:id out. I included an example of the
WFS request output below, requesting only 5 results. What really puzzles me
is that I specified <encodeIfEmpty>true</encodeIfEmpty> in the
<AttributeMapping> for site_name and station_code so I would expect to at
least see the fields. What's going on here?

Thanks for your help,

Gavin

*WFS Request Example Output:*
<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs/2.0"; xmlns:xs="
http://www.w3.org/2001/XMLSchema"; xmlns:gps_as="
urn:xml-gov-au:icsm:egeodesy:0.4" xmlns:gml="http://www.opengis.net/gml/3.2";
 xmlns:gps="http://geoserver.org/gps"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"; numberMatched="unknown"
numberReturned="5" timeStamp="2017-06-19T22:12:57.234Z" xsi:schemaLocation="
http://www.opengis.net/wfs/2.0
http://localhost:8080/geoserver/schemas/wfs/2.0/wfs.xsd
urn:xml-gov-au:icsm:egeodesy:0.4
https://raw.githubusercontent.com/GeoscienceAustralia/GeodesyML/master/schemas/geodesyML.xsd
http://www.opengis.net/gml/3.2
http://localhost:8080/geoserver/schemas/gml/3.2.1/gml.xsd";>
<wfs:member>
<gps_as:GeodesyML gml:id="geoml_monuments.fid-23c2aebd_15cc2138381_-7f65"/>
</wfs:member>
<wfs:member>
<gps_as:GeodesyML gml:id="geoml_monuments.fid-23c2aebd_15cc2138381_-7f64"/>
</wfs:member>
<wfs:member>
<gps_as:GeodesyML gml:id="geoml_monuments.fid-23c2aebd_15cc2138381_-7f63"/>
</wfs:member>
<wfs:member>
<gps_as:GeodesyML gml:id="geoml_monuments.fid-23c2aebd_15cc2138381_-7f62"/>
</wfs:member>
<wfs:member>
<gps_as:GeodesyML gml:id="geoml_monuments.fid-23c2aebd_15cc2138381_-7f61"/>
</wfs:member>
</wfs:FeatureCollection>

*Mapping File Snippet:*
<targetTypes>
<FeatureType>
<!--<schemaUri>http://localhost/geodesyML_schemas/geodesyML.xsd
</schemaUri>-->
<schemaUri>
https://raw.githubusercontent.com/GeoscienceAustralia/GeodesyML/master/schemas/geodesyML.xsd
</schemaUri>
</FeatureType>
</targetTypes>
<typeMappings>
<FeatureTypeMapping>
<sourceDataStore>thedb</sourceDataStore>
<sourceType>geoml_monuments</sourceType>
<!-- geoml_monuments is a materialized view in the postGIS database and it
is used as the source schema, or the schema we are mapping FROM -->
<targetElement>geo:GeodesyML</targetElement>
<!-- is the root element of the target schema, GeodesyML -->
<attributeMappings>
<AttributeMapping>
<targetAttribute>geo:siteLog/geo:siteIdentification/geo:siteName</targetAttribute>
<sourceExpression><OCQL>site_name</OCQL></sourceExpression>
<encodeIfEmpty>true</encodeIfEmpty>
</AttributeMapping>
<AttributeMapping>
<targetAttribute>geo:siteLog/geo:siteIdentification/geo:fourCharacterID</targetAttribute>
<sourceExpression><OCQL>station_code</OCQL></sourceExpression>
<encodeIfEmpty>true</encodeIfEmpty>
</AttributeMapping>
</attributeMappings>
</FeatureTypeMapping>
</typeMappings>




On Sat, Jun 17, 2017 at 9:34 PM, Ben Caradoc-Davies-2 [via OSGeo.org] <
[email protected]> wrote:

> Gavin,
>
> it looks to me like GeodesyML is a GML 3.2.1 application schema:
> https://github.com/GeoscienceAustralia/GeodesyML/
>
> This means that it will only work with GML 3.2 output from GeoServer.
> Either select a GML 3.2 output format, use WFS 2.0 (which defaults to
> GML 3.2), or manually add outputformat=gml32 to a WFS 1.1 request.
>
> You will likely also have to define secondary namespaces:
> http://docs.geoserver.org/latest/en/user/data/app-
> schema/supported-gml-versions.html
> http://docs.geoserver.org/latest/en/user/data/app-
> schema/secondary-namespaces.html
>
> schemaUri must be a URL. You can have multiple elements. The top-level
> one might be this, but I do not know if it includes monumentInfo.xsd:
> https://github.com/GeoscienceAustralia/GeodesyML/
> blob/master/schemas/geodesyML.xsd
>
> app-schema will cache it for you. Use a better URL if you have one (e.g.
> from geodesyml.org).
>
> I do not know GeodesyML and do not know what type you should choose.
> Perhaps geo:Site? This is the thing that goes on targetElement.
>
> Where is the siteName you mentioned? Could you use the gml:name
> inherited from gml:AbstractFeatureType? The property name goes in
> targetAttribute.
>
> Deciding how to map your database to the XML schema is, according to
> reports, 2/3 of the work.
>
> Kind regards,
> Ben.
>
> On 16/06/17 10:53, medley wrote:
>
> > Hi,
> >
> > I am trying to have a Geoserver display GML its output in the GeodesyML
> > schema, outlined  here
> > <https://geoscienceaustralia.github.io/GeodesyML-Github-Pages/>  . In
> > particular, I am working with GPS monument meta data. For now I'm trying
> to
> > just output the siteName in GeodesyML schema when I click GML in the
> Layers
> > Preview in Geoserver. The relevant XML schema definition file for
> GeodesyML
> > is called monumentInfo.xsd. Unfortunately, I can't seem to get the
> mapping
> > correct from my database schema to GeodesyML. In particular I think the
> > problem is in the <targetElement> or <targetAttribute> fields within
> > <FeatureTypeMapping>. I concluded that I should use geo:GeodesyML as the
> > argument to schemaUri because it is the only xsd file with a top level
> > element (type GeodesyMLType).
> >
> > How can I use the schema outlined in the monumentInfo.xsd schema
> definition?
> > Specifically here, how can I map site_name in my database schema to
> siteName
> > in the GeodesyML schema?
> >
> > Any help is sincerely appreciated and I apologize if my lack of
> familiarity
> > with XML is causing me to ask a silly question. I have done a fair bit
> of
> > Google research. The tutorial I followed to get this far is  here
> > <http://docs.geoserver.org/latest/en/user/data/app-schema/tutorial.html>
>  ,
> > with supporting documentation  here
> > <http://docs.geoserver.org/stable/en/user/data/app-
> schema/mapping-file.html>
> > but they are using GeoscienceML, not GeodesyML.
> >
> > -Gavin Medley
> >
> >
> > *The view I am querying, called geoml_monuments contains:*
> > id | station_code | site_name | geolocation | iers_domex | country_name
> > I am pretty sure this is fine.
> >
> >
> >
> > *The monumentsInfo.xsd file:*
> > https://github.com/GeoscienceAustralia/GeodesyML/blob/master/schemas/
> monumentInfo.xsd
> > <https://github.com/GeoscienceAustralia/GeodesyML/blob/master/schemas/
> monumentInfo.xsd>
> >
> >
> >
> > *The GeodesyML.xsd file:*
> > https://github.com/GeoscienceAustralia/GeodesyML/
> blob/master/schemas/geodesyML.xsd
> > <https://github.com/GeoscienceAustralia/GeodesyML/
> blob/master/schemas/geodesyML.xsd>
> >
> >
> >
> >
> > *My mapping file:*
> >
> >
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <as:AppSchemaDataAccess
> > xmlns:as="http://www.geotools.org/app-schema";
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> > xsi:schemaLocation="http://www.geotools.org/app-schema
> > AppSchemaDataAccess.xsd">
> > <namespaces>
> > <Namespace>
> > <prefix>geo</prefix>
> > <uri>urn:xml-gov-au:icsm:egeodesy:0.4</uri>
> > </Namespace>
> > <Namespace>
> > <prefix>gml</prefix>
> > <uri>http://www.opengis.net/gml/3.2</uri>
> > </Namespace>
> > <Namespace>
> > <prefix>gmd</prefix>
> > <uri>http://www.isotc211.org/2005/gmd</uri>
> > </Namespace>
> > </namespaces>
> > <includedTypes></includedTypes>
> > <sourceDataStores>
> > <DataStore>
> > <id>thedb</id>
> > <parameters>
> > <Parameter>
> >            <name>dbtype</name>
> >            <value>postgisng</value>
> >        </Parameter>
> >        <Parameter>
> >            <name>host</name>
> >            <value>thedatabaselocation.unavco.org</value>
> >        </Parameter>
> >        <Parameter>
> >            <name>port</name>
> >            <value>5432</value>
> >        </Parameter>
> >        <Parameter>
> >            <name>database</name>
> >            <value>tst3</value>
> >        </Parameter>
> >        <Parameter>
> >            <name>user</name>
> >            <value>theuser</value>
> >        </Parameter>
> >        <Parameter>
> >            <name>passwd</name>
> >            <value>thepassword</value>
> >        </Parameter>
> >    </parameters>
> > </DataStore>
> > </sourceDataStores>
> > <catalog></catalog>
> > <targetTypes>
> > <FeatureType>
> > <schemaUri>http://localhost/geodesyML_schemas/geodesyML.xsd</schemaUri>
> > </FeatureType>
> > </targetTypes>
> > <typeMappings>
> > <FeatureTypeMapping>
> > <sourceDataStore>thedb</sourceDataStore>
> > <sourceType>geoml_monuments</sourceType>
> >
> > <targetElement>geo:GeodesyML</targetElement>
> >
> > <attributeMappings>
> > <AttributeMapping>
> >
> >
> > <targetAttribute>geo:siteIdentificationType/geo:siteName</targetAttribute>
>
> > <sourceExpression><OCQL>site_name</OCQL></sourceExpression>
> > </AttributeMapping>
> >
> > </attributeMappings>
> > </FeatureTypeMapping>
> > </typeMappings>
> > </as:AppSchemaDataAccess>
> >
> >
> >
> >
> > *The output upon clicking GML from Layer Preview:*
> >
> > <ows:ExceptionReport xmlns:xs="http://www.w3.org/2001/XMLSchema";
> > xmlns:ows="http://www.opengis.net/ows";
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="1.0.0"
> > xsi:schemaLocation="http://www.opengis.net/ows
> > http://localhost:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd";>
>
> > <ows:Exception exceptionCode="NoApplicableCode">
> > <ows:ExceptionText>
> > java.lang.RuntimeException: Error applying mapping with targetAttribute
> > geo:siteIdentificationType/geo:siteName Error applying mapping with
> > targetAttribute geo:siteIdentificationType/geo:siteName
> > geo:siteIdentificationType is not a valid location path for type
> > urn:xml-gov-au:icsm:egeodesy:0.4:GeodesyMLType.
> geo:siteIdentificationType
> > ns: urn:xml-gov-au:icsm:egeodesy:0.4, GeodesyMLType properties:
> > http://www.opengis.net/gml/3.2#metaDataProperty,
> > http://www.opengis.net/gml/3.2#description,
> > http://www.opengis.net/gml/3.2#descriptionReference,
> > http://www.opengis.net/gml/3.2#identifier,
> > http://www.opengis.net/gml/3.2#name,
> > http://www.opengis.net/gml/3.2#boundedBy,
> > http://www.opengis.net/gml/3.2#location,
> > http://www.opengis.net/gml/3.2#validTime,
> > urn:xml-gov-au:icsm:egeodesy:0.4#Node,
> > urn:xml-gov-au:icsm:egeodesy:0.4#AbstractPosition,
> > urn:xml-gov-au:icsm:egeodesy:0.4#PositionPairCovariance,
> > urn:xml-gov-au:icsm:egeodesy:0.4#Site,
> > urn:xml-gov-au:icsm:egeodesy:0.4#siteVisit,
> > urn:xml-gov-au:icsm:egeodesy:0.4#Monument,
> > urn:xml-gov-au:icsm:egeodesy:0.4#SupplementaryMark,
> > urn:xml-gov-au:icsm:egeodesy:0.4#AbstractMeasurement,
> > urn:xml-gov-au:icsm:egeodesy:0.4#Instrument,
> > urn:xml-gov-au:icsm:egeodesy:0.4#Sensor,
> > urn:xml-gov-au:icsm:egeodesy:0.4#AbstractPositionSource,
> > urn:xml-gov-au:icsm:egeodesy:0.4#AbstractPositionEstimator,
> > urn:xml-gov-au:icsm:egeodesy:0.4#AbstractMeasurementSource,
> > urn:xml-gov-au:icsm:egeodesy:0.4#AbstractMeasurementOperation,
> > urn:xml-gov-au:icsm:egeodesy:0.4#AbstractDefinitionSource,
> > urn:xml-gov-au:icsm:egeodesy:0.4#AbstractDefinitionOperation,
> > urn:xml-gov-au:icsm:egeodesy:0.4#AbstractSiteLog,
> > urn:xml-gov-au:icsm:egeodesy:0.4#Project,
> > urn:xml-gov-au:icsm:egeodesy:0.4#Document,
> > urn:xml-gov-au:icsm:egeodesy:0.4#Setup,
> > urn:xml-gov-au:icsm:egeodesy:0.4#TerrestrialReferenceFrame,
> > urn:xml-gov-au:icsm:egeodesy:0.4#DynamicTransformation,
> > http://www.opengis.net/gml/3.2#AbstractCRS, null#FEATURE_LINK,
> > null#FEATURE_LINK
> > </ows:ExceptionText>
> > </ows:Exception>
> > </ows:ExceptionReport>
> >
> >
> >
> > --
> > View this message in context: http://osgeo-org.1560.x6.
> nabble.com/App-Schema-Mapping-File-to-GeodesyML-tp5324416.html
> > Sent from the GeoServer - User mailing list archive at Nabble.com.
> >
> > ------------------------------------------------------------------------------
>
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > _______________________________________________
> > Geoserver-users mailing list
> > [hidden email] <http:///user/SendEmail.jtp?type=node&node=5324569&i=0>
> > https://lists.sourceforge.net/lists/listinfo/geoserver-users
> >
>
> --
> Ben Caradoc-Davies <[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=5324569&i=1>>
> Director
> Transient Software Limited <http://transient.nz/>
> New Zealand
>
> ------------------------------------------------------------------------------
>
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Geoserver-users mailing list
> [hidden email] <http:///user/SendEmail.jtp?type=node&node=5324569&i=2>
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://osgeo-org.1560.x6.nabble.com/App-Schema-Mapping-File-to-GeodesyML-
> tp5324416p5324569.html
> To unsubscribe from App-Schema Mapping File to GeodesyML, click here
> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5324416&code=bWVkbGV5QHVuYXZjby5vcmd8NTMyNDQxNnwyNTQxODQ1NDQ=>
> .
> NAML
> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>



-- 
Gavin Medley
USIP Intern
[email protected]




--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/App-Schema-Mapping-File-to-GeodesyML-tp5324416p5324752.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to