Il giorno lun, 06/07/2015 alle 15.26 +0200, Andrea Aime ha scritto:
> On Mon, Jul 6, 2015 at 3:20 PM, Stefano Costa
> <stefano.co...@geo-solutions.it> wrote:
>         Sorry, I wasn't clear, that's what I meant to do: changing the
>         class
>         FilterToMongo, which is in charge of translating a Filter to a
>         query
>         object understandable to MongoDB, so that the '/' separator in
>         property
>         names is converted back to '.'.
>         
>         Do you foresee this would break anything?
>         
> 
> 
> It's a bit of a hack, but as long as the mongodb store only publishes
> simple features, 
> it should work.
> 
> 
> As an alternative solution, it might be cleaner if the mongo store
> published nested 
> attributes using a different separator, like _ (it must be a valid
> part of a xml element
> name). I guess doing that might increase significantly clashes with
> valid chars in the
> mongo property names, forcing you to keep a in memory mapping between
> the
> native names and the published ones.

Turns out it was not as bas as it looked, since the Mongo datastore
implementation already stores the full path to the property (using "."
notation for nested properties) in the feature type's userData map (key
"mapping"), so the attribute's local name can be manipulated as we see
fit: the collection mapper will always be able to get back to the
original name by reading the mapping information.
I patched MongoInferredMapper, which is in charge of analyzing a mongo
collection and deriving a feature type from it, so that before an
attribute is added to the feature type, its name if passed to a
encodeFieldName() function, which takes care of replacing problematic
characters in it (so far, I'm replacing '.' with '_' and ':' with '-',
the latter one to avoid issues writing features to XML).

I can see two drawbacks with this approach

1. attributes are being renamed in a way that may puzzle the user, who
will have to check the generated schema to be able to write valid
filters.
2. manually crafted schemas may still be affected by the issue: perhaps
the schema reader should throw an error (or at least a warning) if
invalid characters are detected in attribute names?

Pull request is here:
https://github.com/geotools/geotools/pull/908

I can try and write a test if needed.

Thanks for any feedback,
--SC


> 
> 
> 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 Poggio alle Viti 1187
> 55054  Massarosa (LU)
> Italy
> 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.
> 
> 
> 
> 
> -------------------------------------------------------

-- 

Best regards,
Stefano Costa

==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==
Dott. Stefano Costa
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:     +39 0584 1660272

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.




------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to