Changes between Version 7 and Version 8 of FDORfc15


Ignore:
Timestamp:
Mar 13, 2008, 7:54:35 AM (16 years ago)
Author:
MaksimS
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FDORfc15

    v7 v8  
    1 = FDO RFC 15 – FDO !PropertyValueConstraintDictionary Class =
     1= FDO RFC 15 – FDO PropertyValueConstraintDictionary Class =
    22
    33This page contains a request for comments document (RFC) for the FDO Open Source project. 
     
    2020||-1||||
    2121
     22
    2223== Overview ==
    23 Presently, `PropertyValueConstraintList` may contain only plain list of predefined values forced upon particular
    24 `PropertyValue` (minus null value). In my opinion, it somehow beats sole purpose of Constraints in a view of
    25 overall datastore consolidation. Therefor, suggestion is to create new class named
    26 `PropertyValueConstraintDictionary` (or whatever) that will keep pairs of [object,string] values, where object is a
    27 key dictionary member (an item in present `PropertyValueConstraintList`), while associated string represents
    28 localized description of the value itself.
     24
     25Presently, `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.
     26
     27This RFC suggest enforcing sound ''rules'' for data types and saving lots of storage - it's not clever to keep underlying i.e. 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.
     28
     29On 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.
     30
     31
     32== Motivation ==
     33
     34There are two possible approaches to this:
     35
     36  1. `PropertyValueConstraintDictionary` - a Constraint 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.
    2937
    3038Example:
     
    4048}}}
    4149
    42 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.
     50This one is bit harder to implement. That's because present implementation of `DictionaryElement` (building block of `DictionaryElementCollection`, which, I guess, ressembles to generic FDO Dictionary) has following definition:
    4351
    44 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. [[BR]]
    45 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.
     52{{{
     53OSGeo::FDO:Common:DictionaryElement (System::String *name, System::String *value)
     54}}}
     55
     56This is a bit tricky in the light of `PropertyValueConstraintDictionary` since dictionary key is a String, while `PropertyValue` may be of any (reasonable) FDO type for that matter. I guess it would take few additional generic dictionary elements with different Key types (Short... Int16, Int32... Double... etc). Term "name" used for `DictionaryElement` parameter is not appropriate - term "key" is somehow more suitable. It seems that DictionaryElement and DictionaryElementCollection classes may undergo major reconstruction for `PropertyValueConstraintDictionary` to work.
     57
     58  2. `PropertyValueConstraintLookup` - a Constraint with it's definition based on data persisted in another class. Please see related proposed solution and implementation details below.
    4659
    4760
    48 == Implementation Details ==
    49 Proposed class fits into `OSGeo::FDO::Schema` namespace, where `PropertyValueConstraintDictionary` inherits `PropertyValueConstraint` just like `PropertyValueConstraintList` and `PropertyValueConstraintRange` do. [[BR]]
    50 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).
     61== Proposed Solution ==
     62
     63Suggestion is to create new class named `PropertyValueConstraintLookup` (or `PropertyValueConstraintPickList`, as Barbara proposed) - a Constraint with it's definition based on data persisted in another class. Such Constraint would only reference another lookup class' contents - it's internal Dictionary would act as a proxy, meaning that no actual data would get associated with such Constraint.
     64
     65Proposed class fits into `OSGeo::FDO::Schema` namespace, where `PropertyValueConstraintDictionary` inherits `PropertyValueConstraint` just like `PropertyValueConstraintList` and `PropertyValueConstraintRange` do.
     66
     67Functionality overview:
     68  1. new class PropertyValueConstraintLookup (or PropertyValueConstraintPickList)
     69  2. takes feature schema name as parameter
     70  3. takes a source class/feature class name from 2) as parameter
     71  4. takes Key property name from 3) for key data source
     72  5. takes Value property name from 3) for value data source (can be same as 4) for that matter)
     73  6. has a getter method returning... well... instantiated FdoReader instead of a dictionary (?)
     74  7. has GroupBy and SortBy optional properties being cast upon 3)
     75  8. Throws an error if there're duplicate keys in 4) - acting as some sort of proxy dictionary
     76
     77There's also one tricky thing about such class - it's "persistancy" within feature store when underlying data changes (4,5). In other words - it doesn't represent a true constraint. Otherwise, it would probably make it all too complex and resource-consuming to implement. For starters, let's have a consumer developer keep track of underlying data versioning and consistency.
    5178
    5279
    5380== Introduced Pros ==
     81
    5482 * Major storage saver
    5583 * Splits data value from data representation (0 = "Highway" or True = "Yes")