Discussion:
[Geoserver-users] Mapping mandatory but nillable attributes that are feature chained in the case where the data doesn't exist
michaelsexton
2017-05-04 03:46:26 UTC
Permalink
Hi

I am currently trying to implement EarthResourceML 2.0 er:MineralOccurrence
and facing a problem with one of the relationships in the schema. For
reference:

http://www.earthresourceml.net/earthresourceml/2.0/doc/ERML_HTML_Documentation/

A er:MineralOccurrence has many er:oreAmounts, which map to a concrete class
of the abstract er:OreMeasure (in my model, either er:Reserve or
er:Resource). The er:oreAmount is mandatory but nillable. Here is the
snippet from my er_MineralOccurrence.xml mapping file, which maps the table
ER_MINERALOCCURRENCE

<AttributeMapping>
<targetAttribute>er:oreAmount</targetAttribute>
<sourceExpression>
<OCQL>ENO</OCQL>
<linkElement>er:Resource</linkElement>
<linkField>FEATURE_LINK[2]</linkField>
</sourceExpression>
</AttributeMapping>
<AttributeMapping>
<targetAttribute>er:oreAmount</targetAttribute>
<sourceExpression>
<OCQL>ENO</OCQL>
<linkElement>er:Reserve</linkElement>
<linkField>FEATURE_LINK[3]</linkField>
</sourceExpression>
</AttributeMapping>

These map to the files er_Reserve.xml and er_Resource.xml, which themselves
map to table ER_RESERVE and ER_RESOURCE.

The problem is when there are no Resources or Reserves for a given
MineralOccurrence. I thought I could cheat by adding another
AttributeMapping that inserts a ClientProperty with name and value of
xsi:nil='true'. But all this does is add the ClientProperty to the last
er:Reserve attribute and makes it invlaid.

What are the solutions for this problem? As I see it there are three:

1. An as yet unknown solution (to me) in the mapping config that allows an
nil artefact to populate even when it isn't necessary, that requires to
change to the physical data model.
2. A change to the physical data model in our RDBMS that populates
ER_MINERALOCCURRENCE with a 'oremeasure' field that determines whether a
feature chain is used via an if_then_else in the mapping file. This seems
fairly suboptimal.
3. A change to the boneheaded requirement of everything being mandatory in
the ERML standard, especially when the real world objects it is supposed to
model cannot meet that mandatory requirement (since when do small mineral
occurrence outcrops have an oreAmount????)

Any help would be greatly appreciated, this is driving me up the wall.

Thanks

Michael



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Mapping-mandatory-but-nillable-attributes-that-are-feature-chained-in-the-case-where-the-data-doesn-t-tp5319334.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
Nuno Oliveira
2017-05-04 09:16:14 UTC
Permalink
Hi,

Did you try setting encodeifempty to true:
http://docs.geoserver.org/stable/en/user/data/app-schema/mapping-file.html#encodeifempty-optional

Regards,

Nuno Oliveira
Post by michaelsexton
Hi
I am currently trying to implement EarthResourceML 2.0 er:MineralOccurrence
and facing a problem with one of the relationships in the schema. For
http://www.earthresourceml.net/earthresourceml/2.0/doc/ERML_HTML_Documentation/
A er:MineralOccurrence has many er:oreAmounts, which map to a concrete class
of the abstract er:OreMeasure (in my model, either er:Reserve or
er:Resource). The er:oreAmount is mandatory but nillable. Here is the
snippet from my er_MineralOccurrence.xml mapping file, which maps the table
ER_MINERALOCCURRENCE
<AttributeMapping>
<targetAttribute>er:oreAmount</targetAttribute>
<sourceExpression>
<OCQL>ENO</OCQL>
<linkElement>er:Resource</linkElement>
<linkField>FEATURE_LINK[2]</linkField>
</sourceExpression>
</AttributeMapping>
<AttributeMapping>
<targetAttribute>er:oreAmount</targetAttribute>
<sourceExpression>
<OCQL>ENO</OCQL>
<linkElement>er:Reserve</linkElement>
<linkField>FEATURE_LINK[3]</linkField>
</sourceExpression>
</AttributeMapping>
These map to the files er_Reserve.xml and er_Resource.xml, which themselves
map to table ER_RESERVE and ER_RESOURCE.
The problem is when there are no Resources or Reserves for a given
MineralOccurrence. I thought I could cheat by adding another
AttributeMapping that inserts a ClientProperty with name and value of
xsi:nil='true'. But all this does is add the ClientProperty to the last
er:Reserve attribute and makes it invlaid.
1. An as yet unknown solution (to me) in the mapping config that allows an
nil artefact to populate even when it isn't necessary, that requires to
change to the physical data model.
2. A change to the physical data model in our RDBMS that populates
ER_MINERALOCCURRENCE with a 'oremeasure' field that determines whether a
feature chain is used via an if_then_else in the mapping file. This seems
fairly suboptimal.
3. A change to the boneheaded requirement of everything being mandatory in
the ERML standard, especially when the real world objects it is supposed to
model cannot meet that mandatory requirement (since when do small mineral
occurrence outcrops have an oreAmount????)
Any help would be greatly appreciated, this is driving me up the wall.
Thanks
Michael
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Mapping-mandatory-but-nillable-attributes-that-are-feature-chained-in-the-case-where-the-data-doesn-t-tp5319334.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
https://lists.sourceforge.net/lists/listinfo/geoserver-users
--
==
GeoServer Professional Services from the experts!
Visit http://goo.gl/it488V for more information.
==
Nuno Miguel Carvalho Oliveira
@nmcoliveira
Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 333 8128928

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.
MG Sexton
2017-05-16 02:08:03 UTC
Permalink
Hi Ben

If you're not busy, this is a question that has been bugging me for the
past couple of weeks.

Thanks

Michael
Post by michaelsexton
Hi
I am currently trying to implement EarthResourceML 2.0 er:MineralOccurrence
and facing a problem with one of the relationships in the schema. For
http://www.earthresourceml.net/earthresourceml/2.0/doc/ERML_HTML_Documentation/
A er:MineralOccurrence has many er:oreAmounts, which map to a concrete class
of the abstract er:OreMeasure (in my model, either er:Reserve or
er:Resource). The er:oreAmount is mandatory but nillable. Here is the
snippet from my er_MineralOccurrence.xml mapping file, which maps the table
ER_MINERALOCCURRENCE
<AttributeMapping>
<targetAttribute>er:oreAmount</targetAttribute>
<sourceExpression>
<OCQL>ENO</OCQL>
<linkElement>er:Resource</linkElement>
<linkField>FEATURE_LINK[2]</linkField>
</sourceExpression>
</AttributeMapping>
<AttributeMapping>
<targetAttribute>er:oreAmount</targetAttribute>
<sourceExpression>
<OCQL>ENO</OCQL>
<linkElement>er:Reserve</linkElement>
<linkField>FEATURE_LINK[3]</linkField>
</sourceExpression>
</AttributeMapping>
These map to the files er_Reserve.xml and er_Resource.xml, which themselves
map to table ER_RESERVE and ER_RESOURCE.
The problem is when there are no Resources or Reserves for a given
MineralOccurrence. I thought I could cheat by adding another
AttributeMapping that inserts a ClientProperty with name and value of
xsi:nil='true'. But all this does is add the ClientProperty to the last
er:Reserve attribute and makes it invlaid.
1. An as yet unknown solution (to me) in the mapping config that allows an
nil artefact to populate even when it isn't necessary, that requires to
change to the physical data model.
2. A change to the physical data model in our RDBMS that populates
ER_MINERALOCCURRENCE with a 'oremeasure' field that determines whether a
feature chain is used via an if_then_else in the mapping file. This seems
fairly suboptimal.
3. A change to the boneheaded requirement of everything being mandatory in
the ERML standard, especially when the real world objects it is supposed to
model cannot meet that mandatory requirement (since when do small mineral
occurrence outcrops have an oreAmount????)
Any help would be greatly appreciated, this is driving me up the wall.
Thanks
Michael
--
http://osgeo-org.1560.x6.nabble.com/Mapping-mandatory-but-nillable-attributes-that-are-feature-chained-in-the-case-where-the-data-doesn-t-tp5319334.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
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Loading...