Hi,
I've been reading the app-schema documentation end to end
and I'm left wondering about the mappingName construct... it is being cited
a few times in the
docs, and I believe I have the gist of why it's there (to handle
polymorphic mappings or cases where the same nested type is used in
different places), but there is no real example of it being used.

To make sure I've used "git grep mappingName" in the docs and the result is:

source/data/app-schema/feature-chaining.rst:       * the nested element
name, which is normally the targetElement or mappingName of the
corresponding type.
source/data/app-schema/feature-chaining.rst:This is when the optional
mappingName tag mentioned in :ref:`app-schema.mapping-file` comes in.
source/data/app-schema/feature-chaining.rst:Instead of passing in the
nested feature type's targetElement in the containing type's linkElement,
specify the corresponding mappingName.
source/data/app-schema/feature-chaining.rst:    * The mappingName is
namespace aware and case sensitive.
source/data/app-schema/feature-chaining.rst:    * When the referred
mappingName contains special characters such as '-', it must be enclosed
with single quotes in the linkElement. E.g.
<linkElement>'observation-method'</linkElement>.
source/data/app-schema/feature-chaining.rst:    * Each mappingName must be
unique against other mappingName and targetElement tags across the
application.
source/data/app-schema/feature-chaining.rst:    * The mappingName is only
to be used to identify the chained type from the nesting type. It is not a
solution for multiple FeatureTypeMapping instances where > 1 of them can be
queried as top level features.
source/data/app-schema/mapping-file.rst:
 <mappingName>mappedfeature1</mappingName>
source/data/app-schema/mapping-file.rst:* ``mappingName`` is an optional
tag, to identify the mapping in :ref:`app-schema.feature-chaining` when
there are multiple FeatureTypeMapping instances for the same type. This is
solely for feature chaining purposes, and would not
source/data/app-schema/polymorphism.rst:Note: NumericType here is a
mappingName, whereas gsml:CGI_TermValue is a targetElement.
source/data/app-schema/polymorphism.rst:
 <mappingName>NumericType</mappingName>
source/data/app-schema/polymorphism.rst:Otherwise, if NUMERIC_VALUE is less
or equal than 1000, it would be encoded with attributes from
FeatureTypeMapping with 'numeric_value' mappingName.
source/data/app-schema/polymorphism.rst:* **value-n**: value expression
which translates to a mappingName or targetElement
source/data/app-schema/polymorphism.rst:    * When specifying a mappingName
or targetElement as a value in functions, make sure they're enclosed in
single quotes.

The feature chaining page is the most baffling one, it has a set of example
mapping files
and I was expecting to find some usage of it in there, since the parts
talking about mappingName
refer to the gsml:CGI_TermValue usage, but it's not actually there.

The polymorphism page actually cites it in a snippet, but the context is
different, it's about avoiding extra
queries on the database. I've read it a few times but was not able to make
head or tails of it, until I've found
a worked out example in the GeoServer app-schema tests:
https://github.com/geoserver/geoserver/blob/master/src/extension/app-schema/app-schema-test/src/test/resources/test-data/CGI_PlanarOrientation.xml
https://github.com/geoserver/geoserver/blob/master/src/extension/app-schema/app-schema-test/src/test/resources/test-data/CGI_PlanarOrientation.properties

So, if I get the idea correctly (please correct me if I'm wrong):

   - PlanarOrientation has a aziumth value that's polymorphic, it can be
   either a gsml:CGI_NumericValue or a gsml:CGI_TermValue (and the same
   happens for the "dip" attribute)
   - The property file contains all the information needed as a flat table,
   two columns to represent each case, one will be populated, the other null
   - The linkElement uses a function to decide which mappingName to use
   depending on which attribute is populated
   - The use of mapping name is necessary because we have literally 5
   different type mappings using the same source table
   - Using the mappings this way will make app schema read the table just
   once, without self joins, and map out the different properties as needed
   into the target xml document

So this example would be "using mappingName to go from a flat table to a
document with nested polymorphic types".

And then there is the case of no polymorphism, but having the same type
used in several different places, it's not polymorphism, it's
just that the schema decided to roll out a custom type for something as
common as a string for example, in order to be able to scope it with a
class/namespace.
This case is instead seems to be exemplified in the
geologicunit/cgi_termvalue case:
https://github.com/geoserver/geoserver/blob/master/src/extension/app-schema/app-schema-test/src/test/resources/test-data/DataReferenceData/gsml_GeologicUnit/gsml_GeologicUnit.xml#L215
https://github.com/geoserver/geoserver/blob/master/src/extension/app-schema/app-schema-test/src/test/resources/test-data/DataReferenceData/gsml_GeologicUnit/GU_CGITermValue.xml#L14

In this case we have three different term value attributes in geologic
unit, each one is associated to a different mapping in the second file,
each one having the same structure, but reading from a different table of
the database.

Finally I beleive there would be a third case which is similar to the above
one, again usage of the same type in different places, but with all the
terms located in a single table instead of 3, and
having an attribute that can be used to tell what role the term plays. I
haven't found an example like it in the tests though... have I missed it?

Looking forward to your feedback, if the above is more or less correct I'd
like to make a pull request adding these examples in the docs.


Cheers
Andrea

-- 
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39  339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.



The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility  for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

-------------------------------------------------------
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to