Version 5 (modified by 17 years ago) ( diff ) | ,
---|
FDO RFC 15 – FDO PropertyValueConstraintDictionary Class
This page contains a request for comments document (RFC) for the FDO Open Source project. More FDO RFCs can be found on the RFCs page.
Status
RFC Template Version | (1.0) |
Submission Date | February 9, 2008 |
Last Modified | Maksim Sestic Timestamp |
Author | Maksim Sestic |
RFC Status | Draft |
Implementation Status | Not Applicable |
Proposed Milestone | 3.3.1.0 |
Assigned PSC guide(s) | (when determined) |
Voting History | |
+1 | |
+0 | |
-0 | |
-1 |
Overview
Presently, PropertyValueConstraintList
may contain only plain list of predefined values forced upon particular
PropertyValue
(minus null value). In my opinion, it somehow beats sole purpose of Constraints in a view of
overall datastore consolidation. Therefor, suggestion is to create new class named
PropertyValueConstraintDictionary
(or whatever) that will keep pairs of [object,string] values, where object is a
key dictionary member (an item in present PropertyValueConstraintList
), while associated string represents
localized description of the value itself.
Example:
RoadTypePropertyValueConstraintDictionary: null , "n/a" 0 , "Highway" 1 , "Main road" 2 , "Street" ...
Therefor enforcing sound "rules" for data types and saving lots of storage - it's not clever to keep underlying RoadTypePropertyValue as String since it takes too much space, it's not possible to change associated meaning of data once the data is in the store, while schema user from different country may not understand "by default" what Main road means, etc.
On the client side, developers may build more robust UIs to deal with FDO-based data. I.e. a ComboBox instead of plain text field, where combo has it's values set to predefined PropertyValueConstraintDictionary
object range and displayed members consist of associated string values.
In that way users will be able to pick between "Highway", "Main road" or "Street", while underlying datastore keeps it's short
or boolean
(or any other) universal representation.
Implementation Details
Proposed class fits into OSGeo::FDO::Schema
namespace, where PropertyValueConstraintDictionary
inherits PropertyValueConstraint
just like PropertyValueConstraintList
and PropertyValueConstraintRange
do.
It should have a PropertyValueConstraintDictionary()
getter/setter, where getter returns Dictionary FDO implementation that holds actual key/value pairs (in this particular case Key type represents underlying PropertyValue type, while Value type is String).
Introduced Pros
- Major storage saver
- Splits data value from data representation (0 = "Highway" or True = "Yes")
- Enables creating of flags via binary math (1+2 = 3 = "Main road" AND "Street")
- Resolves data Localization issues
- Enables more advanced UI solutions on client side