Topic
  • 4 replies
  • Latest Post - ‏2013-12-20T09:47:40Z by davidoff
davidoff
davidoff
33 Posts

Pinned topic ODME Data model : how to generate an index

‏2013-12-19T11:40:51Z |

Is it possible to generate an index from a collection .

In the data model, I've seen that it is possible to check 'Generated' for some columns , it seems also that we may add an index to a given table (see snapshot for the two hints)

 

Basically, I receive an indexed collections, possibly with duplicates rows, but I'd like to distinguish each of them. If it could be possible without Java customization (derived table for instance), I'd be interested.

 

Regards

Attachments

  • Michel Eisenmann
    Michel Eisenmann
    20 Posts

    Re: ODME Data model : how to generate an index

    ‏2013-12-20T02:14:24Z  

    Hi David,

    I'm afraid this is not possible with ODME.

    The features you see are kind of "inherited" from the standard Data perspective and are not usable in ODME.

    If I had to do this I would

    1- either create this index on the fly while populating the data from the outside into ODME scenario.

    2- or not include any primary key for this table

    Note that (1) does not require a lot of additional work on top of what you anyway have to do to load your data into your scenario...

    Finally, I don't think the derived column concept would help you there.

    Hope this helps

    Regards

    Michel

     

  • davidoff
    davidoff
    33 Posts

    Re: ODME Data model : how to generate an index

    ‏2013-12-20T08:54:36Z  

    Hi David,

    I'm afraid this is not possible with ODME.

    The features you see are kind of "inherited" from the standard Data perspective and are not usable in ODME.

    If I had to do this I would

    1- either create this index on the fly while populating the data from the outside into ODME scenario.

    2- or not include any primary key for this table

    Note that (1) does not require a lot of additional work on top of what you anyway have to do to load your data into your scenario...

    Finally, I don't think the derived column concept would help you there.

    Hope this helps

    Regards

    Michel

     

    Michel,

    Concerning option 2, suppose I receive duplicated rows in the data model, The OPL collection (namely coll1)  that are automatically generated through the mapping will remove duplicates . So in my case, this is not the expected behavior

     

    Therefore, looking at option 1, I will need to create a new collection (namely coll2)  from my original one. unfortunately, something like

    coll2= { <t , ord(oldCollection,t) > | t in coll1}, that can indeed add an integer index

    will not work since coll1 is coming from the mapping and has already no duplicates !

    Seems that the snake eats its tail here :-)

     

    David

  • Michel Eisenmann
    Michel Eisenmann
    20 Posts

    Re: ODME Data model : how to generate an index

    ‏2013-12-20T09:08:21Z  
    • davidoff
    • ‏2013-12-20T08:54:36Z

    Michel,

    Concerning option 2, suppose I receive duplicated rows in the data model, The OPL collection (namely coll1)  that are automatically generated through the mapping will remove duplicates . So in my case, this is not the expected behavior

     

    Therefore, looking at option 1, I will need to create a new collection (namely coll2)  from my original one. unfortunately, something like

    coll2= { <t , ord(oldCollection,t) > | t in coll1}, that can indeed add an integer index

    will not work since coll1 is coming from the mapping and has already no duplicates !

    Seems that the snake eats its tail here :-)

     

    David

    David,

    Looks like you are only considering OPL here.
    What I'm talking about is adding this column at the ODME level.

    Basically, in your ODME application, you define your table with the additional column
     and you add the index either on the fly or after you have read.

    - On the fly, means adding the index creation during the reading of your data. This is easy to do if you already have a custom updater.

    - after reading mean creating a IloScenarioUpdater JUST for the setting of the column index value. This updater can be either called automatically after you have read your data or also automatically just before you send the data to OPL

    Check attached ServiceHook class to see where to insert your code...

    Regards

    Michel

    Attachments

  • davidoff
    davidoff
    33 Posts

    Re: ODME Data model : how to generate an index

    ‏2013-12-20T09:47:40Z  

    Thanks

    For the first option, I'm able to create a class that implements IloScenarioUpdater

    Now, is this class automatically invoked when the jar for the java project is added to the deployment resources ? Or shall I configure something else ?