ITEM_INDEX in IJC_SCHEMA

User 6135131fe5

15-01-2009 20:22:09

Hi All,





This may be a "don't try this at home, kids!" sort of topic, but nonetheless here goes...





So I'm in a situation where I need to add relationships between many (~30) tables into an existing IJC schema in Oracle, and I don't want to do it manually because I will need to repeat the process at some point.





I understand the format of entries in the ITEM_VALUE column and have written PL/SQL to insert my own (GENERIC_TYPE) 'RELATIONSHIP' rows.  IJC seems to understand these entries and doesn't complain on startup.





I was, however, unable to deduce the structure of values in the ITEM_INDEX column, so I used a sequential integer for each new entry just to get things going.





So I have two questions:
  1. What does ITEM_INDEX do or mean? -and-
  2. How can I roll my own?
Thanks!





- Ryan

ChemAxon fa971619eb

16-01-2009 08:39:02

Yes, we definitely don't advise tinkering with the IJC metadata tables unless you know what you are doing!


A better alternative might be to use the IJC APIs to perform operations like this.





But if you want to do this then it should work, but tread carefully.





The ITEM_INDEX column is for ordering of the child items within the parent container. For instance, fields are a child of the entity. In this case the ITEM_INDEX indentifies the order of the fields in that entity. The ITEM_INDEX is jsut as integer value, in ascending order. Each combination or PARENT_ID and GENERIC_TYPE has a set of ITEM_INDEXes, with typically the first one added having a value of 1, the second 2 etc. They do not strictly have to be sequential, but they should be different, and if items are deleted then there will be "holes".


IJC assigns these by using the highest value plus one. I suggest you do the same.





Note that ordering in IJC (particular re-ordering) is not fully supported yet, but the ITEM_INDEX values should be generated correctly despite this.





Tim

User 6135131fe5

16-01-2009 21:40:03

Hi Tim,





Thanks, that makes sense.  I will try to tread carefully.





- Ryan